An Approach to Regular Separability in Vector Addition Systems
aa r X i v : . [ c s . F L ] J un An Approach to Regular Separability in VectorAddition Systems
Wojciech Czerwi´nski and Georg Zetzsche University of Warsaw Max Planck Institute for Software Systems (MPI-SWS)
Abstract.
We study the problem of regular separability of languagesof vector addition systems with states (VASS). It asks whether for twogiven VASS languages K and L , there exists a regular language R thatincludes K and is disjoint from L . While decidability of the problem infull generality remains an open question, there are several subclasses forwhich decidability has been shown: It is decidable for (i) one-dimensionalVASS, (ii) VASS coverability languages, (iii) languages of integer VASS,and (iv) commutative VASS languages.We propose a general approach to deciding regular separability. We useit to decide regular separability of an arbitrary VASS language from anylanguage in the classes (i), (ii), and (iii). This generalizes all previousresults, including (iv). Vector addition systems with states
Vector addition systems with states (VASS) [17]are one of the most intensively studied model for concurrent systems. They canbe seen as automata with finitely many counters, which can be increased or de-creased whenever its values is non-negative, but not tested for zero. Despite theirfundamental nature and the extensive interest, core aspects remain obscure. Aprominent example is the reachability problem, which was shown decidable inthe early 1980s [30]. However, its complexity remains unsettled. The best knownupper bounds are non-primitive-recursive [29], whereas the best known lowerbound is tower hardness [8], and reachability seems far from being understood.There is also a number of other natural problems concerning VASS where thecomplexity or even decidability remains unresolved. An example is the structuralliveness problem, which asks whether there exists a configuration such that forevery configuration c reachable from it and every transition t one can reach from c some configuration in which t is enabled. Its decidability status was settled onlyrecently [21], but the complexity is still unknown. For closely related extensionsof VASS, namely branching VASS and pushdown VASS even decidability statusis unknown with the best lower bound being tower-hardness [25,26]. This allsuggests that there is still a lot to understand about VASS. Separability problem
One way to gain a fresh perspective and deeper understand-ing of the matter is to study decision problems that generalize reachability. Iteems to us that here, a natural choice is the problem of regular separability . Itasks whether for two given languages K and L there exists a regular separator ,i.e. a regular language R such that K ⊆ R and R ∩ L = ∅ . Decidability of thisproblem for general VASS languages appears to be difficult. It has been showndecidable for several subclasses, namely for (a) commutative VASS languages [5](equivalently, separability of sections of reachability sets by recognizable sets),for (b) one-counter nets [7] i.e. VASS with one counter, (c) integer VASS [4], i.e.VASS where we allow counters to become negative, and finally for (d) coverabilitylanguages , which follows from the general decidability for well-structured tran-sition systems [9]. However, in full generality, decidability remains a challengingopen question. It should be mentioned that this line of research has already ledto unforeseen insights: The closely related problem of separability by boundedregular languages prompted methods that turned out to yield decidability resultsthat were deeply unexpected [6]. Contribution
We present a general approach to deciding separability by regularlanguages and prove three new results, which generalize all four regular sep-arability results shown until now. Specifically, we show decidability of regularseparability of (i) VASS languages from languages of one-counter nets, (ii) VASSlanguages from coverability VASS languages, and (iii) VASS languages from in-teger VASS languages. This clearly generalizes results (b), (c), and (d) above,and we will see that this also strengthens (a).
Main ingredients
The starting point of our approach is the observation that formany language classes K , deciding regular separability of a language L froma given language K in K can be reduced to deciding regular separability of L from some fixed language G in K . In all three cases (i)–(iii), this allows us tointerpret the words in L as walks in the grid Z n . For (i), we then have to decideseparability from those walks in Z = Z that remain in N and arrive at zero. For(ii), we decide separability from the set of walks that remain in N n and arrivesomewhere in N n . For (iii), we want to separate from all walks in Z n that endat the origin. The corresponding fixed languages are denoted D (for (i)), C n (for (ii)), and Z n (for (iii)), respectively.In order to decide separability from a fixed language G (i.e. D , C n , or Z n ),we first classify those regular languages that are disjoint from G . Second, theclassifications are used to decide whether a given VASS language L is includedin such a regular language. These decision procedures employ either the previousresult (a) above or reduce to the simultaneous unboundedness problem (whichis known to be decidable for VASS languages [16,6]). VASS vs. integer VASS
The result (iii) is significantly more involved than (i)and (ii). First, the classification of regular languages disjoint from Z n leads to ageometric characterization of regular separability. This is then applied in a de-cision procedure that employs the KLMST decomposition from the algorithmsby Sacerdote and Tenney [37], Mayr [30], Kosaraju [22], and Lambert [23] (andecast by Leroux and Schmitz [29]) for reachability in VASS. Previous algo-rithms for VASS languages that use this decomposition (by Habermehl, Meyer,and Wimmel [16] and by Czerwi´nski, Hofman, and Zetzsche [6]) perform thedecomposition once, which yields regular overapproximations that contain allinformation needed for their purposes. Our procedure requires an additional re-finement: Depending on a property of each overapproximation, we can eitherreduce separability to the commutative case and apply (a) or we can reduce thedimension of the input language (i.e. transform it into a set of walks in Z m for m < n ) and invoke our algorithm recursively. Connection to VASS reachability
We hope that this approach can be used todecide regular separability for VASS in full generality in the future. This wouldamount to deciding regular separability of a given VASS language from the setof all walks in Z n that remain in N n and arrive in the origin. The correspond-ing language is denoted D n . We emphasize that an algorithm along these linesmight directly yield new insights concerning reachability: Classifying those regu-lar languages that are disjoint from D n would yield an algorithm for reachabilitybecause the latter reduces to intersection of a given regular language with D n .Such an algorithm would look for a certificate for non-reachability (like Leroux’salgorithm [27]) instead of a run. Related work
Aside from regular separability, separability problems in a moregeneral sense have also attracted significant attention in recent years. Here, theclass of sought separators can differ from the regular languages. A series of recentworks has concentrated on separability of regular languages by separators fromsubclasses [31,32,33,34,35,36], and work in this direction has been started fortrees as well [2,13].In the case of non-regular languages as input languages, it was shown earlythat regular separability is undecidable for context-free languages [39,18]. More-over, aside from the above mentioned results on regular separability, infinite-state systems have also been studied with respect to separability by boundedregular languages [6] and piecewise testable languages [10] and generalizationsthereof [41]. By Q ( Q + ), we denote the set of (non-negative) rational numbers. Let Σ bean alphabet and let ε denote the empty word. If Σ = { x , . . . , x n } , then the Parikh image of a word w ∈ Σ ∗ is defined as Ψ ( w ) = ( | w | x , . . . , | w | x n ), where | w | x denotes the number of occurrences of x in w . The commutative closure ofa language L ⊆ Σ ∗ is Π ( L ) = { u ∈ Σ ∗ | ∃ v ∈ L : Ψ ( v ) = Ψ ( u ) } .A ( n -dimensional) vector addition system with states (VASS) is a tuple V = ( Q, T, s, t ), where Q is a finite set of states , T ⊆ Q × Σ ε × Z n × Q is afinite set of transitions, s ∈ Q is its source state , t ∈ Q is its target state . Here, Σ ε denotes Σ ∪ { ε } . A configuration of V is a pair ( q, u ) ∈ Q × N n . For eachransition t = ( q, x, v , q ′ ) ∈ T and configurations ( q, u ), ( q ′ , u ′ ) with u ′ = u + v ,we write ( q, u ) x −→ ( q ′ , u ′ ). For a word w ∈ Σ ∗ , we write ( q, u ) w −→ ( q ′ , u ′ ) if thereare x , . . . , x n ∈ Σ ε and configurations ( q i , v i ) for i ∈ [0 , n ] with ( q i − , v i − ) x i −→ ( q i , v i ) for i ∈ [1 , n ], ( q , v ) = ( q, u ), and ( q n , v n ) = ( q ′ , u ′ ). The languageof V is then L ( V ) = { w ∈ Σ ∗ | ( s, ) w −→ ( t, ) } . An ( n -dimensional) inte-ger vector addition system with states ( Z -VASS) [15] is syntactically a VASS,but for Z -VASS, the configurations are pairs in Q × Z n . This difference aside,the language is defined verbatim. Likewise, an n -dimensional coverability vectoraddition system with states (coverability VASS) is syntactically a VASS. How-ever, if we regard a VASS V as a coverability VASS, we define its language as L ( V ) = { w ∈ Σ ∗ | ( s, ) w −→ ( t, u ) for some u ∈ N n } . Let V n ( Z n , C n ) denotethe class of languages of n -dim. VASS ( Z -VASS, coverability VASS).Let Σ n = { a i , ¯ a i | i ∈ [1 , n ] } and define the homomorphism ϕ n : Σ ∗ n → Z n by ϕ n ( a i ) = e i and ϕ n (¯ a i ) = − e i . Here, e i ∈ Z n is the vector with 1 in coordinate i and 0 everywhere else. By way of ϕ n , we can regard words from Σ ∗ n as walksin the grid Z n that start in the origin. Later, we will only write ϕ when the n isclear from the context. With this, let Z n = { w ∈ Σ ∗ n | ϕ ( w ) = } . Hence, Z n isthe set of walks that start and end in the origin.For w ∈ Σ ∗ , let drop( w ) = min { ϕ ( v ) | v is a prefix of w } . Thus, if w isinterpreted as walking along Z , then drop( w ) is the lowest value attained on theway. Note that drop( w ) ∈ [ −| w | ,
0] for every w ∈ Σ ∗ . We define C = { w ∈ Σ ∗ | drop( w ) = 0 } . For each i ∈ [1 , n ], let λ i : Σ ∗ n → Σ ∗ be the homomorphism with λ i ( a i ) = a , λ i ( a j ) = ε for j = i , and λ i (¯ a j ) = λ i ( a j ) for every j ∈ [1 , n ]. Thenwe define C n = T ni =1 λ − i ( C ). Thus, C n is the set of walks in Z n that start in theorigin and remain in the positive orthant N n . Finally, let D n = C n ∩ Z n . Hence, D n collects those walks that start in the origin, always remain in N n and arrivein the origin. For w ∈ Σ ∗ n , w = w · · · w m , w , . . . , w m ∈ Σ n , let ¯ w = ¯ w · · · ¯ w m and w rev = w m · · · w . Here, we set ¯¯ a i = a i for a i ∈ Σ n . For L ⊆ Σ ∗ we define L = { ¯ w | w ∈ L } .For alphabets Σ, Γ , a subset T ⊆ Σ ∗ × Γ ∗ is a rational transduction if itis a homomorphic image of a regular language, i.e. if there is an alphabet ∆ ,a regular K ⊆ ∆ ∗ , and a morphism h : ∆ ∗ → Σ ∗ × Γ ∗ such that T = h ( K ).Typical examples of rational transductions are the relation { ( w, g ( w )) | w ∈ Σ ∗ } for some morphism g : Σ ∗ → Γ ∗ or { ( w, w ) | w ∈ R } for some regular language R ⊆ Σ ∗ [1].It is well-known that if S ⊆ Σ ∗ × Γ ∗ and T ⊆ ∆ ∗ × Σ ∗ are rational trans-ductions, then the relation S ◦ T , which is defined { ( u, v ) ∈ ∆ ∗ × Γ ∗ | ∃ w ∈ Σ ∗ : ( u, w ) ∈ T, ( w, v ) ∈ S } and also T − = { ( v, u ) ∈ Σ ∗ × ∆ ∗ | ( u, v ) ∈ T } arerational transductions as well [1].For a language L ⊆ Σ ∗ and a subset T ⊆ Σ ∗ × Γ ∗ , we define T L = { v ∈ Γ ∗ |∃ u ∈ L : ( u, v ) ∈ T } . A language class K is called full trio if for every L ⊆ Σ ∗ from K , and every rational transduction T ⊆ Σ ∗ × Γ ∗ , we also have T L in K .The full trio generated by L , denoted by M ( L ), is the class of all languages T L ,where T ⊆ Σ ∗ × Γ ∗ is a rational transduction for some Γ . It is well-known that V n , C n , and Z n are (effectively) the full trios generated by D n , C n , and Z n ,espectively [14,19]. Since these two paper do not mention effectivity explicitly,we include a short proof. Proposition 1.
We have the identities V n = M ( D n ) , C n = M ( C n ) , and Z n = M ( Z n ) . Moreover, all inclusions are effective: A description in one form can beeffectively transformed into the other.Proof. To simplify notation, we use finite-state transducers in the proof. A finite-state transducer is a tuple T = ( Q, Σ, Γ, E, s, t ), where Q is a finite set of states , Σ is its input alphabet , Γ is its output alphabet , E ⊆ Q × Σ ∗ × Γ ∗ × Q is afinite set of transitions , s ∈ Q is its starting state , and t ∈ Q is its terminalstate . For such a transducer and a language L ⊆ Σ ∗ , we write R ( T ) for theset of all pairs ( u, v ) ∈ Σ ∗ × Γ ∗ for which there is a sequence of transitions( q , u , v , q )( q , u , v , q ) · · · ( q n − , u n , v n , q n ) such that q = s , q n = t , u = u · · · u n , and v = v · · · v n . It is easy to see that a relation T ⊆ Σ ∗ × Γ ∗ isrational by our definition if and only if there is a finite-state transducer T with T = R ( T ) [1, Theorem 6.1]. If T = R ( T ) and L ⊆ Σ ∗ , then for T L , we alsosimply write T ( L ).We begin with the inclusion M ( D n ) ⊆ V n . Given a transducer T = ( Q, Σ n , Γ, E, s, t )and n ∈ N , we construct a VASS V as follows. First, by splitting each edgesinto a sequence of edges, we may assume that every edge in T is of the form( p, w, x, q ) with x ∈ Γ ∪ { ε } . We define V = ( Q, Γ, T, s, t ) as follows. For everyedge ( p, w, x, q ) in T , V has a transition ( p, x, w , q ), where w = ϕ ( w ). Recall that ϕ : Σ ∗ n → Z n is the morphism with ϕ ( a i ) = e i and ϕ (¯ a i ) = − e i , where e i ∈ Z n isthe unit vector with 1 in the i -th coordinate and 0 everywhere else. Then clearly, L ( V ) = T ( D n ). This proves M ( D n ) ⊆ V n . For the inclusions M ( C n ) ⊆ C n and M ( Z n ) ⊆ Z n , we construct the same VASS, but interpret it as a coverabilityVASS or as an integer VASS and the same equality of languages will hold.For the inclusion V n ⊆ T ( D n ), consider a VASS V = ( Q, Γ, T, s, t ). To con-struct the transducer T = ( Q, Σ n , Γ, E, s, t ) so that T ( D n ) = L ( V ), we need toturn vectors u ∈ Z n into words. Given a vector u = ( u , . . . , u n ) ∈ Z , definethe word w u as a u · · · a u n n . Here, if u i <
0, we define a u i i as ¯ a | u i | i . Our trans-ducer has the following edges. For each transition ( p, x, u , q ) in V , T has an edge( p, w u , x, q ). Then clearly, T ( D n ) = L ( V ). As above, if T is applied to C n or Z n , then we construct the same VASS, but interpret it as a coverability VASSor integer VASS, respectively. ⊓⊔ State of the art
We now give a brief overview of previous results on regularseparability for subclasses of VASS languages. Two languages
K, L ⊆ Σ ∗ arecalled regularly separable if there exists a regular language S ⊆ Σ ∗ with K ⊆ S and L ∩ S = ∅ . In that case, we write K | L . The regular separability problem asks, given languages K and L , whether K | L . The first studied subclass ofVASS was that of commutative VASS languages , i.e. those of the form Π ( L ) fora VASS language L . Theorem 2 ([5]).
Given VASS languages
K, L ⊆ Σ ∗ , it is decidable whether Π ( K ) | Π ( L ) . s observed in [6], Theorem 2 also implies the following. Corollary 3 ([5,6]).
Given VASS languages
K, L and words w , . . . , w m ∈ Σ ∗ such that K, L ⊆ w ∗ · · · w ∗ m , it is decidable whether K | L . After Theorem 2, the investigation went on to 1-dim. VASS [7]:
Theorem 4 ([7]).
Given 1-VASS languages K and L , it is decidable whether K | L . Moreover, the next theorem has been established in [4].
Theorem 5 ([4]).
Given Z -VASS languages K, L ⊆ Σ ∗ , it is decidable whether K | L . It should be noted that the authors of [4] speak of Parikh automata, but theseare equivalent to Z -VASS: Parikh automata are equivalent to reversal-boundedcounter machines [3, Prop. 3.13] and the latter are equivalent to blind countermachines [14, Theorem 2], which are the same as Z -VASS.Finally, a recent general result shows that any two coverability languagesof well-structured transition systems [11,12] fulfilling some mild conditions areregular separable if and only if they are disjoint [9]. In particular it applies to thesituation when the systems are upward-compatible and one of them is finitelybranching, which is the case for coverability VASS languages: Theorem 6 ([9]).
Given coverability VASS languages
K, L ⊆ Σ ∗ , it is decidablewhether K | L . ≥ -VASS Z -VASS c-VASS VASSD [7] D D D D
D D D ≥ -VASSD [4] D D Z -VASSD [5] ? c-VASS? VASS Table 1: Overview of the decidability of regular separability for VASS subclasses.Here, ≥ -VASS and c-VASS are short for coverability VASS languages, and com-mutative VASS languages, respectively. The entry in the column for class K and the row for class K denotes decidability of regular separability of languagesof K from languages of K . The entries in bold are new consequences of resultsin this paper.In this section, we record the main results of this work. See Table 1 for anoverview. Our first main result is that regular separability is decidable if oneinput language is a VASS language and the other is the language of a 1-VASS. heorem 7. Given a VASS V and a 1-dim. VASS V , it is decidable whether L ( V ) | L ( V ) . This generalizes Theorem 4, because here, one of the input languages can be anarbitrary VASS language. Our second main result generalizes Theorem 6 in thesame way as Theorem 7 extends Theorem 4:
Theorem 8.
Given a VASS V and a coverability VASS V , it is decidablewhether L ( V ) | L ( V ) . Our third main result is decidability of regular separability of a given VASSlanguage from a given Z -VASS language. Theorem 9.
Given a VASS V and a Z -VASS V , it is decidable whether L ( V ) | L ( V ) . As before, this significantly generalizes Theorem 5. Our proof of Theorem 9 re-lies on Theorem 2. At first glance, it might seem that Theorem 9 is unrelated toregular separability of commutative VASS languages. However, a simple obser-vation shows that Theorem 9 also strengthens Theorem 2. This is because fordeciding regular separability of commutative VASS languages, one may assumethat one of the input languages is Z n : Proposition 10.
Let Γ n = { a , . . . , a n } ⊆ Σ n . For any K, L ⊆ Γ ∗ n , we have Π ( K ) | Π ( L ) if and only if Π ( KL ) | Z n . Since Π ( KL ) is a VASS language and Z n is a Z -VASS language, this meansTheorem 9 indeed strengthens Theorem 2.The rest of this section proves Proposition 10, which follows from two simpleobservations. The first concerns separability of subsets of monoids. If M is amonoid and K, L ⊆ M are subsets, then K and L are called separable if thereis a morphism ϕ : M → F into a finite monoid F such that ϕ ( K ) ∩ ϕ ( L ) = ∅ .Clearly, if K, L ⊆ Σ ∗ , then K and L are separable if and only if K | L . Therefore,it creates no inconsistencies to write K | L whenever K, L ⊆ M are separable.Let ∆ = { ( m, m ) | m ∈ M } ⊆ M × M . Lemma 11.
Let
K, L ⊆ M . Then K | L if and only if K × L | ∆ .Proof. If K | L with ϕ : M → F , define ϕ ′ : M × M → F × F by ϕ ′ ( u, v ) =( ϕ ( u ) , ϕ ( v )). Then clearly ϕ ′ ( K × L ) ∩ ϕ ′ ( ∆ ) = ∅ . Conversely, if K × L | ∆ with amorphism ϕ : M × M → F , let ϕ ′ : M → F be the morphism with ϕ ′ ( u ) = ϕ ( u, u ∈ M . Then we have ϕ ′ ( K ) ∩ ϕ ′ ( L ) = ∅ , because if there were u ∈ K , v ∈ L with ϕ ′ ( u ) = ϕ ′ ( v ), then ϕ ( K × L ) ∋ ϕ ( u, v ) = ϕ ( u, ϕ (1 , v ) = ϕ ( v, ϕ (1 , v ) = ϕ ( v, v ) ∈ ϕ ( ∆ ) , and thus ϕ ( K × L ) ∩ ϕ ( ∆ ) = ∅ , which is impossible. ⊓⊔ or subsets S, T ⊆ N Σ , separability is equivalent to unary separability asstudied by [5]. We now have: Π ( K ) | Π ( L ) ⇔ Ψ ( K ) | Ψ ( L ) ⇔ Ψ ( K ) × Ψ ( L ) | ∆ ⇔ Ψ ( K ) × Ψ ( ¯ L ) | ∆ ′ ⇔ Π ( K ¯ L ) | Z n , where ∆ ′ = { u ∈ N Σ ∪ ¯ Σ | u ( a i ) = u (¯ a i ) for i ∈ [1 , n ] } . Here, the third equiva-lence is just renaming components. The second equivalence is Lemma 11; thefirst and last equivalence are due to an observation from [5]: In [5, Lemma 11],it is shown that for languages K, L ⊆ Σ ∗ , we have Π ( K ) | Π ( L ) if and only if Ψ ( K ) | Ψ ( L ). This completes Proposition 10. In this section, we introduce our approach to regular separability together withthe first application: Regular separability of VASS languages and 1-dim. VASSlanguages.Our approach is inspired by the decision procedure for regular separabilityfor one dimensional VASS [7]. There, given languages K and L , the idea is toconstruct approximants K k and L k for k ∈ N . Here, K k and L k are regularlanguages with K ⊆ K k and L ⊆ L k for which one can show that K | L if andonly if there is a k ∈ N with K k ∩ L k = ∅ . The latter condition is then checkedalgorithmically.We simplify this idea in two ways. First, we show that for many languageclasses, one may assume that one of the two input languages is fixed (or fixed upto a parameter). Roughly speaking, if a language class K is defined by machinesinvolving a finite-state control, then K is typically a full trio since a transductioncan be applied using a product construction in the finite-state control. Moreover,there is often a simple set G of languages so that K is the full trio generated by G . For example, as mentioned above, V n is generated by D n for each n ≥
1. Thismakes the following simple lemma very useful.
Lemma 12.
Let T be a rational transduction. Then L | T K if and only if T − L | K .Proof. Suppose L ⊆ R and R ∩ T K = ∅ for some regular R . Then clearly T − L ⊆ T − R and T − R ∩ K = ∅ . Therefore, the regular set T − R witnesses T − L | K . Conversely, if T − L | K , then K | T − L and hence, by the firstdirection, ( T − ) − K | L . Since ( T − ) − = T , this reads T K | L and thus L | T K . ⊓⊔ Suppose we have full trios K and K generated by languages G and G , re-spectively. Then, to decide if T G | T G , we can check whether T − T G | G .Since T − T is also a rational transduction and hence T − T G belongs to K ,this means we may assume that one of the input languages is G . This effectivelyturns separability into a decision problem with one input language L where weask whether L | G .oing further in this direction, instead of considering approximants of twolanguages, we just consider regular overapproximations of G and decide whether L intersects all of them. However, we find it more convenient to switch to thecomplement and think in terms of “basic separators of G ” instead of over-approximations of G . Informally, we call a family of regular languages basicseparators of G if (i) each of them is disjoint from G and (ii) every regularlanguage R disjoint from G is included in a finite union of basic separators.This implies that L | G if and only if there exists a finitely many basic separa-tors S , . . . , S k such that L is contained in the union S i ∈ [1 ,k ] S i . Note that foreach language G there trivially exists a family of basic separators; just take thefamily of all regular languages disjoint from G . Our approach is to identify afamily of basic separators for which it is decidable whether a language from K is included in a finite union of them. Basic separators for one-dimensional VASS
Let us see this approach in an ex-ample and prove Theorem 7. Since V is generated as a full trio by D , Lemma 12tells us that it suffices to decide whether a given VASS language L fulfills L | D .Now the first step is to develop a notion of basic separators for D .Since D ⊆ Σ ∗ , we assume now that n = 1, meaning ϕ : Σ ∗ → Z . One way afinite automaton can guarantee non-membership in D is by modulo counting.For k ∈ N , let M k = { w ∈ Σ ∗ | ϕ ( w ) k } , which is regular. Another option for an automaton to make sure an input word w avoids D is to guarantee (i) for prefixes v of w , that ϕ ( v ) does not exceedsome k if drop( v ) = 0 and (ii) ϕ ( w ) = 0. For w ∈ Σ ∗ , let µ ( w ) = max { ϕ ( v ) | v is a prefix of w and drop( v ) = 0 } and B k = { w ∈ Σ ∗ | w / ∈ D and µ ( w ) ≤ k } Here, the B stands for “bounded counter value”. It is obvious that the languages B k are disjoint from D . We observe that they are regular: A word w with µ ( w ) ≤ k avoids D if and only if (i) ϕ drops below zero after a prefix where ϕ is confined to [0 , k ] or (ii) ϕ stays above zero and thus assumes values in [0 , k ]throughout. The third type of separator is a symmetric right-to-left version of B k , namely ¯ B rev k = { ¯ w rev | w ∈ B k } = { w ∈ Σ ∗ | w / ∈ D and µ ( ¯ w rev ) ≤ k } Then we have indeed a family of basic separators for D : Lemma 13.
Let R ⊆ Σ ∗ be a regular language. Then R ∩ D = ∅ if and only if R is included in M k ∪ B ℓ ∪ ¯ B rev m for some k, ℓ, m ∈ N .Proof. The proof of Lemma 13 is very similar to the proof of Lemma 8 in [7],but phrased in a slightly different setting.he “if” direction is obvious, so let us prove the “only if”. Suppose R ∩ D = ∅ and R = L ( A ) for an automaton A with n states. We claim that then R ⊆ M n ! ∪ B n ∪ ¯ B rev n .We proceed by a relatively simple pumping argument. Towards a contra-diction, we assume that there is a word w ∈ R with w / ∈ M n ! ∪ B n ∪ ¯ B rev n .This means ϕ ( w ) ≡ n ! and w has a prefix u ′ with drop( u ′ ) = 0 and ϕ ( u ′ ) = µ ( w ) > n and a suffix v ′ with drop( ¯ v ′ rev ) = 0 and ϕ ( ¯ v ′ rev ) = µ ( ¯ w rev ) > n ,hence ϕ ( v ′ ) < − n . We aim at pumping u ′ and v ′ such we get a word in D andfinish with contradiction. Let u be the shortest prefix of w with ϕ ( u ) = ϕ ( u ′ )and let v be the shortest suffix with ϕ ( v ′ ) = ϕ ( v ). Then | u | ≤ | u ′ | and | v | ≤ | v ′ | ,which means in particular drop( u ) = 0 and drop(¯ v rev ) = 0.Let us show that u and v do not overlap in w , i.e. | w | ≥ | u | + | v | . If they dooverlap, we can write w = xyz so that u = xy and v = yz with y = ε . Then byminimality of u , we have ϕ ( x ) < ϕ ( xy ) and thus ϕ ( y ) >
0. Symmetrically, mini-mality of v yields ϕ (¯ z rev ) < ϕ ( ¯ yz rev ) and thus − ϕ ( y ) = ϕ (¯ y rev ) >
0, contradicting ϕ ( y ) >
0. Thus u and v do not overlap and we can write w = uw ′ v .Since ϕ ( u ) > n , we can decompose u = u u u so that 1 ≤ ϕ ( u ) ≤ n andin the run of A for w , u is read on a cycle. Analogously, since ϕ ( v ) < − n , wecan decompose v = v v v so that − n ≤ ϕ ( v ) ≤ − v is read on a cycle.Since ϕ ( w ) ≡ n ! and ϕ ( u ) ∈ [1 , n ] and ϕ ( v ) ∈ [ − n, − p, q ∈ N with ϕ ( w ) + pϕ ( u ) + qϕ ( v ) = 0. Moreover, we also have ϕ ( w ) + ( p + r | ϕ ( v ) | ) ϕ ( u ) + ( q + r | ϕ ( u ) | ) ϕ ( v ) = 0 (1)for every r ∈ N . Consider the word w r = u u p + r | ϕ ( v ) | u w ′ v v q + r | ϕ ( u ) | v . Since u and v are read on cycles, we have w r ∈ R . Moreover, Eq. (1) tells usthat ϕ ( w r ) = 0. Finally, since drop( u ) = 0 and ϕ ( u ) >
0, for large enough r , wehave drop( w r ) = 0 and hence w r ∈ D . This is in contradiction to R ∩ D = ∅ . ⊓⊔ Deciding separability
The next step in our approach is to decide whether a givenVASS language L is contained in M k ∪ B ℓ ∪ ¯ B rev m for some k, ℓ, m ∈ N . Of coursethis is the case if and only if L ⊆ M k ∪ B k ∪ ¯ B rev k for some k ∈ N . Thus,Lemma 13 essentially tells us that whether L | D holds only depends on threenumbers associated to each word from L . Consider the function σ : Σ ∗ → N with σ ( w ) = ( µ ( w ) , ϕ ( w ) , µ ( ¯ w rev )). We call a subset S ⊆ N separable if thereis a k ∈ N so that for every ( x , x , x ) ∈ S , we have x ≤ k or x ≤ k or x k . Then, Lemma 13 can be formulated as: Lemma 14.
Let L ⊆ Σ ∗ . If L ∩ D = ∅ , then L | D if and only if σ ( L ) isseparable. his enables us to transform L into a bounded language ˆ L that behaves thesame in terms of separability from D . Letˆ L = { a m ¯ a m +11 a r ¯ a s a n +11 ¯ a n | ∃ w ∈ L : m ≤ µ ( w ) , n ≤ µ ( ¯ w rev ) , r − s = ϕ ( w ) } . Note that if v = a m ¯ a m +11 a r ¯ a s a n +11 ¯ a n , then we have µ ( v ) = m and µ (¯ v rev ) = n and ϕ ( v ) = r − s . Therefore, the set σ ( ˆ L ) is separable if and only if σ ( L ) isseparable. Hence, we have: Lemma 15.
For every L ⊆ Σ ∗ with L ∩ D = ∅ , we have L | D if and only if ˆ L | D . Using standard VASS constructions, we can turn L into ˆ L . Lemma 16.
Given a VASS language L ⊆ Σ ∗ , one can construct a VASS for ˆ L . Before proving Lemma 16 we show how to use it to finalise the argument.We need to decide whether ˆ L | D . Since ˆ L ⊆ B with B = a ∗ ¯ a ∗ a ∗ ¯ a ∗ a ∗ ¯ a ∗ , wehave ˆ L | D if and only if ˆ L | ( D ∩ B ). As subsets of B , both ˆ L and D ∩ B arebounded languages and we can decide whether ˆ L | ( D ∩ B ) using Corollary 3.To prove Lemma 16, it is convenient to have a notion of subsets of Σ ∗ × N m described by vector addition systems. First, a vector addition system (VAS) isa VASS that has only one state. Since it has only one state, it is not mentionedin the configurations or the transitions. We say that R ⊆ Σ ∗ × N m is a VASrelation if there is a d + m -dimensional VAS V and vectors s , t ∈ N d such that R = { ( w, u ) ∈ Σ ∗ × N m | ( s , w −→ ( t , u ) } . Here, s and t are called source and target vector , respectively.However, sometimes it is easier to describe a relation by a VASS than by aVAS. We say that R ⊆ Σ ∗ × N m is described by the d + m -dimensional VASS V = ( Q, T, s, t, h ) if R = { ( w, u ) ∈ Σ ∗ × N m | ( s, , w −→ ( t, , u ) } . Of course, arelation is a VAS relation if and only if it is described by some VASS and thesedescriptions are easily translated. Lemma 17. If R ⊆ Σ ∗ × N m and S ⊆ Σ ∗ × N n are VAS relations, then so isthe relation R ⊕ S := { ( w, u , v ) | ( w, u ) ∈ R ∧ ( w, v ) ∈ S } .Proof. We employ a simple product construction. Suppose V describes R and V describes S . Without loss of generality, let V and V be d + m -dimensionaland d + n -dimensional, respectively. The new VAS V is 2 d + m + n -dimensionaland has three types of transitions: First, for any letter a ∈ Σ , every transition( u , v ) ∈ Z d + m of V with label a and u ∈ Z d and v ∈ Z m , every transition( u , v ) ∈ Z d + n of V with label a and u ∈ Z d and v ∈ Z n , V has a transition( u , u , v , v ) ∈ Z d + m + n with label a .Second, for every transition ( u , v ) ∈ Z d + m from V labeled ε with u ∈ Z d and v ∈ Z m , V has an ε -labeled transition ( u , d , v , n ) ∈ Z d + m + n . Here, inslight abuse of notation, 0 k is meant to be a vector of zeros that occupies k oordinates. Third, for every transition ( u , v ) ∈ Z d + n labeled ε from V with u ∈ Z d and v ∈ Z m , V has an ε -labeled transition (0 d , u , m , v ). If s i and t i arestart and target vector of V i for i ∈ { , } , then s = ( s , s ) and t = ( t , t ) areused as start and target vectors for V . Then, it is routine to check that indeed { ( w, u , v ) | u ∈ Z m , v ∈ Z n , ( s , ) w −→ ( t , u , v ) } = R ⊕ S . ⊓⊔ Lemma 18.
Given a VAS language L ⊆ Σ ∗ and a VAS relation R ⊆ Σ ∗ × N m one can construct a VAS for the language { a x · · · a x m m | ∃ w ∈ L : R ( w, x , . . . , x m ) } .Proof. Suppose V is a d -dimensional VAS accepting L and V ′ is a d + m -dimensional VAS for R . We construct the 2 d + m -dimensional VAS V ′′ , which hasfour types of transitions. First, for every transition u ∈ Z d labeled a ∈ Σ and ev-ery a -labeled transition v ∈ Z d + m in V ′ , we have an ε labeled transition ( u , v ) in V ′′ . Second, for every ε -labeled transition u ∈ Z d in V , we have an ε -labeled tran-sition ( u , d + m ) ∈ Z d + m in V ′′ . Third, for every ε -labeled transition u ∈ Z d + m in V ′ , we have an ε -labeled transition (0 d , u ) ∈ Z d + m transition in V ′′ . Fourth,for every i ∈ [1 , m ], we have an a i -labeled transition (0 d , − e i ) ∈ Z d + m , where e i ∈ Z m is the m -dimensional unit vector with 1 in coordinate i and 0 every-where else. It is now easy construct a VASS V ′′′ with L ( V ′′′ ) = L ( V ′′ ) ∩ a ∗ · · · a ∗ n .Then clearly, we have L ( V ′′′ ) = { a x · · · a x m m | ∃ w ∈ L : R ( w, x , . . . , x m ) } . ⊓⊔ Proof (Proof of Lemma 16).
First, let us show that the following relations areVAS relations: R = { ( w, n ) ∈ Σ ∗ × N | n ≤ µ ( w ) } ,R = { ( w, r, s ) ∈ Σ ∗ × N | r − s = ϕ ( w ) } ,R = { ( w, n ) ∈ Σ ∗ × N | n ≤ µ ( ¯ w rev ) } . In Figs. 1a to 1c, we show vector addition systems with states for the relations p qa , a , − ε, a , a , R p qa , (1 , a , (0 , ε, ε, (1 , ε, ( − , − R p q ra , (0 , a , (0 , ε, (0 , ε, (1 , ε, (0 , a , (1 , a , ( − , R Fig. 1: VASS for relations R , R , and R in the proof of Lemma 16. R , R , and R (it is easy to translate them to VAS for the relations). From theVASS for R and R , one can readily build VAS for the relations R ′ = { ( w, m, m + 1) ∈ Σ ∗ × N | m ≤ µ ( w ) } ,R ′ = { ( w, n + 1 , n ) ∈ Σ ∗ × N | m ≤ µ ( ¯ w rev ) } . ccording to Lemma 17, we can construct a VAS for R = R ′ ⊕ R ⊕ R ′ ⊆ Σ ∗ × N . Applying Lemma 18 to L and R yields a VAS for the language { a m a m +12 a r a s a n +15 a n | ∃ w ∈ L : m ≤ µ ( w ) , r − s = ϕ ( w ) , n ≤ µ ( ¯ w rev ) } . Now appropriately renaming the symbols a , . . . , a to a or ¯ a yields a VAS forˆ L . ⊓⊔ Let us now show Theorem 8. In [9] it was shown that two coverability VASSlanguages K and L are regularly separable if and only if K ∩ L = ∅ (the resultin [9] applies to all languages of well-structured transition systems). However,when deciding K | L for a VASS language K and a coverability VASS language L , a simple disjointness check is not enough: If K = { a n b m | n < m } and L = { a n b m | n ≥ m } , then K is in V and L is in C and we have K ∩ L = ∅ , butnot K | L .Instead, we use our approach to reduce separability to the simultaneous un-boundedness problem [40,10]. A language L ⊆ a ∗ · · · a ∗ n is simultaneously un-bounded if for every k ∈ N , there is a word a x · · · a x n n ∈ L with x , . . . , x n ≥ k .The simultaneous unboundedness problem (SUP) asks, given a language L ⊆ a ∗ · · · a ∗ n , whether L is simultaneously unbounded. For VASS languages, thisproblem is decidable. This follows from computability of downward closures [16]or from general results on unboundedness problems for VASS [6]. Basic separators for coverability VASS
As before, we develop a notion of basicseparators. We start with a version of the sets B k , where we use C instead of D . We set B ′ k = { w ∈ Σ ∗ | w / ∈ C and µ ( w ) ≤ k } . Just like for B k , the set B ′ k is clearly disjoint from C . Moreover, we need variantsof these in higher dimension: For i ∈ [1 , n ] and k ∈ N , let B i,k = λ − i ( B ′ k ). Thismeans, B i,k is the set of walks through Z n which have a prefix p such that incoordinate i , the walk p goes below zero, but also never exceeds k before it doesso. The sets B i,k are clearly regular, because an automaton can maintain the ϕ -value in coordinate i of the read prefix in its state as long as it stays positive:During that time, the value belongs to [0 , k ]. Lemma 19.
Let R ⊆ Σ ∗ n be a regular language. Then R ∩ C n = ∅ if and only if R is included in a finite union of sets of the form B i,k for i ∈ [1 , n ] and k ∈ N . In order to show Lemma 19, we first prove a lemma, for which we need someterminology. Suppose R ⊆ Σ ∗ n and for every k ∈ N , we have R \ ( B ,k ∪ · · · ∪ B n,k ) = ∅ . We have to show that then R ∩ C n = ∅ .There is a sequence of words w , w , . . . ∈ R so that for each k ∈ N , we have w k / ∈ B ,k ∪· · ·∪ B n,k . For each i ∈ [1 , n ], the non-membership w k / ∈ B i,k is eitherecause (i) µ ( λ i ( w )) > k or (ii) λ i ( w k ) ∈ C . By selecting a subsequence, wemay assume that all words agree about which coordinates satisfy (i) and whichsatisfy (ii). Formally, we may assume that there is a subset I ⊆ [1 , n ] such thatfor each k ∈ N and i ∈ [1 , n ], we have µ ( λ i ( w k )) > k if i ∈ I and λ i ( w k ) ∈ C if i / ∈ I . In this situation, we call w , w , . . . an I -witness sequence . Lemma 20.
Suppose there is an I -witness sequence in R for I ⊆ [1 , n ] with I = ∅ . Then R has an I ′ -witness sequence for some strict subset I ′ ⊂ I .Proof. Suppose w , w , . . . is an I -witness sequence. Clearly, if I = ∅ , then w k ∈ C n for every k ∈ N and we are done. So, suppose I = ∅ . We shall prove thatthere is also an I ′ -witness sequence with | I ′ | < | I | .Since for every i ∈ I , we have µ ( λ i ( w k )) > k we know that w k decomposesas w k = u ( i ) k v ( i ) k so that λ i ( u ( i ) k ) ∈ C and ϕ ( u ( i ) k )( i ) > k . We pick i ∈ I sothat u ( i ) k has minimal length. We claim that then u ( i ) k ∈ C n . Indeed, we have λ j ( u ( i ) k ) ∈ C for every j ∈ [1 , n ]: For j ∈ I , this is because u ( i ) k is prefix of some u ( t ) k with λ j ( u ( t ) k ) ∈ C ; for j ∈ [1 , n ] \ I , this is because λ j ( w k ) ∈ C . This provesour claim and thus u ( i ) k ∈ C n . We define u k = u ( i ) k , v k = v ( i ) k , and m k := i . Byselecting a subsequence of w , w , . . . , we may assume that m = m = · · · andwe define m := m = m = · · · .Consider a finite automaton for R . Since each w k = u k v k belongs to R ,there is a state q k so that a run for w k enters q k after reading u k . Moreover,let u k = ϕ ( u k ). Since we have u k ∈ C n , we know that u k ∈ N n . By selecting asubsequence of w , w , . . . , we may assume that q = q = · · · and u ≤ u ≤ · · · and we define q := q = q = · · · .We now know that w , w , . . . is an I -witness sequence and m ∈ I and w k = u k v k with u k ∈ C n and ϕ ( u k )( m ) > k . Our goal is to construct an I \ { m } -witness sequence. We do this as follows. For each k ∈ N , we choose some ℓ with ℓ ≥ drop( λ m ( v k )) and ℓ ≥ k . We set w ′ k = u ℓ v k and claim that w ′ , w ′ , . . . is an I \ { m } -witness sequence. First, note that w ′ k ∈ R for every k ∈ N . Furthermore,since u ℓ is at least ℓ ≥ drop( λ m ( v k )) in component m , we have drop( λ m ( u ℓ v k )) =0 and hence λ m ( u ℓ v k ) ∈ C . Moreover, since u ℓ ≥ u k , we have µ ( λ i ( u ℓ v k )) > k for every i ∈ I . Finally, for i / ∈ I , we still have λ i ( w ′ k ) ∈ C because u ℓ ≥ u k .Thus, w ′ , w ′ , . . . is an I ′ -witness sequence for I ′ = I \ { m } . ⊓⊔ We are now prepared to prove Lemma 19. Suppose R ⊆ Σ ∗ n and for every k ∈ N , we have R \ ( B ,k ∪ · · · ∪ B n,k ) = ∅ . As argued above, this means there isan I -witness sequence in R . Applying Lemma 20 repeatedly yields an ∅ -witnesssequence in R . However, every word in an ∅ -witness sequence is already a memberof C n . Hence, R ∩ C n = ∅ .Lemma 19 tells us that to decide whether L | C n for a given language L , wehave to check whether L is included in B ,k ∪ · · · ∪ B n,k for some k ∈ N . Likein Theorem 7, we turn L into a different language. Using standard methods, wecan show the following: emma 21. Given a VASS language L ⊆ Σ ∗ n , one can construct a VASS forthe language ˆ L = { a x · · · a x n n | ∃ w ∈ L : µ ( λ i ( w )) ≥ x i for i ∈ [1 , n ] } . Proof.
In the proof of Lemma 16, we construct a VAS for the relation R = { ( w, k ) ∈ Σ ∗ × N | k ≤ µ ( w ) } (see Fig. 1a). From this, it is easy to obtain a VAS for S i = { ( w, k ) ∈ Σ ∗ n × N | k ≤ µ ( λ i ( w )) } for each i ∈ [1 , n ]. Indeed, given the VAS for R , one just replaces a and ¯ a with a i and ¯ a i , respectively, and then adds a loops labeled a j , a j , j ∈ [1 , n ], j = i . Now, using Lemma 17, we build a VAS for therelation S = { ( w, x , . . . , x m ) ∈ Σ ∗ n × N m | x i ≤ µ ( λ i ( w )) for each i ∈ [1 , m ] } . Finally, using Lemma 18 we can construct a VAS for the language ˆ L = { a x · · · a x n n | x i ≤ µ ( λ i ( w )) for each i ∈ [1 , n ] } . ⊓⊔ Note that w ∈ B i,k if and only if λ i ( w ) / ∈ C and µ ( λ i ( w )) ≤ k . There-fore, Lemma 19 implies that L | C n if and only if L ∩ C n = ∅ and ˆ L is notsimultaneously unbounded. Remark 22.
In our decidability proof, we use a polynomial-time Turing reductionfrom regular separability of a VASS language and a coverability VASS languageto the SUP for VASS languages. There is also such a reduction in the conversedirection. This is because given a VASS language L ⊆ a ∗ · · · a ∗ n , it is easy toconstruct in polynomial time a VASS for˜ L = { a x ¯ a x +11 · · · a x n n ¯ a x n +1 n | a x · · · a x n n ∈ L } . By Lemma 19, L is simultaneously unbounded if and only if ˜ L | C n . Thus,the problems (i) regular separability of VASS languages and coverability VASSlanguages and (ii) the SUP for VASS languages are polynomially inter-reducible. In this section, we apply our approach to solving regular separability between aVASS language and a Z -VASS language. Here, the collection of basic separatorsserves as a geometric characterization of separability. Proving that it is a set ofbasic separators is more involved than in Sections 4 and 5. − k · · · q − q a ¯ a a ¯ a a ¯ a a Fig. 2: An automaton for I k ⊆ Σ ∗ q q · · · q k q ∞ q − · · · q − k a ¯ a a ¯ a a ¯ a a a ¯ a ¯ a a ¯ a a ¯ a a Fig. 3: Automaton A k with L ( A k ) ∩ I k = D ,k . Lemma 12 tells us that regular separability between a VASS language and a Z -VASS language amounts to checking whether a given VASS language L ⊆ Σ ∗ n is included in some regular language R ⊆ Σ ∗ n with R ∩ Z n = ∅ . Therefore, in thissection, we classify the regular languages R ⊆ Σ ∗ n with R ∩ Z n = ∅ .A very simple type of such languages is given by modulo counting. For u , v ∈ Z n , we write u ≡ v mod k if u and v are component-wise congruent modulo k .The language M k = { w ∈ Σ ∗ n | ϕ ( w ) mod k } is clearly regular and disjoint from Z n .Since Z n is commutative (i.e. Π ( Z n ) = Z n ), one might expect that it suf-fices to consider commutative separators. This is not the case: The language L = ( a ¯ a ) ∗ a +1 is regularly separable from Z , but every commutative regularlanguage including L intersects Z . Therefore, our second type of regular lan-guages disjoint from Z n is non-commutative and we start to describe it in thecase n = 1. Consider the language D ,k = { w ∈ Σ ∗ | ϕ ( w ) = 0 and for every infix v of w : ϕ ( v ) ≥ − k } . The set D ,k is clearly disjoint from Z . To see that D ,k is regular, let us firstobserve that the language I k = { w ∈ Σ ∗ | for every infix v of w : ϕ ( v ) ≥ − k } isregular, because the automaton in Fig. 2 accepts I k : After reading a word w ,the automaton’s state reflects the difference M − ϕ ( w ), where M is the maximalvalue ϕ ( v ) for prefixes v of w . Second, the automaton A k in Fig. 3 satisfies L ( A k ) ∩ I k = D ,k : As long as the seen prefix w satisfies ϕ ( w ) ∈ [ − k, k ], thestate of A k reflects ϕ ( w ) exactly. However, as soon as A k encounters a prefix w with ϕ ( w ) > k , it enters q ∞ . From there, it accepts every suffix, because annput from I k can never reach 0 under ϕ with such a prefix w . Thus, D ,k isregular.The language D ,k has analogs in higher dimension. Instead of making surethe value of ϕ never drops more than k along one particular axis, one can imposethis condition in an arbitrary direction u ∈ Z n . For u , v ∈ Q n , u = ( u , . . . , u n ), v = ( v , . . . , v n ), we define h u , v i = u v + · · · + u n v n . For every vector u ∈ Z n and k ∈ N \ { } , let D u ,k = { w ∈ Σ ∗ n | h ϕ ( w ) , u i 6 = 0 and for every infix v of w : h ϕ ( v ) , u i ≥ − k } . We think of the walks in D u ,k as “drifting in direction u ”, hence the name.To see that D u ,k is regular, consider the morphism h u : Σ ∗ n → { a , ¯ a } ∗ with x a h ϕ ( x ) , u i for x ∈ Σ ∗ n . Here, we mean a ℓ = ¯ a | ℓ | and ¯ a ℓ = a | ℓ | in case ℓ ∈ Z , ℓ <
0. Then we have h ϕ ( w ) , u i = ϕ ( h u ( w )) for any w ∈ Σ ∗ n and hence D u ,k = h − u ( D ,k ). Therefore, D u ,k inherits regularity from D ,k .The main result of this section is that the sets M k and D u ,k suffice to explaindisjointness of regular languages from Z n in the following sense. Theorem 23.
Let R ⊆ Σ ∗ n be a regular language. Then R ∩ Z n = ∅ if and onlyif R is included in a finite union of languages of the form M k and D u ,k for k ∈ N and u ∈ Z n . We therefore say that L ⊆ Σ ∗ n is geometrically separable if L is contained ina finite union of languages of the form M k and D u ,k . Then, we can formulateTheorem 23 as a geometric characterization of separability from Z n . Corollary 24.
For L ⊆ Σ ∗ n , we have L | Z n if and only if L is geometricallyseparable. The rest of Section 6.1 is devoted to proving Theorem 23.
Overview of the proof
The “if” direction of Theorem 23 is clear. We show the“only if” direction for L ⊆ Σ ∗ n in several steps. We first associate to each finiteautomaton over Σ n a (rational) cone in Q n , which must either encompass all of Q n or be included in a halfspace (Lemma 25).The next step is to decompose the automaton for L into automata whosestrongly connected components form a path. We then prove Theorem 23 in thecase that such an automaton has the cone Q n (Lemma 27). In the case thatthe cone of an automaton A is included in some halfspace, we show that L ( A )further decomposes into a part inside some D u ,k and a part that stays close tosome strict linear subspace U ⊆ Q n (Lemma 28).It thus remains to treat regular languages L ⊆ Σ ∗ n whose walks remain closeto U . To this end, we transform L ( A ) into a language in Σ ∗ m where m = dim U For every A , either cone( A ) = Q n or cone( A ) is included in somehalf-space. Let us recall the Farkas’ lemma from linear programming [38, Corollary7.1d]. Intuitively it states that if a system A x = b of linear inequalities has nosolution over Q + , then this is certified by a half-space that contains A x for every x over Q + , but does not contain b . Lemma 26 (Farkas’ Lemma). For every A ∈ Q n × m and b ∈ Q n , exactly oneof the following holds:1. There exists an x ∈ Q n , x ≥ , with A x = b .2. There exists a y ∈ Q n with y ⊤ A ≥ and h y , b i < .Proof (of Lemma 25). Let u , . . . , u k ∈ Z n be the effects of all simple cyclesof A and let C ∈ Z n × k be the matrix with columns u , . . . , u k . Then cone( A )consists of those vectors of the form C x with x ∈ Q n + .If cone( A ) = Q n , then there is a vector v ∈ Q n with v / ∈ cone( A ). This meansthe system of inequalities C x = v , x ≥ 0, does not have a solution. By Farkas’lemma, there exists a vector y ∈ Q n with y ⊤ C ≥ h y , v i < 0. Hence, forevery element C x , x ∈ Q n + , of cone( A ), we have h y , C x i = y ⊤ C x ≥ 0. Since y ∈ Q n , there is a k ∈ N so that u = k y ∈ Z n . Then we have cone( A ) ⊆ { x ∈ Q n | h x , u i ≥ } . ⊓⊔ Linear automata For an automaton A , consider the directed acyclic graph (dag)consisting of strongly connected components of A . If this dag is a path, then A is called linear . Given an automaton A , we can construct linear automata A , . . . , A ℓ with L ( A ) = L ( A ) ∪ · · · ∪ L ( A ℓ ). Lemma 27. Let A be a linear automaton with cone( A ) = Q n . If L ( A ) ∩ Z n = ∅ ,then L ( A ) ⊆ M k for some k . The formulation of Corollary 7.1d in [38] does not specify whether it is over therationals or the reals. However, on p. 85, the author mentions that all results inchapter 7 hold for the reals as well as the rationals. roof. Since cone( A ) = Q n , we know that in particular the vectors e , − e , . . . , e n , − e n belong to cone( A ). This means there are cycles labeled w , . . . , w p such thatboth e i and − e i are linear combinations of ϕ ( w ) , . . . , ϕ ( w p ) with coefficientsin Q + , for every i ∈ [1 , n ]. Therefore, there is a k ∈ N such that k · e i and − k · e i are linear combinations of ϕ ( w ) , . . . , ϕ ( w p ) with coefficients in N , forevery i ∈ [1 , n ]. We claim that L ( A ) ⊆ M k . Towards a contradiction, suppose w ∈ L ( A ) with ϕ ( w ) ≡ mod k . Since A is linear, we can take the run for w andinsert cycles so that the resulting run visits every state in A . Instead of insertingevery cycle once, we insert it k times, so that the resulting run (i) visits everystate in A and (ii) reads a word w ′ ∈ Σ ∗ n with ϕ ( w ′ ) ≡ ϕ ( w ) mod k . Now since ϕ ( w ′ ) ≡ ϕ ( w ) ≡ mod k , we can write − ϕ ( w ′ ) = x ϕ ( w ) + · · · + x p ϕ ( w p ) withcoefficients x , . . . , x p ∈ N . Since in the run for w ′ , every state of A is visited, wecan insert cycles corresponding to the w , . . . , w p : For each i ∈ [1 , p ], insert thecycle for w i exactly x i times. Let w ′′ be the word read by the resulting run andnote that w ′′ ∈ L ( A ). Then we have ϕ ( w ′′ ) = ϕ ( w ′ )+ x ϕ ( w )+ · · · + x p ϕ ( w p ) = and thus w ′′ ∈ Z n , contradicting L ( A ) ∩ Z n = ∅ . Walks that stay close to a subspace Suppose we are given a vector space U ⊆ Q n (represented by a basis) with m = dim U < n and a bound ℓ ≥ 0. Let k u k = p h u , u i . For U ⊆ Q n and v ∈ Q n , we set d ( v , U ) = inf {k v − x k | x ∈ U } . Thenwe define the set S U,ℓ = { w ∈ Σ ∗ n | for every prefix v of w : d ( ϕ ( v ) , U ) ≤ ℓ } . Hence, S U,ℓ collects those walks whose prefixes stay close to the subspace U . Lemma 28. Let A be an automaton such that cone( A ) is contained in somehalf-space. One can compute k, ℓ ∈ N , u ∈ Z n , and a strict subspace U ⊆ Q n with L ( A ) ⊆ D u ,k ∪ S U,ℓ . u S U,ℓ ℓ cone( A ) Fig. 4: Two runs (red and green) inside D u ,k ∪ S U,ℓ . roof. Suppose cone( A ) ⊆ H , where H = { v ∈ Q n | h v , u i ≥ } for some vector u ∈ Q n \ { } . Without loss of generality, we may assume u ∈ Z n \ { } . Let U = { v ∈ Q n | h v , u i = 0 } . Then clearly dim U = n − 1. Observe that sincecone( A ) ⊆ H , we have h v , u i ≥ v ∈ Z n of A . Let k bethe number of states in A . Now, whenever w ∈ L ( A ) and v is an infix of w , then h ϕ ( v ) , u i ≥ − k : If h ϕ ( v ) , u i < − k , then the path reading v must contain a cyclereading v ′ ∈ Σ ∗ n with h ϕ ( v ′ ) , u i < 0, which contradicts cone( A ) ⊆ H .We claim that L ( A ) ⊆ D u ,k ∪ S U,k . Let w ∈ L ( A ). We distinguish two cases. Case 1: Suppose w has a prefix v with h ϕ ( v ) , u i > k . Write w = vv ′ . As arguedabove, we have h ϕ ( v ′ ) , u i ≥ − k . Hence, h ϕ ( w ) , u i = h ϕ ( v ) , u i + h ϕ ( v ′ ) , u i > w ∈ D u ,k . Case 2: Suppose for every prefix v of w , we have h ϕ ( v ) , u i ≤ k . Then, for every prefix v of w , we have − k ≤ h ϕ ( v ) , u i ≤ k andthus d ( ϕ ( v ) , U ) = |h ϕ ( v ) , u i| / k u k ≤ k (see Lemma 29). Thus, w ∈ S U,k . Lemma 29. Let u ∈ Q n and U = { v ∈ Q n | h v , u i = 0 } . Then d ( v , U ) = |h v , u i|k u k for v ∈ Q n .Proof. We extend u to an orthogonal basis b , . . . , b n of Q n , meaning h b i , b j i =0 if i = j and b = u . Because of orthogonality, we may express k v k for anyvector v ∈ Q n with v = v b + · · · + v n b n as p h v , v i = p h v b + · · · + v n b n , v b + · · · + v n b n i = vuut n X i =1 v i h b i , b i i = vuut n X i =1 v i k b i k . Let x ∈ Q n be a vector with x = x b + · · · + x n b n . Since b = u and thus h x , u i = x , the vector x belongs to U if and only if x = 0. Therefore, for v ∈ Q n with v = v b + · · · + v n b n and x ∈ U , we have k v − x k = vuut v k u k + n X i =2 ( v i − x i ) k b i k . This distance is minimal with x i = v i for i ∈ [2 , n ] and in that case, the distanceis d ( v , U ) = p v k u k = | v | · k u k . Since h v , u i = v k u k , that implies d ( v , U ) = |h v , u i| / k u k . ⊓⊔ Mapping to lower dimension Lemma 28 tells us that if cone( A ) is included insome halfspace, then L ( A ) can be split into (i) a part L ∩ D u ,k that is already ge-ometrically separable and (ii) a part L ∩ S U,ℓ that stays close to a strict subspace U ⊆ Q n . Therefore, to complete the proof that regular languages disjoint from Z n are geometrically separable, it remains to treat subsets of S U,ℓ . We will nowshow that they can be transformed into a language in Σ ∗ m , where m = dim U < n .This transformation will not affect regularity, geometric separability or disjoint-ness from Z n (resp. Z m ) and thus allow us to apply induction.his transformation will be performed by a transducer. The transducer willconsist of three steps, coordinate transformation ( f ), intersection ( R V,p ), and projection ( π m ). In the coordinate transformation, we translate L from walksthat stay close to U into walks that stay close to V = { ( v , . . . , v n ) ∈ Q n | v m +1 = · · · = v n = 0 } . The intersection will then select only those walks thatnot only stay close to V , but even arrive in V . Finally, we project away thecoordinates m + 1 , . . . , n and thus have walks in Z m .We now describe each of the three steps. For the coordinate transformation,we apply a linear map A to the walk in L that maps U to V . Let us define thismap as a matrix A ∈ Z n × n . We choose an orthogonal basis b , . . . , b n ∈ Z n of Q n such that b , . . . , b m is a basis for U . This can be done, e.g. using Gram-Schmidt orthogonalisation [24]. If B ∈ Z n × n is the matrix whose columns are b , . . . , b n , then B is invertible and maps V to U . Thus the inverse B − ∈ Q n maps U to V . We can clearly choose an α ∈ Z such that αB − ∈ Z n × n and weset A = αB − . For each i ∈ [1 , n ], choose a word w i ∈ Σ ∗ n with ϕ ( w i ) = Aϕ ( a i )and let f : Σ ∗ n → Σ ∗ n be the morphism with f ( a i ) = w i and f (¯ a i ) = ¯ w i . Now f indeed transforms walks close to U into walks close to V : Lemma 30. We can compute p ∈ N with f ( S U,ℓ ) ⊆ S V,p .Proof. Choose k ∈ N so that k ≥ | f ( a i ) | and k ≥ | f (¯ a i ) | for i ∈ [1 , n ] and let p = k A k · ℓ + k . We claim that f ( S U,ℓ ) ⊆ S V,p . Let w ∈ S U,ℓ .Consider a prefix v of f ( w ). Let us first consider the case that v = f ( u ) forsome prefix u of w . Since w ∈ S U,ℓ , we have d ( ϕ ( u ) , U ) ≤ ℓ . Therefore, d ( ϕ ( f ( u )) , V ) = d ( Aϕ ( u ) , AU )= inf {k Aϕ ( u ) − A u k | u ∈ U }≤ k A k · inf {k ϕ ( u ) − u k | u ∈ U } = k A k · d ( ϕ ( u ) , U ) = k A k · ℓ. Now if v is any prefix of f ( w ), then v = f ( u ) v ′ , where u is a prefix of w and | v ′ | ≤ k . This implies that d ( ϕ ( v ) , V ) ≤ d ( ϕ ( u ) , V ) + k ≤ k A k · ℓ + k = p . ⊓⊔ Moreover, applying f does not introduce geometric separability and preservesdisjointness with Z n . Lemma 31. If f ( L ) is geometrically separable for L ⊆ Σ ∗ n , then so is L . Wehave L ∩ Z n = ∅ if and only if f ( L ) ∩ Z n = ∅ .Proof. For the first statement, we prove that f − ( M k ) ⊆ M k and f − ( D u ,k ) ⊆ D A ⊤ u ,k , which clearly suffices. Note that if w ∈ Σ ∗ n satisfies ϕ ( w ) ≡ mod k ,then also ϕ ( f ( w )) = Aϕ ( w ) ≡ mod k . This implies f − ( M k ) ⊆ M k . For thesecond inclusion, suppose w ∈ Σ ∗ n satisfies f ( w ) ∈ D u ,k and let v be a prefix ofof w . Then f ( v ) is a prefix of f ( w ) and thus h ϕ ( v ) , A ⊤ u i = ϕ ( v ) ⊤ A ⊤ u = ( Aϕ ( v )) ⊤ u = h Aϕ ( v ) , u i = h ϕ ( f ( v )) , u i . n particular, we have h ϕ ( v ) , A ⊤ u i = h ϕ ( f ( v )) , u i ≥ − k and h ϕ ( w ) , A ⊤ u i = h ϕ ( f ( w )) , u i > 0, which implies w ∈ D A ⊤ u ,k .For the second statement, note that A is invertible, meaning ϕ ( f ( w )) = Aϕ ( w ) vanishes if and only if ϕ ( w ) vanishes. ⊓⊔ For the second step of our transformation (intersection), we observe the fol-lowing. Since the walks in S V,p stay close to V , there is a finite set F ⊆ Z n − m of possible difference vectors between a point ϕ ( v ) reached by a prefix v of aword in S V,p and the point closest to ϕ ( v ) in V . Therefore, the set R V,p ofwalks in S V,p that also arrive in V is regular: One can maintain the currentdistance vector in the state. To make this formal, let ¯ π j : Q n → Q j denote theprojection on the last j coordinates, ¯ π j ( v , . . . , v n ) = ( v n − j +1 , . . . , v n ). Thenwe have d ( v , V ) = k ¯ π n − m ( v ) k for every v ∈ Q n . If v is a prefix of w ∈ S V,p ,then d ( ϕ ( v ) , V ) ≤ p implies k ¯ π n − m ( ϕ ( v )) k ≤ p and hence there is a finite set F ⊆ Z n − m such that ¯ π n − m ( ϕ ( v )) ∈ F for every prefix v of some w ∈ S V,p .Thus, the set R V,p = { w ∈ S V,p | ϕ ( w ) ∈ V } is regular. The second step of ourtransformation is to intersect with R V,p . Lemma 32. Let L ⊆ S V,p . If L ∩ R V,p is geometrically separable, then so is L .We have L ∩ Z n = ∅ if and only if ( L ∩ R V,p ) ∩ Z n = ∅ .Proof. Suppose L ∩ R V,p is geometrically separable. Let ˆ R V,p = { w ∈ S V,p | ϕ ( w ) / ∈ V } . Then S V,p = ˆ R V,p ∪ R V,p . It suffices to show that ˆ R V,p ⊆ M k forsome k ∈ N , because then L = ( L ∩ ˆ R V,p ) ∪ ( L ∩ R V,p ) ⊆ M k ∪ ( L ∩ R V,p ) (2)and L ∩ R V,p being geometrically separable implies that L is geometrically sep-arable as well.To show that ˆ R V,p ⊆ M k , let F ⊆ Z n − m be a finite set such that ¯ π n − m ( ϕ ( v )) ∈ F for every prefix v of a word w ∈ S V,p . Moreover, choose k ∈ N so that k > k v k for every v ∈ F . We claim that then ˆ R V,p ⊆ M k . To this end, suppose w ∈ ˆ R V,p .Then d ( ϕ ( w ) , V ) = 0 and hence ¯ π n − m ( ϕ ( w )) ∈ F \ { } . In particular, we have ϕ ( w ) mod k and thus w ∈ M k . This proves ˆ R V,p ⊆ M k .For the second statement, note that L ∩ Z n = ∅ clearly implies ( L ∩ R V,p ) ∩ Z n = ∅ . Conversely, if ( L ∩ R V,p ) ∩ Z n = ∅ , then Eq. (2) entails L ∩ Z n ⊆ ( L ∩ R V,p ) ∩ Z n = ∅ because M k ∩ Z n = ∅ . ⊓⊔ In our third step, we project onto the first m coordinates: We define π m : Σ ∗ n → Σ ∗ m as the morphism with π m ( a i ) = a i , π m (¯ a i ) = ¯ a i for i ∈ [1 , m ], and π m ( a i ) = π m (¯ a i ) = ε for i ∈ [ m + 1 , n ]. In other words, π m deletes the let-ters a i and ¯ a i for i ∈ [ m + 1 , n ] } . Lemma 33. Let L ⊆ R V,p . If π m ( L ) is geometrically separable, then so is L .Moreover, L ∩ Z n = ∅ if and only if π m ( L ) ∩ Z n = ∅ .Proof. It suffices to show that for w ∈ R V,p , two implications hold: (i) if π m ( w ) ∈ M k for some k ∈ N , then w ∈ M k and (ii) if π m ( w ) ∈ D u ,k for some u ∈ Z m and k ∈ N , then w ∈ D u ′ ,k for some u ′ ∈ Z n .uppose w ∈ R V,p and π m ( w ) ∈ M k . Since w ∈ R V,p , the last n − m components of ϕ ( w ) are zero. Thus, we have ϕ ( w ) ≡ mod k if and only if ϕ ( π m ( w )) ≡ mod k . This implies w ∈ M k .Now suppose w ∈ R V,p with π m ( w ) ∈ D u ,k for some u ∈ Z m and k ∈ N . Let u = ( u , . . . , u m ) and define u ′ = ( u , . . . , u m , , . . . , ∈ Z n . Then clearly h ϕ ( v ) , u ′ i = h ϕ ( π m ( v )) , u i for every word v ∈ Σ ∗ n . In particular, we have w ∈ D u ′ ,k . ⊓⊔ We are now prepared to define our transformation: Let T U,ℓ ⊆ Σ ∗ n × Σ ∗ m bethe transduction with T U,ℓ L = π m ( f ( L ) ∩ R V,p ). Then Lemmas 31 to 33 imply: Proposition 34. Let L ⊆ S U,ℓ . If T U,ℓ L ⊆ Σ ∗ m is geometrically separable, thenso is L . Also, L ∩ Z n = ∅ if and only if ( T U,ℓ L ) ∩ Z m = ∅ . Thus, L | Z n if andonly if ( T U,ℓ L ) | Z m .Proof. With Lemma 30, the first two statements of Proposition 34 follow directlyfrom Lemmas 31 to 33. Let us prove the conclusion in the second statement.If L | Z n with a regular R with L ⊆ R and R ∩ Z n = ∅ , then by Proposition 34,we have T U,ℓ R ∩ Z m = ∅ . Hence, T U,ℓ R separates T U,ℓ L and Z m . Conversely, if T U,ℓ L | Z m , then by Corollary 24, the language T U,ℓ L is geometrically separable.According to Proposition 34, that implies that L is geometrically separable andin particular L | Z n . ⊓⊔ Let us now prove Theorem 23. Suppose R ⊆ Σ ∗ n and R ∩ Z n = ∅ . We showby induction on the dimension n that then, R is included in a finite union ofsets of the form M k and D u ,k . Let R = L ( A ) for an automaton A . Since A canbe decomposed into a finite union of linear automata, it suffices to prove theclaim in the case that A is linear. If cone( A ) = Q n , then Lemma 27 tells usthat L ( A ) ⊆ M k for some k ∈ N . If cone( A ) is contained in some half-space,then according to Lemma 28, we have R ⊆ D u ,k ∪ S U,ℓ for some u ∈ Q n \ { } , k, ℓ ∈ N , and strict subspace U ⊆ Q n . This implies that the regular language R \ D u ,k is included in S U,ℓ . We may therefore apply Proposition 34, whichyields T U,ℓ ( R \ D u ,k ) ∩ Z m = ∅ . Since T U,ℓ ( R ∩ S U,ℓ ) ⊆ Σ ∗ m with m = dim U < n ,induction tells us that T U,ℓ ( R \ D u ,k ) is geometrically separable and hence, byProposition 34, R \ D u ,k is geometrically separable. Since R ⊆ D u ,k ∪ ( R \ D u ,k ), R is geometrically separable. In this section, we apply Corollary 24 to prove Theorem 9.Before we prove Theorem 9 let us explain why a particular straightforwardapproach does not work. Corollary 24 tells us that in order to decide whether L | Z n for L ⊆ Σ ∗ n , it suffices to check whether there are k ∈ N , ℓ , . . . , ℓ m ∈ N ,and vectors u , . . . , u m ∈ Z n such that L ⊆ M k ∪ D u ,ℓ ∪ · · · ∪ D u m ,ℓ m . Itis tempting to conjecture that there is a finite collection of direction vectors ⊆ Z n (such as a basis together with negations) so that for a given language L ,such an inclusion holds only if it holds with some u , . . . , u m ∈ F . In that casewe would only need to consider scalar products of words in L with vectors in F and thus reformulate the problem over sections of reachability sets of VASS.However, this is not the case. For u , v ∈ Q n , we write u ∼ v if Q + u = Q + v .Since ∼ has infinitely many equivalence classes and every class intersects Z n ,the following shows that there is no fixed set of directions. Proposition 35. For each u ∈ Z n , there is a k ∈ N such that for k ≥ k , thefollowing holds. For every ℓ, ℓ . . . , ℓ m ≥ , u , . . . , u m ∈ Z n with u i u for i ∈ [1 , n ] , we have D u ,k M ℓ ∪ D u ,ℓ ∪ · · · D u m ,ℓ m .Proof. The idea of the proof is as follows. We construct a word w correspondingto a walk in Z n , which traverses long distances in many directions orthogonalto u . That way, w cannot belong to any of the languages D u i ,ℓ i for i ∈ [1 , m ].Moreover, we carefully design the construction such that w M ℓ . Furthermore,the walk never moves far in the direction of − u because that would imply w D u ,k .We begin by choosing k ∈ N . We extend the vector u to an orthogonal basis b , . . . , b n ∈ Z n of Q n , meaning that b = u and h b i , b j i = 0 if i = j . Note thatsince b i = 0, we then have h b i , b i i = k b i k = 0. In particular, this means forevery v ∈ P = { b , b , − b , . . . , b n , − b n } , we have h v , u i ≥ 0. Note that exceptfor b , the set P contains every vector b i positively and negatively.For each i ∈ [1 , n − v i ∈ Σ ∗ n so that { ϕ ( v ) , . . . , ϕ ( v n − ) } = P . Note that then, we have h ϕ ( v i ) , u i ≥ i ∈ [1 , n − k ∈ N so that k ≥ | v i | for each i ∈ [1 , n − D u ,k M ℓ ∪ D u ,ℓ ∪· · ·∪ D u m ,ℓ m , suppose k ≥ k . We shall constructa word w ∈ D u ,k so that w / ∈ M ℓ and w / ∈ D u i ,ℓ i for every i ∈ [1 , m ]. Pick s ∈ N with s > ℓ i for i ∈ [1 , m ]. Write u = ( x , . . . , x n ) and let u = a x · · · a x n n . Here,in slight abuse of notation, if x i < 0, we mean ¯ a | x i | i instead of a x i i . Then clearly,we have ϕ ( u ) = u and every infix z of u satisfies h ϕ ( z ) , u i > 0. Let w = u ℓ v ℓ · s v ℓ · s · · · v ℓ · s n − . Let us first show that w ∈ D u ,k . Since h ϕ ( v i ) , u i = h b i , u i = 0, we have h ϕ ( w ) , u i = ℓ · h ϕ ( u ) , u i = ℓ · k u k > 0. Let z be an infix of w . Since h ϕ ( y ) , u i > y of u and also h ϕ ( v i ) , u i = 0 for i ∈ [1 , n − h ϕ ( z ) , u i ≥ − k ≥ − k . Thus, we have w ∈ D u ,k .Finally, we prove that w / ∈ M ℓ and w / ∈ D u i ,ℓ i for i ∈ [1 , m ]. First, note that ϕ ( w ) ≡ mod ℓ , so that w / ∈ M ℓ . Let us now show that for i ∈ [1 , m ], we have w / ∈ D u i ,ℓ i . Since b , . . . , b n is a basis of Q n , we can write u i = α b + · · · + α n b n for some α , . . . , α n ∈ Q . Since the basis b , . . . , b n is an orthogonal basis, weave h u i , b j i = h α b + · · · + α n b n , b j i = α h b , b j i + · · · + α n h b n , b j i = α j h b j , b j i = α j · k b j k and thus h u i , b j i > α j > α < α j = 0 for some j ∈ [2 , n ]: Otherwise,we would have u i = α b = α u and thus Q + u i = Q + u . Therefore, there is avector p ∈ P with h u i , p i < 0. Let p = ϕ ( v p ) with p ∈ [1 , n − v ℓ · sp of w satisfies h ϕ ( v ℓ · sp ) , u i i < − ℓs < − ℓ i and hence w / ∈ D u i ,ℓ i . ⊓⊔ Outline of the algorithm We now turn to the proof of Theorem 9. Accordingto Corollary 24, we have to decide whether a given VASS language L ⊆ Σ ∗ n satisfies L ⊆ M k ∪ D u ,ℓ ∪ · · · ∪ D u m ,ℓ m for some k ∈ N , u , . . . , u m ∈ Z n and ℓ , . . . , ℓ m ∈ N . Our algorithm employs the KLMST decomposition (so namedby Leroux and Schmitz [29] after its inventors) used by Sacerdote and Ten-ney [37], Mayr [30], Kosaraju [22], and Lambert [23] and recently cast in termsof ideal decompositions by Leroux and Schmitz [29]. The decomposition yieldsVASS languages L , . . . , L p with L = L ∪ · · · ∪ L p , together with finite au-tomata A , . . . , A p whose languages overapproximate L , . . . , L p , respectively.We show that the A i are not only overapproximations, but are what we call“modular envelopes” (Theorem 36). This allows us to proceed similarly to theproof of Theorem 23. It suffices to check regular separability for each L i . Ifcone( A i ) = Q n , then it suffices to check whether Π ( L i ) | Z n using Theorem 2(see Lemma 37). If cone( A i ) is contained in some halfspace, then we transform L i into a VASS language ˆ L i ⊆ Σ ∗ m . Here, ˆ L i essentially captures the walks of L i that stay close to a strict linear subspace U ⊆ Q n with m = dim U < n . Since m < n , we can then apply our algorithm recursively to ˆ L i .We first explain the concept of modular envelopes. We then describe thealgorithm for regular separability and finally, we show how to construct modularenvelopes. Modular envelopes For a finite automaton A with input alphabet Σ , let Loop( A ) ⊆ Σ ∗ be the set of words that can be read on a cycle in A . Recall that Ψ ( w ) denotesthe Parikh image of w . We say that an automaton A is a modular envelope for alanguage L ⊆ Σ ∗ if (i) L ⊆ L ( A ) and (ii) for every selection u , . . . , u m ∈ Σ ∗ ofwords from Loop( A ) and every w ∈ L and every k ∈ N , there is a word w ′ ∈ L so that each u j is an infix of w ′ and Ψ ( w ′ ) ≡ Ψ ( w ) mod k , where the congruenceis defined component-wise.In other words, A describes a regular overapproximation that is small enoughthat we can find every selection of A ’s loops as infixes in a word from L whoseParikh image is congruent modulo k to a given word from L . Using the KLMSTdecomposition, we prove: heorem 36. Given a VASS language L , one can construct VASS languages L , . . . , L p , together with a modular envelope A i for each L i such that L = L ∪ · · · ∪ L p . We postpone the proof of Theorem 36 until Section 6.3 and first show howit is used to decide geometric separability. Modular envelopes with cone Q n By Lemma 25 we know that every cone eitherequals Q n or is included in some half-space. The following lemma will be usefulin the first case. Lemma 37. Let L ⊆ Σ ∗ n be a language with a modular envelope A . If cone( A ) = Q n then the following are equivalent: (i) L | Z n , (ii) L ⊆ M k for some k ∈ N ,(iii) Π ( L ) | Z n .Proof. Note that (ii) implies (iii) immediately and that (iii) implies (i) because L ⊆ Π ( L ). Thus, we only need to show that (i) implies (ii). By Corollary 24 if L | Z n , then L is included in some M k ∪ D u ,k ∪ · · · ∪ D u m ,k . We show that inour case we even have L ⊆ M k .Take any w ∈ L . We aim at constructing w ′ ∈ L such that w ′ / ∈ D u i ,k forevery i ∈ [1 , m ] and additionally ϕ ( w ′ ) ≡ ϕ ( w ) mod k . Since cone( A ) = Q n , forevery u j , there exist a loop v j in A such that h ϕ ( v j ) , u j i < 0. Since ϕ ( v j ) , u j ∈ Z n , we even have h ϕ ( v j ) , u j i ≤ − 1. Since each v j belongs to Loop( A ), the words v k +1 j also belong to Loop( A ).Since A is a modular envelope, there exists a word w ′ ∈ L that has all thewords v k +11 , . . . , v k +1 m as infixes and where Ψ ( w ) ≡ Ψ ( w ′ ) mod k . Recall thatevery infix u of every word in D u i ,k has h ϕ ( u ) , u j i ≥ − k . However, we havethe inequality h ϕ ( v k +1 j ) , u j i ≤ − ( k + 1). Thus, w ′ cannot belong to D u i ,k for i ∈ [1 , m ]. Since L ⊆ M k ∪ D u ,k ∪ · · · ∪ D u m ,k , this only leaves w ′ ∈ M k . Since Ψ ( w ′ ) ≡ Ψ ( w ) mod k , we also have ϕ ( w ′ ) ≡ ϕ ( w ) mod k and thus w ∈ M k .We are now prepared to explain the decision procedure for Theorem 9. Thealgorithm is illustrated in ?? 1. If n = 0, then Σ n = ∅ and thus either L = ∅ or L = { ε } , meaning L | Z if and only if L = ∅ . If n ≥ 1, we perform the KLMSTdecomposition, which, as explained in Section 6.3, yields languages L ∪ · · · ∪ L p and modular envelopes A , . . . , A p such that L = L ∪· · · ∪ L p . Since then L | Z n if and and only if L i | Z n for each i ∈ [1 , p ], we check for the latter. For each i ∈ [1 , p ], the dichotomy of Lemma 25 guides a case distinction: If cone( A i ) = Q n ,then by Lemma 37, L i | Z n if and only if Π ( L i ) | Z n , which can be checked viaTheorem 2.If cone( A i ) is contained in some half-space H = { x ∈ Q n | h x, u i ≥ } with u ∈ Z n \ { } , then Lemma 28 tells us that L i ⊆ L ( A i ) ⊆ D u ,k ∪ S U,ℓ forsome computable k, ℓ ∈ N and U = { x ∈ Q n | h x , u i = 0 } . In particular, we have L i | Z n if and only if L i \ D u ,k | Z n . Note that L i \ D u ,k = L i ∩ ( Σ ∗ n \ D u ,k ) is a VASSlanguage and is included in S U,ℓ . Thus, the walks in L i always stay close to thehyperplane U , which has dimension n − 1. We can therefore use the transduction T U,ℓ to transform L i into a set ˆ L i of walks in ( n − lgorithm 1: Deciding separability of a VASS language L from Z n Input: n ∈ N and VASS language L = L ( V ) ⊆ Σ ∗ n if n = 0 and L = ∅ then return “yes” if n = 0 and L = ∅ then return “no” Use KLMST decomposition to compute VASS languages L , . . . , L p , togetherwith modular envelopes A , . . . , A p . for i ∈ [1 , p ] doif cone( A i ) = Q n then Check whether Π ( L i ) | Z n if not Π ( L i ) | Z n then return “no” endif cone( A i ) ⊆ H = { x ∈ Q n | h x , u i ≥ } for some u ∈ Z n \ { } then Let U = { x ∈ Q n | h x , u i = 0 } . /* dim U = n − */ Compute k, ℓ with L i ⊆ L ( A i ) ⊆ D u ,k ∪ S U,ℓ /* Now we have L i \ D u ,k ⊆ S U,ℓ */ Compute transduction T U,ℓ ⊆ Σ ∗ n × Σ ∗ n − Compute VASS for ˆ L i = T U,ℓ ( L i \ D u ,k ) /* ˆ L i has dimension n − : ˆ L i ⊆ Σ ∗ n − */ Check recursively whether ˆ L i | Z n − if not ˆ L i | Z n − then return “no” endendreturn “yes” separability recursively for the result: We have ˆ L i = T U,ℓ ( L i \ D u ,k ) ⊆ Σ ∗ n − andProposition 34 tells us that L i | Z n if and only if ˆ L i | Z n − . Petri nets We now prove Theorem 36. Since our proof crucially relies on Lam-bert’s iteration lemma (Lemma 41), we adopt in this section the notation of Lam-bert and phrase our proof in terms of Petri nets. A Petri net N = ( P, T, Pre , Post )consists of a finite set P of places , a finite set T of transitions and two mappings Pre , Post : T → N P . Configurations of Petri net are elements of N P , called markings . The effect of a transition t ∈ T is Post ( t ) − Pre ( t ) ∈ Z P , denotedeff( t ). If for every place p ∈ P we have Pre ( t )[ p ] ≤ M [ p ] for a transition t ∈ T then t is fireable in M and the result of firing t in marking M is M ′ = M + eff( t ),we write M t −→ M ′ . We extend notions of fireability and firing naturally to se-quences of transitions, we also write M w −→ M ′ for w ∈ T ∗ . The effect of w ∈ T ∗ , w = t · · · t m , t , . . . , t m ∈ T is eff( w ) = eff( t ) + · · · + eff( t m ).For a Petri net N = ( P, T, Pre , Post ) and markings M , M , we define thelanguage L ( N, M , M ) = { w ∈ T ∗ | M w −→ M } . Hence, L ( N, M , M ) is theset of transition sequences leading from M to M . A labeled Petri net is a Petrinet N = ( P, T, Pre , Post ) together with an initial marking M I , a final marking F , and a labeling , i.e. a homomorphism h : T ∗ → Σ ∗ . The language recognizedby the labeled Petri net is then defined as L h ( N, M I , M F ) = h ( L ( N, M I , M F )).It is folklore (and easy to see) that a language is a VASS language if and onlyif it is recognized by a labeled Petri net (and the translation is effective). Thus,it suffices to show Theorem 36 for languages of the form L = h ( L ( N, M I , M F )).Moreover, it is already enough to prove Theorem 36 for languages of the form L ( N, M I , M F ): If A is a modular envelope for L , then applying h to the edgesof A yields a modular envelope for h ( L ). Thus from now on, we assume L = L ( N, M I , M F ) for a fixed Petri net N = ( P, T, Pre , Post ). Basic notions Let us introduce some notions used in Lambert’s proof. We extendthe set of configurations N d into N dω , where N ω = N ∪ { ω } . We extend thenotion of transition firing into N dω , by defining ω − k = ω = ω + k for every k ∈ N . For u , v ∈ N dω we write u ≤ ω v if u [ i ] = v [ i ] or v [ i ] = ω . Intuitivelyreaching a configuration with ω at some places means that it is possible to reachconfigurations with values ω substituted by arbitrarily high values.A key notion in [23] is that of MGTS, which formulate restrictions on pathsin Petri nets. A marked graph-transition sequence (MGTS) for our Petri net N = ( P, T, Pre , Post ) is a finite sequence C , t , C . . . C n − , t n , C n , where t i are transitions from T and C i are precovering graphs, which are defined next. A precovering graph is a quadruple C = ( G, m , m init , m fin ), where G = ( V, E, h ) isa finite, strongly connected, directed graph with V ⊆ N Pω and labeling h : E → T ,and three vectors: a distinguished vector m ∈ V , an initial vector m init ∈ N Pω ,and a final vector m fin ∈ N Pω . A precovering graph has to meet two conditions:First, for every edge e = ( m , m ) ∈ E , there is an m ∈ N Pω with m h ( e ) −→ m ≤ ω m . Second, we have m init , m fin ≤ ω m . Additionally we impose therestriction on MGTS that the initial vector of C equals M I and the final vectorof C n equals M F . Languages of MGTS Each precovering graph can be treated as a finite automa-ton. For m , m ∈ V , L ( C, m , m ) denotes the set of all w ∈ T ∗ read on a pathfrom m to m . Moreover, let L ( C ) = L ( C, m , m ). MGTS have associated lan-guages as well. Let N = C , t , C . . . C n − , t n , C n be an MGTS of a Petri net N ,where C i = ( G i , m i , m init i , m fin i ). Its language L ( N ) is the set of all words of theform w = w t w · · · w n − t n w n ∈ T ∗ where: w i ∈ L ( C i ) for each i ∈ [0 , n ] and(ii) there exist markings u , u ′ , u , u ′ , . . . , u n , u ′ n ∈ N P such that u i ≤ ω m init i and u ′ i ≤ ω m fin i and u w −→ u ′ t −→ u w −→ . . . w n − −→ u ′ n − t n −→ u n w n −→ u ′ n . (3)In this situation, the occurrences of t , . . . , t n shown in Eq. (3) are called the bridges and w , . . . , w n are called the graph parts . Notice that by (ii) and therestriction that m init0 = M I and m fin n = M F , we have L ( N ) ⊆ L ( N, M I , M F )for any MGTS N . Hence roughly speaking, L ( N ) is the set of runs that containthe transitions t , . . . , t n and additionally markings before and after firing thesetransitions are prescribed on some places: this is exactly what the restrictions i ≤ ω m init i , u ′ i ≤ ω m fin i impose. As an immediate consequence of the definition,we observe that for every MGTS N = C , t , C . . . C n − , t n , C n we have L ( N ) ⊆ L ( C ) · { t } · L ( C ) · · · L ( C n − ) · { t n } · L ( C n ) . (4) Perfect MGTS Lambert calls MGTS with a particular property perfect [23].Since the precise definition is involved and we do not need all the details, itis enough for us to mention a selection of facts about perfect MGTS ( ?? ω on place p in m i means that inside of the precovering graph C i , the token count in place p can be made arbitrarily high. The precise for-mulation involves the notion of covering sequences, which we define next. Let C be a precovering graph for a Petri net N = ( P, T, Pre , Post ) with a distin-guished vector m ∈ N Pω and initial vector m init ∈ N Pω . For a marking M let L ( N, M ) = S M ∈ N P L ( N, M , M ), i.e. the set of all the transition sequences fire-able in M . A sequence x ∈ L ( C ) ∩ L ( N, m init ) is called a covering sequence for C if x is enabled in m init and for every place p ∈ P we have either (i) m init [ p ] = ω ,or (ii) m [ p ] = m init [ p ] ∈ N and eff( x )[ p ] = 0, or (iii) m init [ p ] < m [ p ] = ω andeff( x )[ p ] > 0. The property of perfect MGTS that we need is the following: Property 38. In a perfect MGTS N , each precovering graph possesses a coveringsequence.This is part of the definition of perfect MGTS, see [23, page 92]. The second factabout perfect MGTS that we will use is that one can decompose each Petri netinto finitely many perfect MGTS. In [23] the following is shown (Theorem 4.2(page 94) together with the preceding definition). Proposition 39 ([23]). Given a Petri net N , one can compute finitely manyperfect MGTS N , . . . , N p such that L ( N, M I , M F ) equals S pi =1 L ( N i ) .Building the automata By Proposition 39, it suffices to construct a modu-lar envelope for each L ( N i ). Hence, we consider a single perfect MGTS N = C , t , C , . . . , t n , C n with distinguished vertices m , . . . , m n and construct amodular envelope A for L ( N ). We obtain A by gluing together all the pre-covering graphs C i along the transitions t i . In other words, A is the disjointunion of all the graphs C i and has an edge labeled t i from m i − to m i for each i ∈ [1 , n ]. The initial state of A is m and its final state is m n . Ingredient I: Run amalgamation The first ingredient in for showing that A isa modular envelope is a method for constructing runs in Petri nets: the amal-gamation of runs as introduced by Leroux and Schmitz [29]. It is based on anembedding between Petri net runs introduced by Janˇcar [20] and Leroux [28]. Atriple ( u , t, v ) ∈ N P × T × N P is a transition triple if v = u + eff( t ). If there is nodanger of confusion, we sometimes call ( u , t, v ) a transition. A triple ( u , w, v )with u , v ∈ N P and w ∈ ( N P × T × N P ) ∗ is called a prerun . Let ρ = ( u , w, v )and ρ ′ = ( u ′ , w ′ , v ′ ) be preruns with w = ( u , t , v )( u , t , v ) · · · ( u r − , t r , v r )nd w ′ = ( u ′ , t ′ , v ′ )( u ′ , t ′ , v ′ ) · · · ( u ′ s − , t ′ s , v ′ s ). An embedding of ρ in ρ ′ is amonotone map σ : [1 , r ] → [1 , s ] such that t ′ σ ( i ) = t i , u i ≤ u ′ σ ( i ) and v i ≤ v ′ σ ( i ) for i ∈ [1 , r ], and u ≤ u ′ and v ≤ v ′ . In this case, we call the words t ′ · · · t ′ σ (1) − , t ′ σ ( i )+1 · · · t ′ σ ( i +1) − for i ∈ [1 , r − t ′ σ ( r )+1 · · · t ′ s the inserted words of σ . By F ( σ ) ⊆ T ∗ , we denote the set of all infixes of inserted words of σ . Furthermore,by Ψ ( ρ ), we denote the Parikh image Ψ ( t · · · t r ) ∈ N T .Moreover, ρ is called a run if each ( u i , t i , v i ) is a transition and also u = u , u i = v i for i ∈ [1 , r ], and v = v r . Note that this is equivalent to u i = v i for i ∈ [1 , r ] and u = u t −→ u · · · u r − t r −→ u r and we sometimes use the latternotation to denote runs.Suppose we have three runs ρ , ρ , ρ and there are embeddings σ of ρ in ρ and σ of ρ in ρ . As observed in [29, Prop. 5.1] one can define a new run ρ in which both ρ and ρ embed. Let ρ be the run u t −→ u t −→ · · · t r −→ u r .Then ρ and ρ can be written as ρ : u + v w −→ u + v t −→ u + v w −→ u + v · · ·· · · t r −→ u r + v r w r −→ u r + v r +1 ρ : u + v ′ w ′ −→ u + v ′ t −→ u + v ′ w ′ −→ u + v ′ · · ·· · · t r −→ u r + v ′ r w ′ r −→ u r + v ′ r +1 (5)for some v i , v ′ i ∈ N P , i ∈ [0 , r + 1]. Then the amalgam of ρ and ρ (along σ and σ ) is the run ρ defined as u + v + v ′ w −→ u + v + v ′ w ′ −→ u + v + v ′ t −→ u + v + v ′ w −→ u + v + v ′ w ′ −→ u + v + v ′ t −→ ... u r − + v r − + v ′ r − w −→ u r − + v r + v ′ r − w ′ −→ u r − + v r + v ′ r t r −→ u r + v r + v ′ r w r −→ u r + v r +1 + v ′ r w ′ r −→ u r + v r +1 + v ′ r +1 . (6)and the embedding τ of ρ in ρ is defined in the obvious way. Note that therun ρ and the embedding τ satisfy F ( σ ) ∪ F ( σ ) ⊆ F ( τ ) ,Ψ ( ρ ) − Ψ ( ρ ) = ( Ψ ( ρ ) − Ψ ( ρ )) + ( Ψ ( ρ ) − Ψ ( ρ )) . (7)The following lemma is very much in the spirit of Leroux and Schmitz [29],which recasts the KLMST algorithm as the computation of an ideal decompo-sition. Specifically, their [29, Lemma VII.2] shows that the set of runs of N isupward directed, meaning that for any two runs ρ and ρ , there exists ρ in N in which both ρ and ρ embed. We need precise control over the Parikh imagef the runs we construct. Therefore, we introduce the notion of compatible em-beddings, which guarantees that the amalgam of two runs from N again belongsto N .If ρ and ρ ′ are runs in N , then we can associate to each marking u i ( u ′ i ) in ρ (in ρ ′ ) a node ˜ v i (˜ v ′ i ) in some C j . We say that σ is ( N -)compatible if (i) σ maps the k -th bridge transition in ρ to the k -th bridge transition in ρ ′ for each k ∈ [1 , n ] and (ii) for i ∈ [1 , r ], we have ˜ v ′ σ ( i ) = ˜ v i . In other words, σ does(i) preserve bridge transitions and (ii) map each marking in ρ to a marking in ρ ′ that visits the same node in N . Lemma 40. Let ρ , ρ , ρ be runs in N where ρ embeds compatibly in ρ and ρ . Then the amalgam ρ of ρ and ρ is also a run in N . Moreover, the inducedembeddings of ρ , ρ in ρ are compatible. For Lemma 40, we roughly argue as follows. For runs as in Eq. (5), compat-ibility means that u i and u i + v i +1 and u i + v ′ i +1 correspond to the same nodein a component of N . Therefore, the difference vectors v i +1 and v ′ i +1 can benon-zero only in coordinates that have ω in these nodes. This means, the vector u i + v i +1 + v ′ i +1 also differs from u i in only those coordinates and can again beassociated to the same node to show that ρ is a run in N . Proof. Let ρ be the run u t −→ u t −→ · · · t r −→ u r and let ρ and ρ be as inEq. (5). Moreover, let τ be the resulting embedding of ρ in ρ and let σ ′ j bethe embedding of ρ j in ρ for j ∈ { , } . Let us first argue that ρ is a run in N . To this end, we argue that the images of bridge transitions under τ satisfycondition (i) of a run. Suppose t i in ρ is a bridge transition. Then for some finalmarking m fin of some graph C j and some initial marking m init of C j +1 , we have u i − ≤ ω m fin and u i ≤ ω m init . Note that m fin and m init have ω in the same setof places; we denote this set by Ω ⊆ P . Since σ is compatible and ρ is a run,this also implies u i − + v i ≤ ω m fin and u i + v i ≤ ω m init . Note that this means v i [ p ] = 0 if p ∈ P \ Ω , in other words v i ∈ N Ω . By the same argument, we have v ′ i ∈ N Ω . Therefore, we also have u i − + v i + v ′ i ≤ m fin and u i + v i + v ′ i ≤ m init ,which proves condition (i).We now continue with condition (ii). Since σ and σ are compatible, thebridge transitions of ρ must be among the t , . . . , t r . Therefore, each w i isincluded in some graph part of ρ ; and each w ′ i is included in some graph part of ρ . Let ˜ u i ∈ N Pω be the node in the graph C associated with u i in ρ . Since σ iscompatible, the ˜ u i is also the node associated with u i + v i and with u i + v i +1 . Inparticular, we have w i ∈ L ( C, ˜ u i ). By the same argument, we have w ′ i ∈ L ( C, ˜ u i )and therefore w i w ′ i ∈ L ( C, ˜ u i ). In other words, ρ is obtained from ρ by insertingloops w ′ i in graphs right after loops at the same node ˜ u i . Thus, ρ is a run in N .It remains to be shown that σ ′ , σ ′ are compatible. By symmetry, it sufficesto show this for σ ′ . Consider the transitions in ρ inside u i + v i w i −→ u i + v i +1 .Since the bridge transitions of ρ must be among t , . . . , t r , we know that w i isincluded in some graph part of ρ in some graph C . Observe that because ofstrong connectedness, all nodes in a graph of an MGTS have ω in exactly thesame places. Let Ω ⊆ P be the set of those places. Let ˜ u i ∈ N Pω be the nodessociated to u i in ρ . Since σ is compatible, the marking u i + v ′ i is associatedwith the same node ˜ u i . Therefore, we have u i ≤ ω ˜ u i and u i + v i ≤ ω ˜ u i . Thismeans for every p ∈ P with v ′ i [ p ] = 0, we have ˜ u i [ p ] = ω . In other words, v ′ i ∈ N Ω . Note that every node associated to a transition in w i belong to C and adding a vector from N Ω to a marking does not change its associated node.Since σ ′ maps u i + v i w i −→ u i + v i +1 to u i + v i + v ′ i w i −→ u i + v i +1 + v ′ i , σ ′ has to preserve the nodes of the transitions in w i . Similarly, one shows that σ ′ preserves nodes of markings around non-bridge transitions among t , . . . , t r . Ingredient II: Lambert’s iteration lemma Our second ingredient for showingthat A is a modular envelope is Lambert’s iteration lemma. It allows us toconstruct runs containing desired infixes, which can then be revised using amal-gamation. Recall that we consider the marked graph-transition sequence N = C , t , C . . . C n − , t n , C n . Let C i = ( V i , E i , h i ) be a precovering graph, and letthe distinguished vertex be m i and initial vertex be m init i . The following is asimplified version of Lambert’s iteration lemma (Lemma 4.1 in [23] (page 92)). Lemma 41 (Lambert [23]). Suppose N = C , t , C , . . . , t n , C n and let x i ∈ T ∗ be a covering sequence for C i for i ∈ [0 , n ] . Then there exist k ∈ N andsequences β i , y i , z i ∈ T ∗ for i ∈ [0 , n ] such that for every k ≥ k , x k β y k z k · t · x k β y k z k · · · t n · x kn β n y kn z kn is a run in N , such that the shown occurrences of t , . . . , t n are the bridges.Moreover, we have P ij =0 eff( x i y i z i )[ p ] ≥ for every i ∈ [1 , n ] and p ∈ P with m fin i [ p ] = ω . The inequalities P ij =0 eff( x i y i z i )[ p ] ≥ p with m fin i [ p ] = ω follow fromitem (i) in [23, Lemma 4.1]: In the notation of [23], item (i) of Lemma 4.1 statesthat the effect of x y z · · · x j y j z j in p equals α ( x ( c ′ j ( p )) − x ( c ( p ))). Since x is a solution to the homogeneous characteristic equation (see page 91 for thedefinition), we have x ( c ( p )) = 0. Perfectness (see page 92 for the definition)and the fact that x even has maximal support among all solutions imply that x ( c ′ j ( p )) ≥ p . Finally, the proof of [23, Lemma 4.1] chooses α ∈ N soas to be above certain thresholds. We may therefore assume that α ≥ N that contains the desired infixesand in which a given run embeds. Lemma 42. For every run ρ in N and words u , . . . , u m ∈ Loop( A ) , thereis a run ρ ′ in N such that ρ embeds in ρ ′ via a compatible embedding σ with u , . . . , u m ∈ F ( σ ) .Proof. Roughly speaking, the proof of Lemma 42 proceeds as follows. First,we take a covering sequence for every component and show that they can beprolongated so that each u i appears as an infix of some covering sequence. Then,we prolongate the covering sequences further so that they contain the w i if ρ is as in Eq. (3). Next, we iterate each covering sequence so that it createsenough tokens in places p with m i [ p ] = ω , m fin i − [ p ] ∈ N so that the part w i of can embed. To make sure that there are enough tokens also in places p with m fin i [ p ] = ω , we drive up k . Because of P ij =0 eff( x i y i z i )[ p ] ≥ ρ .In the proof, we will use the concept of a hurdle for a transition sequence.Observe that for every sequence w ∈ T ∗ , there exists a smallest marking m ∈ N P such that w can be fired in m . This is called the hurdle of w and we denote itby hurdle( w ).Let N = C , t , C , . . . , t n , C n and let m i be the distinguished vertex of C i and let m init i be the initial vertex of C i . Each of the words u , . . . , u m labels aloop in some precovering graph C i . Since C i is strongly connected, we can picka loop u ′ i ∈ L ( C i ) for each i ∈ [0 , n ] so that every word u j appears as an infix in u ′ , . . . , u ′ n .Let ρ be the run w t w · · · t n w n in N . Since N is perfect, there is a coveringsequence x i ∈ T ∗ for each C i , i ∈ [0 , n ]. We will now construct a coveringsequence x ℓi u ′ i w i for some ℓ and then apply Lemma 41.Let n i be the marking that ρ enters after firing t i (and hence before firing w i ). Pick ℓ ≥ ℓ ≥ hurdle( u ′ i w i )[ p ],2. ℓ > | eff( u ′ i w i )[ p ] | , and3. ℓ − | eff( u ′ i )[ p ] | ≥ n i [ p ]for every p ∈ P with m i [ p ] = ω . We claim that the sequence x ′ i = x ℓi u ′ i w i is acovering sequence for C i .First, x ′ i belongs to L ( C i ), because each word x i , u ′ i , w i does. Moreover, x ′ i isenabled in m init i : Since x i is a covering sequence, x ℓi is enabled. Consider p ∈ P with m init i [ p ] ∈ N . If m i [ p ] = ω , then x i has a positive effect on p , so that firing x ℓi leaves at least ℓ ≥ hurdle( u ′ i w i )[ p ] tokens in p . If m i [ p ] ∈ N , then x i , u ′ i , and w i have zero effect on p . Thus, x ℓi u ′ i w i is indeed enabled in m init i .To establish that x ′ i is a covering sequence, it remains to show that for each p ∈ P one of the conditions (i)–(iii) holds. This is trivial if m init i [ p ] = ω , sosuppose m init i [ p ] ∈ N . If m i [ p ] ∈ N , then each of the sequences x i , u ′ i , and w i havezero effect on p by virtue of belonging to L ( C i ). If m i [ p ] = ω , then x ℓi producesat least ℓ tokens in p and since ℓ > | eff( u ′ i w i )[ p ] | , we have eff( x ℓi u ′ i w i )[ p ] > x ′ i is a covering sequence for C i .According to Lemma 41, there are k ∈ N , β i ∈ T ∗ , y i , z i ∈ T ∗ for i ∈ [0 , n ],so that for every k ≥ k , the sequence ρ k = x ′ k β y k z k · t · x ′ k β y k z k · · · t n · x ′ kn β n y kn z kn (8)is a run in N for which P ij =0 eff( x ′ j y j z j )[ p ] ≥ p ∈ P and i ∈ [0 , n ] with m fin i [ p ] = ω . We now claim that for large enough k , the run ρ k can be chosen asthe desired ρ ′ .The embedding σ will map each t i to the t i displayed in Eq. (8). Let m ( k ) i be the marking entered in ρ k before firing t i . Moreover, σ will embed each w i to the infix w i in the first occurrence of x ′ i = x ℓi u ′ i w i . Let n ′ ( k ) i be the markingntered before firing this infix w i in ρ k . To verify that this will indeed yield anembedding of runs, we have to show that for large enough k , we have n i − eff( t i ) ≤ m ( k ) i for i ∈ [1 , n ] and n i ≤ n ′ ( k ) i for i ∈ [0 , n ] (9)The left inequality states that there are enough tokens to embed the markingentered in ρ before firing t i , i ∈ [1 , n ]. The right inequality states that the sameis true for the marking entered in ρ before firing w i , i ∈ [0 , n ].Let us argue that we can choose k large enough to satisfy Eq. (9). First,consider the left inequality for i ∈ [1 , n ] and let p ∈ P . If m fin i − [ p ] ∈ N , then ofcourse we have m ( k ) i [ p ] ≥ n i [ p ] − eff( t i )[ p ]: We even have m ( k ) i [ p ] = m fin i − [ p ] = n i [ p ] − eff( t i )[ p ], which has to hold for any run in N . If m fin i − [ p ] = ω , then weobserve m ( k ) i [ p ] = eff( x ′ k β y k z k ) + i − X j =1 eff( t j x ′ kj β j y kj z kj )= eff( β t β · · · t i − β i − )[ p ] + k · i − X j =0 eff( x ′ j y j z j )[ p ] ≥ eff( β t · · · t i − β i − )[ p ] + k because P i − j =0 eff( x ′ j y j w j ) ≥ 1. Hence, for large enough k , the left inequality ofEq. (9) is fulfilled for such i ∈ [1 , n ]. Thus, it holds for every i ∈ [1 , n ].Now consider the right inequality of Eq. (9) for i ∈ [0 , n ]. Let p ∈ P . Wedistinguish three cases.1. Suppose m init i [ p ] = ω . Then we also have m fin i − [ p ] = ω . Observe that n ′ i [ p ] = eff( β t β · · · t i − β i − )[ p ]+ k · i − X j =0 eff( x ′ i y i z i )[ p ] + eff( t i x ℓi u ′ i )[ p ] ≥ eff( β t β · · · t i − β i − )[ p ] + k + eff( t i x ℓi u ′ i )[ p ]since in this case P i − j =0 eff( x ′ i y i z i ) ≥ 1. Thus, for large enough k , we have n ′ i [ p ] ≥ n i [ p ].2. Suppose m init i [ p ] = m i [ p ] ∈ N . Then, both n i [ p ] and n ′ i [ p ] are necessarilyequal to m init i [ p ]: Such places p are left unchanged by cycles in C i . Hence, n i [ p ] = n ′ i [ p ].3. Suppose m init i [ p ] ∈ N and m i [ p ] = ω . In this case, we have n i [ p ] ≤ n ′ i [ p ]already by our choice of ℓ : Since for such p , x i has a positive effect, wehave in particular n ′ i [ p ] ≥ ℓ . Since we chose ℓ with ℓ − | eff( u ′ i )[ p ] | ≥ n i [ p ],this implies that after executing x ℓi u ′ i , there must be at least n i [ p ] tokens in n ′ i [ p ].Thus, each of the 2 n + 1 inequalities in Eq. (9) holds for sufficiently large k ,meaning we can choose a k for which they all hold simultaneously. With this,let ρ ′ = ρ k . Now indeed, ρ embeds into ρ ′ via the embedding σ . Then clearly u ′ i ∈ F ( σ ) for i ∈ [0 , n ], hence u j ∈ F ( σ ) for j ∈ [1 , m ]. ⊓⊔ roof of the modular envelope property We are finally ready to show that A isa modular envelope for L ( N ). Given a run ρ in N for the transition sequence w ∈ L ( N ), we first use Lemma 42 to obtain a run ρ such that ρ contains each u i , i ∈ [1 , n ], as an infix and ρ embeds via a compatible embedding σ into ρ .For j ≥ 2, let ρ j be the run obtained by amalgamating ρ j − and ρ along σ j − and σ . Moreover, let σ j be the resulting embedding. Then Lemma 40 tells usthat ρ j is a run in N for every j ≥ 2. Moreover, we have u i ∈ F ( σ j − ) ⊆ F ( σ j )for every i ∈ [1 , m ] and also Ψ ( ρ j ) − Ψ ( ρ ) = Ψ ( ρ j − ) − Ψ ( ρ ) + Ψ ( ρ ) − Ψ ( ρ )(Eq. (7)) and hence by induction Ψ ( ρ j ) = Ψ ( ρ ) + j · ( Ψ ( ρ ) − Ψ ( ρ )). In particular Ψ ( ρ k ) ≡ Ψ ( ρ ) mod k . Therefore, the transition sequence of ρ k is a word w ′ thathas each u i as an infix and satisfies Ψ ( w ′ ) ≡ Ψ ( w ) mod k . This proves that A isa modular envelope for L ( N ). References 1. Jean Berstel. Transductions and context-free languages . Teubner Studienb¨ucher,Stuttgart, 1979.2. Miko laj Boja´nczyk. It is undecidable if two regular tree languages can be sepa-rated by a deterministic tree-walking automaton. Fundam. Inform. , 154(1-4):37–46, 2017.3. Micha¨el Cadilhac, Alain Finkel, and Pierre McKenzie. Affine parikh automata. RAIRO - Theor. Inf. and Applic. , 46(4):511–545, 2012. doi:10.1051/ita/2012013 .4. Lorenzo Clemente, Wojciech Czerwi´nski, S lawomir Lasota, and Charles Paperman.Regular separability of Parikh automata. In Proceedings of ICALP ’17 , pages117:1–117:13, 2017.5. Lorenzo Clemente, Wojciech Czerwi´nski, S lawomir Lasota, and Charles Paper-man. Separability of reachability sets of vector addition systems. In Proceedingsof STACS ’17 , pages 24:1–24:14, 2017.6. Wojciech Czerwi´nski, Piotr Hofman, and Georg Zetzsche. Unboundedness prob-lems for languages of vector addition systems. In Proceedings of ICALP ’18 , pages119:1–119:15, 2018. doi:10.4230/LIPIcs.ICALP.2018.119 .7. Wojciech Czerwi´nski and S lawomir Lasota. Regular separability of one counterautomata. In Proceedings of LICS ’17 , pages 1–12, 2017.8. Wojciech Czerwi´nski, S lawomir Lasota, Ranko Lazic, J´erˆome Leroux, and FilipMazowiecki. The reachability problem for Petri nets is not elementary (extendedabstract). CoRR , abs/1809.07115, 2018.9. Wojciech Czerwi´nski, Slawomir Lasota, Roland Meyer, Sebastian Muskalla,K. Narayan Kumar, and Prakash Saivasan. Regular separability of well-structuredtransition systems. In Proceedings of CONCUR ’18 , pages 35:1–35:18, 2018. doi:10.4230/LIPIcs.CONCUR.2018.35 .10. Wojciech Czerwi´nski, Wim Martens, Lorijn van Rooijen, Marc Zeitoun, and GeorgZetzsche. A characterization for decidable separability by piecewise testable lan-guages. Discrete Mathematics & Theoretical Computer Science , 19(4), 2017.11. Alain Finkel and Philippe Schnoebelen. Well-structured transition sys-tems everywhere! Theoretical Computer Science , 256(1-2):63–92, 2001. doi:10.1016/S0304-3975(00)00102-X .12. Gilles Geeraerts, Jean-Fran¸cois Raskin, and Laurent Van Begin. Well-structuredlanguages. Acta Informatica , 44(3-4):249–288, 2007.3. Jean Goubault-Larrecq and Sylvain Schmitz. Deciding piecewise testable separa-bility for regular tree languages. In Proceedings of ICALP ’16 , pages 97:1–97:15,2016.14. Sheila A. Greibach. Remarks on blind and partially blind one-way mul-ticounter machines. Theoretical Computer Science , 7(3):311 – 324, 1978. doi:10.1016/0304-3975(78)90020-8 .15. Christoph Haase and Simon Halfon. Integer vector addition systems with states.In Proceedings of RP ’14 , pages 112–124, 2014.16. Peter Habermehl, Roland Meyer, and Harro Wimmel. The downward-closure ofpetri net languages. In Proceedings of ICALP ’10 , pages 466–477, 2010.17. John E. Hopcroft and Jean-Jacques Pansiot. On the reachability problem for 5-dimensional vector addition systems. Theor. Comput. Sci. , 8:135–159, 1979.18. Harry B. Hunt III. On the decidability of grammar problems. Journal of the ACM ,29(2):429–447, 1982.19. Matthias Jantzen. On the hierarchy of petri net languages. RAIRO - TheoreticalInformatics and Applications - Informatique Th´eorique et Applications , 13(1):19–30, 1979. URL: .20. Petr Janˇcar. Decidability of a temporal logic problem for Petri nets. Theor.Comput. Sci. , 74(1):71–93, 1990.21. Petr Janˇcar. Deciding structural liveness of Petri nets. In Proceedings of SOFSEM’17 , pages 91–102, 2017.22. S. Rao Kosaraju. Decidability of reachability in vector addition systems (prelimi-nary version). In Proceedings of STOC ’82 , pages 267–281, 1982.23. Jean-Luc Lambert. A structure to decide reachability in Petri nets. Theor. Comput.Sci. , 99(1):79–104, 1992.24. Serge Lang. Linear Algebra . Addison-Wesley, 1966.25. Ranko Lazi´c and Sylvain Schmitz. Nonelementary complexities for branchingVASS, MELL, and extensions. ACM Trans. Comput. Log. , 16(3):20:1–20:30, 2015.26. Ranko Lazi´c and Patrick Totzke. What makes Petri nets harder to verify: Stackor data? In Concurrency, Security, and Puzzles — Essays Dedicated to AndrewWilliam Roscoe on the Occasion of His 60th Birthday , volume 10160 of LNCS ,pages 144–161. Springer, 2017.27. J´erˆome Leroux. The general vector addition system reachability problem by Pres-burger inductive invariants. In Proceedings of LICS ’09 , pages 4–13, 2009.28. J´erˆome Leroux. Vector addition system reachability problem: a short self-containedproof. In Proceedings of POPL ’11 , pages 307–316, 2011.29. J´erˆome Leroux and Sylvain Schmitz. Demystifying reachability in vector additionsystems. In Proceedings of LICS’15 , pages 56–67, 2015.30. Ernst W. Mayr. An algorithm for the general Petri net reachability problem. In Proceedings of STOC’81 , pages 238–246, 1981.31. Thomas Place. Separating regular languages with two quantifiers alternations. In Proceedings of LICS ’15 , pages 202–213, 2015.32. Thomas Place, Lorijn van Rooijen, and Marc Zeitoun. Separating regular languagesby piecewise testable and unambiguous languages. In Proceedings of MFCS ’13 ,pages 729–740, 2013.33. Thomas Place and Marc Zeitoun. Separation and the successor relation. In Pro-ceedings of STACS ’15 , pages 662–675, 2015.34. Thomas Place and Marc Zeitoun. Separating regular languages with first-orderlogic. Logical Methods in Computer Science , 12(1), 2016.35. Thomas Place and Marc Zeitoun. Concatenation hierarchies: New bottle, old wine.In Proceedings of CSR ’17 , pages 25–37, 2017.6. Thomas Place and Marc Zeitoun. Separation for dot-depth two. In Proceedings ofLICS ’17 , pages 1–12, 2017.37. George S. Sacerdote and Richard L. Tenney. The decidability of the reachabilityproblem for vector addition systems (preliminary version). In Proceedings of STOC’77 , pages 61–76. ACM, 1977.38. Alexander Schrijver. Theory of linear and integer programming . John Wiley &Sons, 1986.39. Thomas G. Szymanski and John H. Williams. Noncanonical extensions of bottom-up parsing techniques. SIAM Journal on Computing , 5(2), 1976.40. Georg Zetzsche. An approach to computing downward closures. In Proceedings ofICALP ’15 , pages 440–451, 2015.41. Georg Zetzsche. Separability by piecewise testable languages and downward clo-sures beyond subwords. In