Deciding Polynomial Termination Complexity for VASS Programs
DDeciding Polynomial Termination Complexity forVASS Programs
Michal Ajdarów ˇ Masaryk University, Czechia
Antonín Kučera ! ˇ Masaryk University, Czechia
Abstract
We show that for every fixed k ≥
3, the problem whether the termination/counter complexityof a given demonic VASS is O ( n k ), Ω( n k ), and Θ( n k ) is coNP -complete, NP -complete, and DP -complete, respectively. We also classify the complexity of these problems for k ≤
2. This showsthat the polynomial-time algorithm designed for strongly connected demonic VASS in previousworks cannot be extended to the general case. Then, we prove that the same problems for VASSgames are
PSPACE -complete. Again, we classify the complexity also for k ≤
2. Interestingly,tractable subclasses of demonic VASS and VASS games are obtained by bounding certain structuralparameters, which opens the way to applications in program analysis despite the presented lowercomplexity bounds.
Theory of computation → Models of computation
Keywords and phrases
Termination complexity, vector addition systems
Digital Object Identifier
Acknowledgements
The work is supported by the Czech Science Foundation, Grant No. 21-24711S.
Vector addition systems with states (VASS) are a generic formalism expressively equivalentto Petri nets. In program analysis, VASS are used to model programs with unboundedinteger variables, parameterized systems, etc. Thus, various problems about such systemsreduce to the corresponding questions about VASS. This approach’s main bottleneck is thatinteresting questions about VASS tend to have high computational complexity (see, e.g.,[7, 14, 15]). Surprisingly, recent results (see below) have revealed computational tractabilityof problems related to asymptotic complexity of VASS computations, allowing to answerquestions like “Does the program terminate in time polynomial in n for all inputs of size n ?”, or “Is the maximal value of a given variable bounded by O ( n ) for all inputs ofsize n ?”. These results are encouraging and may enhance the existing software tools forasymptotic program analysis such as as SPEED [10], COSTA [1], RAML [11], Rank [2],Loopus [16, 17], AProVE [9], CoFloCo [8], C4B [6], and others. In this paper, we give a fullclassification of the computational complexity of deciding polynomial termination/countercomplexity for demonic VASS and VASS games, and solve open problems formulated inprevious works. Furthermore, we identify structural parameters making the asymptotic VASSanalysis computationally hard. Since these parameters are often small in VASS programabstractions, this opens the way to applications in program analysis despite the establishedlower complexity bounds.The termination complexity of a given VASS A is a function L : N → N ∞ assigning toevery n the maximal length of a computation initiated in a configuration with all countersinitialized to the n . Similarly, the counter complexity of a given counter c in A is a function C [ c ] : N → N ∞ such that C [ c ]( n ) is the maximal value of c along a computation initiated in © Michal Ajdarów and Antonín Kučera;licensed under Creative Commons License CC-BY 4.042nd Conference on Very Important Topics (CVIT 2016).Editors: John Q. Open and Joan R. Access; Article No. 23; pp. 23:1–23:22Leibniz International Proceedings in InformaticsSchloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany a r X i v : . [ c s . L O ] F e b input i ; while ( i >0)i := i −1;j := i ; while ( j >0)j := j −1; input i ; while ( i >0)i −−;j :=0; Aux:=0; while ( i >0)i −−;j ++;Aux++; while (Aux>0)i ++;Aux−−; while ( j >0)j −−; (0 , , , , , , − , ,
0) /* i-- */(0 , ,
0) (0 , − , −
1) // j:=0; Aux:=0 //( − , +1 , +1) // i--; j++; Aux++ //(+1 , , −
1) // i++; Aux-- //(0 , − ,
0) // j-- // Figure 1
A skeleton of a simple imperative program (left) and its VASS model (right). a configuration with all counters set to the n . So far, three types of VASS models have beeninvestigated in previous works. Demonic VASS , where the non-determinism is resolved by an adversarial environmentaiming to increase the complexity.
VASS Games , where every control state is declared as angelic or demonic , and thenon-determinism is resolved by the controller or by the environment aiming to lower andincrease the complexity, respectively. VASS MDPs , where the states are either non-deterministic or stochastic. The non-determinism is usually resolved in the “demonic” way.Let us note that the “angelic” and “demonic” non-determinism are standard concepts inprogram analysis [5] applicable to arbitrary computational devices including VASS. The useof VASS termination/counter complexity analysis is illustrated in the next example. ▶ Example 1.
Consider the program skeleton of Fig. 1 (left). Since a VASS cannot directlymodel the assignment j:=i and cannot test a counter for zero, the skeleton is first transformedinto an equivalent program of Fig. 1 (middle), where the assignment j:=i is implementedusing an auxiliary variable
Aux and two while loops. Clearly, the execution of the transformedprogram is only longer than the execution of the original skeleton (for all inputs). For thetransformed program, an over-approximating demonic VASS model is obtained by replacingconditionals with non-determinism, see Fig. 1 (right). When all counters are initialized to n ,the VASS terminates after O ( n ) transitions. Hence, the same upper bound is valid also forthe original program skeleton. Actually, the run-time complexity of the skeleton is Θ( n )where n is the initial value of i , so the obtained upper bound is asymptotically optimal. Existing results.
In [4], it is shown that the problem whether L ∈ O ( n ) for a given demonicVASS is solvable in polynomial time, and a complete proof method based on linear rankingfunctions is designed. The polynomiality of termination complexity for a given demonicVASS is also decidable in polynomial time, and if L ̸∈ O ( n k ) for any k ∈ N , then L ∈ Ω( n ) [13]. The same results hold for counter complexity. In [18], a polynomial time algorithmcomputing the least k ∈ N such that L ∈ O ( n k ) for a given demonic VASS is presented (thealgorithm first checks if such a k exists). It is also shown that if L ̸∈ O ( n k ), then L ∈ Ω( n k ).Again, the same results hold also for counter complexity. The proof is actually given only for strongly connected demonic VASS , and it is conjectured that a generalization to unrestricteddemonic VASS can be obtained by extending the presented construction (see the Introductionof [18]). In [12], it was shown that the problem whether the termination/counter complexity . Ajdarów and A. Kučera 23:3 of a given demonic VASS belongs to a given level of Grzegorczyk hierarchy is solvable inpolynomial time, and the same problem for VASS games is shown NP -complete. In [12], itis also noted that the techniques designed to analyze the termination/counter complexityfor VASS games and the Grzegorczyk hierarchy are not applicable to VASS games and thepolynomial hierarchy. The reason is that Grzegorczyk classes are closed under functioncomposition (unlike the classes Θ( n k )) and player Angel can safely commit to a counterless strategy when minimizing the complexity level in the Grzegorczyk hierarchy. However, theproblem whether L ∈ O ( n ) for a given VASS game is shown PSPACE hard in [12], whichimplies that counterless strategies are insufficient. Even the decidability of the L ∈ O ( n )problem for VASS games is left open in [12]. As for VASS MDPs, the only existing result is[3], where it is shown that the linearity of termination complexity is solvable in polynomialtime for VASS MDPs with a tree-like MEC decomposition. Our contribution.
For demonic VASS, we refute the conjecture of [18] and prove that forgeneral (not necessarily strongly connected) demonic VASS, the problem whether L ∈ O ( n k ) is in P for k = 1, and coNP -complete for k ≥ L ∈ Ω( n k ) is in P for k ≤
2, and NP -complete for k ≥ L ∈ Θ( n k ) is in P for k = 1, coNP -complete for k = 2, and DP -complete for k ≥ c is Ω( n k ) iff there is a path in theDAG such that the associated maximal increase of c is Ω( n k ). Thus, we obtain the NP upperbound, and the other upper bounds follow similarly. The crucial parameter characterizinghard-to-analyze instances is the number of different paths from a root to a leaf in the DAGdecomposition, and tractable subclasses of demonic VASS are obtained by bounding thisparameter. We refer to Section 3 for more details.Then, we turn our attention to VASS games, where the problem of polynomial termina-tion/counter complexity analysis requires completely new ideas. In [12], it was noted thatplayer Angel cannot use just counterless strategies when minimizing the complexity level inthe polynomial hierarchy. Clearly, the information about the “asymptotic counter increaseperformed so far” must be taken into account by player Angel. However, it is not clear how toextract the information needed for making the right decisions and whether this is achievable.We show that player Angel can safely commit to a so-called locking strategy. A strategyfor player Angel is locking if whenever a new angelic state p is visited, one of its outgoingtransition is chosen and “locked” so that when p is revisited, the same locked transitionis used. The locked transition choice may depend on the computational history and thetransitions locked in previously visited angelic states. Then, we define a locking decomposition of a given VASS that plays a role similar to the DAG decomposition for demonic VASS.Using the locking decomposition, the existence of a suitable locking strategy for player Angelis decided by an alternating polynomial time algorithm (and hence in polynomial space). C V I T 2 0 1 6 input i ;2 j :=0; k :=0; z :=0;3 i f c o n d i t i o n // demonic c h o i c e //4 then while ( i >0) do j ++; k:=k+i ; i −−; done else j := i ∗ i ; k:= i ;6 while ( i >0) do j := j+k ; i −−; done choose : // a n g e l i c c h o i c e //8 while ( j >0) do j −−; z++ done or : while ( k>0) do k−−; z++ done Figure 2
A simple program with both demonic and angelic non-determinism.
Thus, we obtain the following: For every VASS game, we have that L is either in O ( n k ) orin Ω( n k +1 ). Furthermore, the problem whether L ∈ O ( n k ) is NP -complete for k =1 and PSPACE -complete for k ≥ L ∈ Ω( n k ) is in P for k =1, coNP -complete for k =2, and PSPACE -complete for k ≥ L ∈ Θ( n k ) is NP -complete for k =1 and PSPACE -complete for k ≥ games in program analysis/synthesis, we give one more example. ▶ Example 2.
Consider the program of Fig. 2. The condition at line 3 is resolved by theenvironment in a demonic way. The two branches of if-then-else execute a code modifyingthe variables j and k . After that, the controller can choose one of the two while -loops atlines 8, 9 with the aim of keeping the value of z small. The question is how the size of z grows with the size of input if the controller makes optimal decisions. A closer look revealsthat when the variable i is assigned n at line 1, thenthe values of j and k are Θ( n ) and Θ( n ) when the condition is evaluated to true ;the values of j and k are Θ( n ) and Θ( n ) when the condition is evaluated to false .Hence, the controller can keep z in Θ( n ) if an optimal decision is taken. Constructing aVASS game model for the program of Fig. 2 is straightforward (the required gadgets aregiven in Fig. 3). Using the results of this paper, the above analysis can be performed fullyautomatically . The sets of integers and non-negative integers are denoted by Z and N , respectively, and weuse N ∞ to denote N ∪ {∞} . The vectors of Z d where d ≥ v , u , . . . , and thevector ( n, . . . , n ) is denoted by ⃗n . ▶ Definition 3 (VASS) . Let d ≥ . A d -dimensional vector addition system with states(VASS) is a pair A = ( Q, Tran ) , where Q ̸ = ∅ is a finite set of states and Tran ⊆ Q × Z d × Q is a finite set of transitions such that for every q ∈ Q there exists p ∈ Q and u ∈ Z d suchthat ( q, u , p ) ∈ Tran.
The set Q is split into two disjoint subsets Q A and Q D of angelic and demonic statescontrolled by the players Angel and Demon, respectively. A configuration of A is a pair p v ∈ Q × N d , where v is the vector of counter values. We often refer to counters by theirsymbolic names. For example, when we say that A has three counters x, y, z and the value of . Ajdarów and A. Kučera 23:5 x in a configuration p v is 8, we mean that d = 3 and v i = 8 where i is the index associatedto x . When the mapping between a counter name and its index is essential, we use c i todenote the counter with index i .A finite path in A of length m is a finite sequence ϱ = p , u , p , u , . . . , p m such that( p i , u i , p i +1 ) ∈ T ran for all 1 ≤ i < m . We use ∆( ϱ ) to denote the effect of ϱ , defined as P mi =1 u i . An infinite path in A is an infinite sequence α = p , u , p , u , . . . such that everyfinite prefix p , u , . . . , p m of α is a finite path in A .A computation of A is a sequence of configurations α = p v , p v , . . . of length m ∈ N ∞ such that for every 1 ≤ i < m there is a transition ( p i , u i , p i +1 ) satisfying v i +1 = v i + u i .Note that every computation determines its associated path in the natural way. VASS Termination Complexity. A strategy for Angel (or Demon) in A is a function η assigning to every finite computation p v , . . . , p m v m where p m ∈ Q A (or p m ∈ Q D )a transition ( p m , u , q ). Every pair of strategies ( σ, π ) for Angel/Demon and every initialconfiguration p v determine the unique maximal computation Comp σ,π ( p v ) initiated in p v . The maximality means that the computation cannot be prolonged without makingsome counter negative. For a given counter c , we use max [ c ]( Comp σ,π ( p v )) to denote thesupremum of the c ’s values in all configurations visited along Comp σ,π ( p v ). Furthermore, weuse len ( Comp σ,π ( p v )) to denote the length of Comp σ,π ( p v ). Note that max [ c ] and len canbe infinite for certain computations.For every initial configuration p v , consider a game where the players Angel and Demonaim at minimizing and maximizing the max [ c ] or len objective. By applying standardgame-theoretic arguments (see Appendix A), we obtainsup π inf σ len ( Comp σ,π ( p v )) = inf σ sup π len ( Comp σ,π ( p v )) (1)sup π inf σ max [ c ]( Comp σ,π ( p v )) = inf σ sup π max [ c ]( Comp σ,π ( p v )) (2)where σ and π range over all strategies for Angel and Demon, respectively. Hence, thereexists a unique termination value of p v , denoted by Tval ( p v ), defined by (1). Similarly, forevery counter c there exists a unique maximal counter value , denoted by Cval [ c ]( p v ), definedby (2). Furthermore, both players have optimal positional strategies σ ∗ and π ∗ achievingthe outcome specified by the equilibrium value or better in every configuration p v againstevery strategy of the opponent (here, a positional strategy is a strategy depending only onthe currently visited configuration). We refer to Appendix A for details.The termination complexity and c -counter complexity of A are functions N → N ∞ where L ( n ) = max { Tval ( p⃗n ) | p ∈ Q } and C [ c ]( n ) = max { Cval [ c ]( p⃗n ) | p ∈ Q } . When theunderlying VASS A is not clear, we write L A and C A [ c ] instead of L and C [ c ].Observe that the asymptotic analysis of termination complexity for a given VASS A istrivially reducible to the asymptotic analysis of counter complexity in a VASS B obtainedfrom A by adding a fresh “step counter” sc incremented by every transition of B . Clearly, L A ∈ Θ( C B [ sc ]). Hence, the lower complexity bounds for the considered problems ofasymptotic analysis are proven for L , while the upper bounds are proven for C [ c ]. We start by classifying the computational complexity of polynomial asymptotic analysis fordemonic VASS. The following theorem holds regardless whether the counter update vectorsare encoded in unary or binary (the lower bounds hold for unary encoding, the upper boundshold for binary encoding).
C V I T 2 0 1 6
VASS Program 1 A φ d += d ∗ e ; d += d ∗ e ; · · · ; d k += d k − ∗ e k − ; foreach i = 1 , . . . , v do choose: x i += d k or ¯ x i += d k ; end s += d k ; foreach i = 1 , . . . , m do choose: s i += min( ℓ i , s i − ) or s i += min( ℓ i , s i − ) or s i += min( ℓ i , s i − ); end f += s m ∗ n ▶ Theorem 4.
Let k ≥ . For every demonic VASS A we have that L is either in O ( n k ) orin Ω( n k +1 ) . Furthermore, the problem whether L ∈ O ( n k ) is in P for k = 1 , and coNP -complete for k ≥ ; L ∈ Ω( n k ) is in P for k ≤ , and NP -complete for k ≥ ; L ∈ Θ( n k ) is in P for k = 1 , coNP -complete for k = 2 , and DP -complete for k ≥ .The same results hold also for C [ c ] (for a given counter c of A ). The next theorem identifies the crucial parameter influencing the complexity of polynomialasymptotic analysis for demonic VASS. Let D ( A ) be the standard DAG of strongly connectedcomponents of A . For every leaf (bottom SCC) η of D ( A ), let Deg ( η ) be the total numberof all paths from a root of D ( A ) to η . ▶ Theorem 5.
Let Λ be a class of demonic VASS such that for every A ∈ Λ and every leaf η of D ( A ) we have that Deg ( η ) is bounded by a fixed constant depending only on Λ .Then, the problems whether L A ∈ O ( n k ) , L A ∈ Ω( n k ) , L A ∈ Θ( n k ) for given A ∈ Λ and k ∈ N , are solvable in polynomial time (where the k is written in binary). The same resultshold also for C [ c ] (for a given counter c of A ). Of course, the degree of the polynomial bounding the running time of the decisionalgorithm for the three problems of Theorem 5 increases with the increasing size of theconstant bounding
Deg ( α ).From the point of view of program analysis, Theorem 5 has a clear intuitive meaning.If A is an abstraction of a program P , then the constructs in P increasing the complexityof the asymptotic analysis of A are branching constructs such as if-then-else that are notembedded within loops . If P executes many such constructs in a sequence, a terminationpoint can be reached in many ways (“zigzags” in the P ’s control-flow graph). Since the asymptotic analysis of L is trivially reducible to the asymptotic analysis of C [ c ](see Section 2), all lower complexity bounds of Theorem 4 follow directly from the next twolemmata. ▶ Lemma 6.
Let k ≥ . For every propositional formula φ in 3-CNF there exists a demonicVASS A φ constructible in time polynomial in | φ | such thatif φ is satisfiable, then L A φ ∈ Θ( n k +1 ) ;if φ is not satisfiable, then L A φ ∈ Θ( n k ) . Proof.
Let φ ≡ C ∧ · · · ∧ C m be a propositional formula where every C i ≡ ℓ i ∨ ℓ i ∨ ℓ i is aclause with three literals over propositional variables X , . . . , X v (a literal is a propositionalvariable or its negation). We construct a VASS A φ with the counters . Ajdarów and A. Kučera 23:7 in out– x + α + z + x – α + z – yz += x ∗ y in out– y + x + α + y – αx += y in out– s i − – ℓ + s i + α + ℓ – αs i += min( ℓ, s i − )in in out in out out ins ins ins ; ins in in outin out out ins ins j choose: ins ; or · · · or ins j Figure 3
The gadgets of A φ . x , · · · , x v , ¯ x , · · · , ¯ x v used to encode an assignment of truth values to X , . . . , X v . In thefollowing, we identify literals ℓ ij of φ with their corresponding counters (i.e., if ℓ ij ≡ X u ,the corresponding counter is x u ; and if ℓ ij ≡ ¬ X u , the corresponding counter is ¯ x u ). s , . . . , s m used to encode the validity of clauses under the chosen assignment, f used to encode the (in)validity of φ under the chosen assignment, d , . . . , d k and e , . . . , e k − used to compute n k ,and some auxiliary counters used in gadgets.The structure of A φ is shown in VASS Program 1. The basic instructions are implementedby the gadgets of Fig. 3 (top). Counter changes associated to a given transition are indicatedby the corresponding labels, where − c and + c mean decrementing and incrementing a givencounter by one (the other counters are unchanged). Hence, the empty label represents nocounter change, i.e., the associated counter update vector is ⃗
0. The auxiliary counter α is unique for every instance of these gadgets and it is not modified anywhere else.The construct ins ; ins and choose: ins ; or · · · or ins j are implemented by connect-ing the underlying gadgets as shown in Fig. 3 (bottom). The foreach statements are justconcise representations of the corresponding sequences of instructions connected by ‘;’.Now suppose that the computation of VASS Program 1 is executed from line 1 where allcounters are initialized to n . One can easily verify that all gadgets implement the operationssuggested by their labels up to some “asymptotically irrelevant side effects”. More precisely,the z += x ∗ y gadget ensures that the Demon can increase the value of counter z by val ( x ) + val ( y ) · ( val ( x ) + n ) (but not more) if he plays optimally, where val ( x ) and val ( y )are the values stored in x and y when initiating the gadget. Recall that the counter α isunique for the gadget, and its initial value is n . Also note that the value of y is decreasedto 0 when the Demon strives to maximally increase the value of z .The x += y gadget ensures that the Demon can add val ( y ) to the counter x and then reset y to the value val ( y ) + n (but not more) if he plays optimally. Again, note that α is aunique counter for the gadget with initial value n .The s i += min( ℓ, s i − ) gadget allows the Demon to increase s i by the minimum of val ( ℓ )and val ( s i − ), and then restore ℓ to val ( ℓ ) + n (but not more).Now, the VASS Program 1 is easy to understand. We describe its execution under theassumption that the Demon plays optimally . It is easy to verify that the Demon cannot gainanything by deviating from the below described scenario where certain counters are pumped C V I T 2 0 1 6 to their maximal values (in particular, the auxiliary counters are never re-used outside theirgadgets, hence the Demon is not motivated to leave any positive values in them).By executing line 1, the Demon pumps the counter d k to the value Θ( n k ). Then, theDemon determines a truth assignment for every X i , where i ∈ { , . . . , v } , by pumping eitherthe counter x i or the counter ¯ x i to the value Θ( n k ). A key observation is that when thechosen assignment makes φ true, then every clause contains a literal such that the value ofits associated counter is Θ( n k ). Otherwise, there is a clause C i such that all of the threecounters corresponding to ℓ i , ℓ i , ℓ i have the value n . The Demon continues by pumping s to the value Θ( n k ) at line 5. Then, for every i = 1 , . . . , m , he selects a literal ℓ ij of C i andpumps s i to the minimum of val ( s i − ) and val ( ℓ ij ). Observe that val ( s i − ) is either Θ( n ) orΘ( n k ), and the same holds for val ( s i ) after executing the instruction. Hence, s m is pumpedeither to Θ( n k ) or Θ( n ), depending on whether the chosen assignment sets every clause totrue or not, respectively. Observe that the length of the whole computation up to line 9 isΘ( n k ), regardless whether the chosen assignment sets the formula φ to true or false. If s m was pumped to Θ( n k ), then the last instruction at line 9 can pump the counter f to Θ( n k +1 )in Θ( n k +1 ) transitions. Hence, if φ is satisfiable, the Demon can schedule a computation oflength Θ( n k +1 ). Otherwise, the length of the longest computation is Θ( n k ). Also observethat if the Demon starts executing A φ in some other control state (i.e., not in the firstinstruction of line 1), the maximal length of a computation is only shorter. ◀ Recall that the class DP consists of problems that are intersections of one problem in NP and another problem in coNP . The class DP is expected to be somewhat larger than NP ∪ coNP , and it is contained in the P NP level of the polynomial hierarchy. The standard DP -complete problem is Sat-Unsat , where an instance is a pair φ, ψ of propositionalformulae and the question is whether φ is satisfiable and ψ is unsatisfiable. Hence, the DP lower bounds of Theorem 4 follow directly from the next lemma (a proof is in Appendix B). ▶ Lemma 7.
Let k ≥ . For every pair φ, ψ of propositional formulae in 3-CNF there existsa demonic VASS A φ,ψ such that L A φ,ψ ∈ Θ( n k ) iff φ is satisfiable and ψ is unsatisfiable. The upper bounds of Theorem 4 are proven for C [ c ]. We need to consider a more generalsetting when the counters are not initialized to n but to values polynomial in n .Let A be a demonic VASS with d counters. For every counter c and every v ∈ N d , wedefine the function C [ c, v ] : N → N ∞ where C [ c, v ]( n ) is the maximum of all Cval [ c ]( p u )where p ∈ Q and u = ( n v (1) , . . . , n v ( d ) ). The main tool for proving the upper complexitybounds of this section is the following proposition: ▶ Proposition 8.
Let A be a strongly connected demonic VASS with d counters, and let v ∈ N d such that v ( i ) ≤ j · d for every i ≤ d , where j < | Q | . For every counter c , we havethat either C [ c, v ] ∈ Θ( n k ) for some ≤ k ≤ ( j +1) · d , or C [ c, v ] ∈ Ω(2 n ) . It is decidable inpolynomial time which of the two possibilities holds. In the first case, the k is computable inpolynomial time. In [18], a special variant of Proposition 8 covering the subcase when v = ⃗ v = ⃗ . Ajdarów and A. Kučera 23:9 To formulate the main result of this section, we extend the function C [ c, v ] so that v ∈ N d ∞ .Intuitively, the ∞ components of v correspond to counters that have already been pumpedto “very large” values and do not constrain the computations in A . As we shall see, “verylarge” actually means singly exponential in n .Let v ∈ N d ∞ , and let A v be the VASS obtained from A by modifying every counterupdate vector u into u ′ , where u ′ ( i ) = u ( i ) if v ( i ) ̸ = ∞ , otherwise u ′ ( i ) = 0. Hence, thecounters set to ∞ in v are never changed in A v . Furthermore, let v ′ be the vector obtainedfrom v by changing all ∞ components into 1. We put C A [ c, v ] = C A v [ c, v ′ ].For a given v ∈ N d ∞ , we say that F : N → N d is v -consistent if for every i ∈ { , . . . , d } wehave that the projection F i : N → N is either Θ( n k ) if v i = k , or 2 Ω( n ) if v i = ∞ . Intuitively,a v -consistent function assigns to every n ∈ N a vector F ( n ) of initial counter values growingconsistently with v .Given v ∈ N d ∞ , a control state p ∈ Q , a v -consistent function F , an infinite familyΠ = π , π , . . . of Demon’s strategies in A , a function S : N → N , and n ∈ N , we use β n [ v , p, F, Π , S ] to denote the computation of A starting at pF ( n ) obtained by applying π n until a maximal computation is produced or S ( n ) transitions are executed.The next lemma says that if A is strongly connected, then all counters can be pumped simultaneously to the values asymptotically equivalent to C A [ c, v ] so that the counterspreviously pumped to exponential values stay exponential. ▶ Lemma 9.
Let A be a strongly connected demonic VASS with d counters. Let v ∈ N d ∞ ,and let F be a v -consistent function. Then for every counter c i such that v i ̸ = ∞ and C A [ c i , v ] ∈ Θ( n k ) we have that Cval [ c ]( pF ( n )) ∈ Θ( n k ) for every p ∈ Q . Furthermore, thereexist p ∈ Q , an infinite family Π of Demon’s strategies, and a function S ∈ O ( n ) such thatfor every c i , the value of c i in the last configuration of β n [ v , p, F, Π , S ] is Θ( n k ) if C A [ c i , v ] ∈ Θ( n k ) ; Ω( n ) if v i = ∞ or C A [ c i , v ] ∈ Ω( n ) . A proof of Lemma 9 uses the result of [13] saying that counters pumpable to exponentialvalues can be simultaneously pumped by a computation of exponential length from aconfiguration where all counters are set to n (the same holds for polynomially boundedcounters, where the length of the computation can be bounded even by a polynomial). Usingthe construction of Proposition 8, these results are extended to our setting with v -consistentinitial counter values. Then, the initial counter values are virtually “split into d boxes” ofsize ⌊ v /d ⌋ . The computations pumping the individual counters are then run for these smallerinitial vectors and concatenated. The details are in Appendix B.3.Let V A : N d ∞ → N d ∞ be a function such that, for every v ∈ N d ∞ , V A ( v )( i ) = ( k if v i ̸ = ∞ and C A [ c i , v ] ∈ Θ( n k ), ∞ otherwise.Note that every SCC (vertex) η of D ( A ) can be seen as a strongly connected demonicVASS after deleting all transitions leading from/to the states outside η . If the counters aresimultaneously pumped to v -consistent values before entering η , then η can further pumpthe counters to V η ( v )-consistent values (see Lemma 9). According to Lemma 8, V η ( v ) iscomputable in polynomial time for every v ∈ N d ∞ where every finite v i is bounded by 2 j · d for some j < | Q | .Observe that all computations of A can be divided into finitely many pairwise disjointclasses according to their corresponding paths in D A (i.e., the sequence of visited SCCs of D A ). C V I T 2 0 1 6
For each such sequence η , . . . , η m , the vectors v , . . . , v m where v = ⃗ v i = V η i ( v i − )are computable in time polynomial in | A | (note that m ≤ | Q | ). The asymptotic growth ofthe counters achievable by computations following the path η , . . . , η m is then given by v m .Hence, C A [ c i ] ∈ Ω( n k ) iff there is a path η , . . . , η m in D A such that v m ( i ) ≥ k . Similarly, C A [ c i ] ∈ O ( n k ) iff for every path η , . . . , η m in D A we have that v m ( i ) ≤ k . From this weimmediately obtain the upper complexity bounds of Theorem 4.Furthermore, for every SCC η of D A , we can compute the set Vectors A ( η ) of all u suchthat there is a path η , . . . , η m where η is a root of D A , η m = η , and u = v m . The algorithmis given in Appendix B.4. If Deg ( η ) is bounded by a fixed constant independent of A for everyleaf η of D A , then the algorithm terminates in polynomial time, which proves Theorem 5. The computational complexity of polynomial asymptotic analysis for VASS games is classifiedin our next theorem. The parameter characterizing hard instances is identified at the end ofthis section. ▶ Theorem 10.
Let k ≥ . For every VASS game A we have that L is either in O ( n k ) orin Ω( n k +1 ) . Furthermore, the problem whether L ∈ O ( n k ) is NP -complete for k =1 and PSPACE -complete for k ≥ ; L ∈ Ω( n k ) is in P for k =1 , coNP -complete for k =2 , and PSPACE -complete for k ≥ ; L ∈ Θ( n k ) is NP -complete for k =1 and PSPACE -complete for k ≥ .The same results hold also for C [ c ] (for a given counter c of A ). Furthermore, we show that for every VASS game A , either L ∈ O ( n d | Q | ) or L ∈ Ω( n ) . Inthe first case, the k such that L ∈ Θ( n k ) can be computed in polynomial space. The sameresults hold for C [ c ].In [12], it has been shown that the problem whether L ∈ O ( n ) is NP -complete, and if L ̸∈ O ( n ), then L ∈ Ω( n ). This yields the NP and coNP bounds of Theorem 10 for k = 1 , L ∈ O ( n ) is PSPACE -hard, andthis proof can be trivially generalized to obtain all
PSPACE lower bounds of Theorem 10.For the sake of completeness, we sketch the arguments in Appendix C.The key insight behind the proof Theorem 10 is that player Angel can safely commit to a simple locking strategy when minimizing the counter complexity. We start by introducinglocking strategies. ▶ Definition 11.
Let A be a VASS game. We say that a strategy σ for player Angel is locking if for every computation p v , . . . , p m v m where p m ∈ Q A and for every k < m suchthat p k = p m we have that σ ( p v , . . . , p k v k ) = σ ( p v , . . . , p m v m ) . In other words, when an angelic control state p is visited for the first time, a lockingstrategy selects and “locks” an outgoing transition of p so that whenever p is revisited, thepreviously locked transition is taken. Observe that the choice of a “locked” transition maydepend on the whole history of a computation.Since a “locked” control state has only one outgoing transition, it can be seen as demonic .Hence, as more and more control states are locked along a computation, the VASS game A becomes “more and more demonic”. We capture these changes as a finite acyclic graph G A called the locking decomposition of A . Then, we say that a locking strategy is simple if thechoice of a locked transition after performing a given history depends only on the finite pathin G A associated to the history. We show that Angel can achieve an asymptotically optimal . Ajdarów and A. Kučera 23:11 termination/counter complexity just by using simple locking strategies. Since the height of G A is polynomial in | A | , the existence of an appropriate simple locking strategy for Angelcan be decided by an alternating polynomial-time algorithm. As AP = PSPACE , thisproves the
PSPACE upper bounds of Theorem 10. Furthermore, our construction identifiesthe structural parameters of G A making the polynomial asymptotic analysis of VASS gameshard. When these parameters are bounded by fixed constants, the problems of Theorem 10are solvable in polynomial time. Again, the parameters have a clear intuitive interpretation. A Let A be a VASS game. A Demonic decomposion of A is a finite directed graph D A definedas follows. Let ∼ ⊆ Q × Q be an equivalence where p ∼ q iff either p = q , or both p, q are demonic and mutually reachable from each other via a finite path leading only throughdemonic control states. The vertices of D A are the equivalence classes Q/ ∼ , and [ p ] → [ q ]iff [ p ] ̸ = [ q ] and ( p, u , q ) ∈ Tran for some u . For demonic VASS, D A becomes the standardDAG decomposition. For VASS games, D A is not necessarily acyclic.A locking set of A is a set of transitions L ⊆ Tran such that ( p, u , q ) ∈ L implies p ∈ Q A ,and ( p, u , q ) , ( p ′ , u ′ , q ′ ) ∈ L implies p ̸ = p ′ . A control state p is locked by L if L contains anoutgoing transition of p . We use L to denote the set of all locking sets of A . For every L ∈ L , let A L be the VASS game obtained from A by “locking” the transitions of L . Thatis, each control state p locked by L becomes demonic in A L , and the only outgoing transitionof p in A L is the transition ( p, u , q ) ∈ L . ▶ Definition 12.
The locking decomposition of A is a finite directed graph G A where theset of vertices and the set of edges of G A are the least sets V and → satisfying the followingconditions:All elements of V are pairs ([ p ] , L ) where L ∈ L and [ p ] is a vertex of D A L . When p isdemonic/angelic in A L , we say that ([ p ] , L ) is demonic/angelic. V contains all pairs of the form ([ p ] , ∅ ) .If ([ p ] , L ) ∈ V where p is demonic in A L and [ p ] → [ q ] is an edge of D A L , then ([ q ] , L ) ∈ V and ([ p ] , L ) → ([ q ] , L ) .If ([ p ] , L ) ∈ V where p is angelic in A L , then for every ( p, u , q ) ∈ Tran we have that ([ q ] , L ′ ) ∈ V and ([ p ] , L ) → ([ q ] , L ′ ) , where L ′ = L ∪ { ( p, u , q ) } . It is easy to see that G A is acyclic and the length of every path in G A is boundedby | Q | + | Q A | , where at most | Q | vertices in the path are demonic. Note that everycomputation of A obtained by applying a locking strategy determines its associated pathin G A in the natural way. A locking strategy σ is simple if for every finite computation p v , . . . , p m v m obtained by applying σ such that p m ∈ Q A and p k ̸ = p m for all k < m wehave that σ ( p v , . . . , p m v m ) depends only on the path in G A associated to p v , . . . , p m v m . Let A be a VASS game with d counters. For every p ∈ Q and v ∈ N d , let C p A [ c, v ]( n ) = Cval [ c ]( p u ) where u = ( n v (1) , . . . , n v ( d ) ). We extend this notation to the vectors v ∈ N d ∞ in the same way as in Section 3.2, i.e., for a given v ∈ N d ∞ , we put C p A [ c, v ] = C p A v [ c, v ′ ].Recall that v ′ is the vector obtained from v by changing all ∞ components into 1, and A v is the VASS obtained from A by modifying every counter update vector u into u ′ , where u ′ ( i ) = u ( i ) if v ( i ) ̸ = ∞ , otherwise u ′ ( i ) = 0. The main technical step towards obtaining the PSPACE upper bounds of Theorem 10 is the next proposition.
C V I T 2 0 1 6 ▶ Proposition 13.
Let A be a VASS game with d counters. Furthermore, let ([ p ] , L ) be avertex of G A , v ∈ N d ∞ , and c i a counter such that v i ̸ = ∞ . Then, one of the following twopossibilities holds:there is k ∈ N such that for every v -consistent F there exist a simple locking Angel’sstrategy σ v in A L and a Demon’s strategy π v in A L such that σ v is independent of F andfor every Demon’s strategy π in A L , we have that max [ c i ]( Comp σ v ,π A L ( p F ( n ))) ∈ O ( n k ) ;for every Angel’s strategy σ in A L , we have that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n k ) .for every v -consistent F there is a Demon’s strategy π v in A L such that for every Angel’sstrategy σ in A L , we have that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n ) . Proposition 13 is proven by induction on the height of the subgraph rooted by ([ p ] , L ).The case when ([ p ] , L ) is demonic (which includes the base case when ([ p ] , L ) is a leaf) followsfrom the constructions used in the proof of Proposition 8. When the vertex ([ p ] , L ) is angelic,it has immediate successors of the form ([ q i ] , L i ) where L i = L ∪ { ( p, u i , q i ) } . We show thatby locking one of the ( p, u i , q i ) transitions in p , Angel can minimize the growth of c i inasymptotically the same way as if he used all of these transitions freely when revisiting p .Observe that every computation in A where Angel uses some simple locking strategydetermines the unique corresponding path in G A (initiated in a vertex of the form ([ p ] , ∅ )) inthe natural way. Hence, all such computations can be divided into finitely many pairwisedisjoint classes according to their corresponding paths in G A . Let ([ p ] , L ) , . . . , ([ p k ] , L k ) bea path in G A where L = ∅ . Consider the corresponding sequence v , . . . , v k where v = ⃗ v i is equal either to V [ p i ] ( v i − ) or to v i − , depending on whether ([ p i ] , L i ) is demonicor angelic, respectively. Here, V is the function defined in Section 3.2 (observe that thecomponent [ p ] of D A L containing p can be seen as a strongly connected demonic VASS afterdeleting all transitions from/to the states outside [ p ]). The vector v k describes the maximalasymptotic growth of the counters achievable by the Demon when the Angel uses the simplelocking strategy associated to the path. Furthermore, the sequence v , . . . , v k is computablein time polynomial in | A | and all finite components of v k are bounded by 2 d ·| Q | because thetotal number of all demonic ([ p i ] , L i ) in the path is bounded by | Q | (cf. Proposition 8).The problem whether C [ c i ] ∈ O ( n k ) can be decided by an alternating polynomial-time algorithm which selects an initial vertex of the form ([ p ] , ∅ ) universally, and thenconstructs a maximal path in G A from ([ p ] , ∅ ) where the successors of demonic/angelicvertices are chosen universally/existentially, respectively. After obtaining a maximal path([ p ] , L ) , . . . , ([ p k ] , L k ), the vector v k is computed in polynomial time, and the algorithmanswers yes/no depending on whether v k ( i ) ≤ k or not, respectively. The problem whether C [ c i ] ∈ Ω( n k ) is decided similarly, but here the initial vertex is chosen existentially, thesuccessors of demonic/angelic vertices are chosen existentially/universally, and the algorithmanswers yes/no depending on whether v k ( i ) ≥ k or not, respectively. This proves the PSPACE upper bounds of Theorem 10.Observe that the crucial parameter influencing the computational hardness of the asymp-totic analysis for VASS games is the number of maximal paths in G A . If | Q A | and Deg ([ p ] , L )are bounded by constants, then the above alternating polynomial time algorithms can besimulated by deterministic polynomial time algorithms. Thus, we obtain the following: ▶ Theorem 14.
Let Λ be a class of VASS games such that for every A ∈ Λ we have that | Q A | and Deg ([ p ] , L ) , where ([ p ] , L ) is a leaf of G A , are bounded by a fixed constant dependingonly on Λ . Then, the problems whether L A ∈ O ( n k ) , L A ∈ Ω( n k ) , L A ∈ Θ( n k ) for given A ∈ Λ and k ∈ N , are solvable in polynomial time (where the k is written in binary). Thesame results hold also for C [ c ] (for a given counter c of A ). . Ajdarów and A. Kučera 23:13 References E. Albert, P. Arenas, S. Genaim, M. Gómez-Zamalloa, G. Puebla, D. V. Ramírez-Deantes,G. Román-Díez, and D. Zanardini. Termination and cost analysis with COSTA and its userinterfaces.
ENTCS , 258(1):109–121, 2009. C. Alias, A. Darte, P. Feautrier, and L. Gonnord. Multi-dimensional rankings, programtermination, and complexity bounds of flowchart programs. In
Proceedings of SAS 2010 , pages117–133, 2010. T. Brázdil, K. Chatterjee, A. Kučera, P. Novotný, and D. Velan. Deciding fast terminationfor probabilistic VASS with nondeterminism. In
Proceedings of ATVA 2019 , volume 11781 of
LNCS , pages 462–478. Springer, 2019. T. Brázdil, K. Chatterjee, A. Kučera, P. Novotný, D. Velan, and F. Zuleger. Efficient algorithmsfor asymptotic bounds on termination time in VASS. In
Proceedings of LICS 2018 , pages185–194. ACM Press, 2018. M. Broy and M. Wirsing. On the algebraic specification of nondeterministic programminglanguages. In
Proceedings of CAAP’81 , volume 112 of
LNCS , pages 162–179. Springer, 1981. Q. Carbonneaux, J. Hoffmann, T. W. Reps, and Z. Shao. Automated resource analysis withcoq proof objects. In
Proceedings of CAV 2017 , pages 64–85, 2017. W. Czerwiński, S. Lasota, R. Lazić, J. Leroux, and F. Mazowiecki. The reachability problemfor Petri nets is not elementary. In
Proceedings of STOC 2019 , pages 24–33. ACM Press, 2019. A. F.-Montoya and R. Hähnle. Resource analysis of complex programs with cost equations. In
Proceedings of APLAS 2014 , pages 275–295, 2014. J. Giesl, C. Aschermann, M. Brockschmidt, F. Emmes, F. Frohn, C. Fuhs, J. Hensel, C. Otto,M. Plücker, P. Schneider-Kamp, T. Ströder, S. Swiderski, and R. Thiemann. Analyzing programtermination and complexity automatically with aprove.
J. Autom. Reasoning , 58(1):3–31,2017. S. Gulwani, K. K. Mehra, and T. M. Chilimbi. SPEED: precise and efficient static estimationof program computational complexity. In
Proceedings of POPL 2009 , pages 127–139, 2009. J. Hoffmann, K. Aehlig, and M. Hofmann. Multivariate amortized resource analysis.
ACMTrans. Program. Lang. Syst. , 34(3):14:1–14:62, 2012. A. Kučera, J. Leroux, and D. Velan. Efficient analysis of VASS termination complexity. In
Proceedings of LICS 2020 , pages 676–688. ACM Press, 2020. J. Leroux. Polynomial vector addition systems with states. In
Proceedings of ICALP 2018 ,volume 107 of
LIPIcs , pages 134:1–134:13. Schloss Dagstuhl, 2018. R. Lipton. The reachability problem requires exponential space. Technical report 62, YaleUniversity, 1976. E.W. Mayr and A.R. Meyer. The complexity of the finite containment problem for Petri nets.
JACM , 28(3):561–576, 1981. M. Sinn, F. Zuleger, and H. Veith. A simple and scalable static analysis for bound analysisand amortized complexity analysis. In
Proccedings of CAV 2014 , pages 745–761, 2014. M. Sinn, F. Zuleger, and H. Veith. Complexity and resource bound analysis of imperativeprograms using difference constraints.
J. Autom. Reasoning , 59(1):3–45, 2017. F. Zuleger. The polynomial complexity of vector addition systems with states. In
Proceedingsof FoSSaCS 2020 , volume 12077 of
LNCS , pages 622–641. Springer, 2020.
C V I T 2 0 1 6
A The Existence of Equilibrium Value in VASS Games
In this section, we sketch a proof for the equalitiessup π inf σ len ( Comp σ,π ( p v )) = inf σ sup π len ( Comp σ,π ( p v ))sup π inf σ max [ c ]( Comp σ,π ( p v )) = inf σ sup π max [ c ]( Comp σ,π ( p v ))used in Section 2. These results appear folklore and plausible. Still, they do not immediatelyfollow from the standard determinacy results for Borel objectives because the reward functionis not bounded. Due to the importance of these equalities, we believe they are worth a proofsketch.We prove the determinacy result for arbitrary finitely-branching games with countablymany vertices. Consider a game G = ( V, → , c ) where V is a countably infinite set of verticespartitioned into the subsets V D and V A of demonic and angelic vertices, → ⊆ V × V is afinitely-branching transition relation (i.e., every vertex v has only finitely many immediatesuccessors), and c : V → N is a cost function. Furthermore, we fix an initial vertex ˆ v . Forevery maximal path α initiated in ˆ v , let max [ c ]( α ) be the supremum of the costs of all verticesvisited by α . We show thatsup π inf σ max [ c ]( α σ,π ) = inf σ sup π max [ c ]( α σ,π )where π and σ range over the strategies for Demon/Angel in G , and α σ,π is the uniquemaximal path initiated in ˆ v determined by π and σ .Let Γ : N V ∞ → N V ∞ be a (Bellman) operator such that, for a given f : V → N ∞ , we havethat Γ( f ) = g , where g : V → N ∞ is defined as follows: g ( v ) = ( max (cid:8) c ( v ) , max { c ( u ) | v → u } (cid:9) if v ∈ V D max (cid:8) c ( v ) , min { c ( u ) | v → u } (cid:9) if v ∈ V A Since Γ is a continuous operator over the CPO of all functions V → N ∞ with component-wiseordering, there is the least fixed-point µ Γ = F ∞ i =0 Γ i ( ⊥ ) of Γ, where ⊥ is the least element(i.e., a function assigning 0 to every vertex). Consider two memoryless strategies π ∗ and σ ∗ for Demon and Angel such thatfor every v ∈ V D , the strategy π ∗ selects a successor of v with the maximal µ Γ value;for every v ∈ V A , the strategy σ ∗ selects a successor of v with the minimal µ Γ value.Now, it suffices to show that µ Γ(ˆ v ) ≤ sup π inf σ max [ c ]( α σ,π ) ≤ inf σ sup π max [ c ]( α σ,π ) ≤ µ Γ(ˆ v ) (3)The second inequality of (3) holds trivially. For the first inequality, observe thatinf σ max [ c ]( α σ,π ∗ ) ≤ sup π inf σ max [ c ]( α σ,π )Hence, it suffices to show µ Γ(ˆ v ) ≤ inf σ max [ c ]( α σ,π ∗ ), which is achieved by demonstratingΓ i ( ⊥ )(ˆ v ) ≤ inf σ max [ c ]( α σ,π ∗ ) for every i ∈ N (by induction on i ). The last inequality in (3)is proven similarly (using σ ∗ ). . Ajdarów and A. Kučera 23:15 VASS Program 2 A φ,ψ lines 1–8 of A φ constructed for k − lines 1–8 of A ψ constructed for k −
1; /* all counters are fresh */ a += s ( A φ ); b += s ( A ψ ); e += a ∗ b ; /* a, b, e are fresh counters */ c += s ( A ψ ); d += s ( A ψ ); f += c ∗ d ; /* c, d, f are fresh counters */ B Proofs for Section 3B.1 A proof of Lemma 7 ▶ Lemma 7.
Let k ≥ . For every pair φ, ψ of propositional formulae in 3-CNF there existsa demonic VASS A φ,ψ such that L A φ,ψ ∈ Θ( n k ) iff φ is satisfiable and ψ is unsatisfiable. Proof.
The structure of A φ,ψ is given by the VASS Program 2. The program starts byexecuting the first eight lines of the VASS Program 1 constructed for φ and k −
1, followedby the first eight lines of the same program constructed for ψ and k − n k − ) transitions when executing the first two lines of the VASSProgram 2 regardless whether the formulae φ, ψ are satisfiable or not. Let s ( A φ ) and s ( A ψ )be the counters of A φ and A ψ corresponding to the counter s m of the VASS Program 1.According to Lemma 1, we have the following:If φ is satisfiable, then the counter s ( A φ ) can be pumped to Θ( n k − ); otherwise, it canbe pumped only to Θ( n ).If ψ is satisfiable, then the counter s ( A ψ ) can be pumped to Θ( n k − ); otherwise, it canbe pumped only to Θ( n ).The instructions at lines 3 and 4 ensure that L A φ,ψ ∈ Θ( n k ) iff the counter s ( A φ ) can bepumped to Θ( n k − ) and the counter s ( A ψ ) can be pumped only to Θ( n ). More precisely,the instructions at line 3 multiply the values of these two counters. Hence, if both values areΘ( n k − ), the multiplication gadget executes Θ( n k − ) transitions, which is beyond Θ( n k ). Ifone of the counter values is Θ( n ) and the other is Θ( n k − ), the multiplication takes Θ( n k )transitions. Finally, if both values are Θ( n ), the multiplication takes Θ( n ) transitions. Theinstructions at line 4 compute the square of the value stored in s ( A ψ ), which takes eitherΘ( n k − ) or Θ( n ) transitions, depending on whether the value of s ( A ψ ) is Θ( n k − ) or Θ( n ),respectively. So, the only case when these instructions produce a sequence of transitions oflength Θ( n k ) is when the value of s ( A φ ) is Θ( n k − ) and the value of s ( A ψ ) is Θ( n ). ◀ B.2 A proof of Proposition 8
In this section we give a full proof of Proposition 8. We start by recalling the special variantproven in [18]. ▶ Proposition 15 (see [18]) . Let A be a strongly connected demonic VASS with d counters.For every counter c , we have that either C [ c ] ∈ Θ( n k ) for some ≤ k ≤ d , or C [ c ] ∈ Ω(2 n ) .It is decidable in polynomial time which of the two possibilities holds. In the first case, the k is computable in polynomial time. Our proof of Proposition 8 is obtained by modifying a given demonic VASS A into anotherdemonic VASS ˆ A and applying Proposition 15 to ˆ A . C V I T 2 0 1 6 ▶ Proposition 8.
Let A be a strongly connected demonic VASS with d counters, and let v ∈ N d such that v ( i ) ≤ j · d for every i ≤ d , where j < | Q | . For every counter c , we havethat either C [ c, v ] ∈ Θ( n k ) for some ≤ k ≤ ( j +1) · d , or C [ c, v ] ∈ Ω(2 n ) . It is decidable inpolynomial time which of the two possibilities holds. In the first case, the k is computable inpolynomial time. Proof.
Let c , . . . , c d be the counters of A . We start by constructing a VASS B that “pumps”every c i to n v ( i ) from an initial configuration with all counters set to n (see VASS Program 3).Since the components of v can be exponential in d , the trivial technique used in line 1 ofVASS Program 1 is not applicable because it requires Ω(2 j · d ) new counters and control states.Hence, B needs to be constructed more carefully using repeated squaring. Let max v be themaximal component of v , and let ℓ = ⌊ log(max v ) ⌋ . Then, for every 1 ≤ i ≤ d , there is avector ⃗t i ∈ { , } ℓ +1 computable in time polynomial in | A | such that v ( i ) = ⃗t i ∗ (2 , . . . , ℓ ).At line 2, the counter m j is pumped to Θ( n j ). Note that when maximizing the value of m j , the corresponding gadget (see Fig. 3) leaves 0 either in m j − or in α , and the valueof both counters is at most 1. The nested loop at lines 3–5 increase the counter s j by ⃗t i ∗ (2 , . . . , ℓ ) for every j = 1 , . . . , d using the m i counters. Note that s is initialized to n ,so no computation is needed for j = 0. Also note that the if statement at line 4 is purelysymbolic—the condition ⃗t i ( j ) = 1 is a constant denoting either true or false, and the twoinstructions following then are either included into the code of B or not. At lines 7–9, thevalues stored in s , . . . , s d are added to the counters c , . . . , c d . The gadget for the instruction x += [ y ] “reads” the value of y destructively, i.e., the counter y is not restored to its originalvalue (cf. the gadget for x += y of Fig. 3).Note that the VASS B has two distinguished control states in and out , and uses κ auxiliarycounters different from c , . . . , c d . Hence, the total number of counters of B is d + κ . Thetransition update vectors of B are constructed so that the first d components specify theupdates for c , . . . , c d . An important observation is that even if we extended B with atransition ( out ,⃗ , in ) allowing for “restarting” the computation of B , this extra transitionwould be of no use when maximizing the values of c , . . . , c ℓ . The best the Demon could dois to maximize the value of all m j , then maximize all s i , and then empty s i by transferringits content to c i . If the Demon violated from this scenario, leaving some positive values inthe auxiliary counters of B and then “restarting” the computation of B using the transition( out ,⃗ , in ), the resulting value of c , . . . , c ℓ would be only smaller.Now we construct a VASS U with d + κ counters by taking the union of A and B , wherethe transition update vectors of A are extended so that they do not modify the extra κ counters of B . Furthermore, for every control state p of A , we add to U the transitions( p, − ⃗m, in ) and ( out , − ⃗m, p ). Here, m = | Q | · M , where M is the maximal absolute valueof an update vector component in A . Observe that U is strongly connected and its size ispolynomial in the size of A .We show that for every c i , where i ∈ { , . . . , d } , the asymptotic growth of C [ c i ] in U isthe same as the asymptotic growth of C [ c i , v ] in A . Hence, it suffices to apply Proposition 15to U .Clearly, C A [ c i , v ] ∈ O ( C U [ c i ]) because U can use the sub-VASS B to pump every c j toΘ( n v ( j ) ) and then simulate a computation of A . It remains to show C U [ c i ] ∈ O ( C A [ c i , v ]).To see this, it suffices to verify that the best strategy for the Demon who aims at maximizingthe value of c i in a computation of U initiated in a configuration with all counters set to n isto start in the in state of the sub-VASS B and pump all c , . . . , c d to their maximal values,and then continue by simulating A without ever returning to the in state of the sub-VASS B .Such a computation can be “simulated” by A from an initial configuration where every c j is . Ajdarów and A. Kučera 23:17 VASS Program 3
The “pumping” VASS B foreach j = 1 , . . . , ℓ do m j += m j − ∗ m j − ; foreach i = 1 , . . . , d do if ⃗t i ( j ) = 1 then a ( i, j ) += s j ; s j += m j ∗ a ( i, j ); end end foreach i = 1 , . . . , d do c i += [ s i ]; in out– y + x x += [ y ] end set to n v ( j ) , which proves our claim.Obviously, an extra “detour” to B is of no use if the counters c , . . . , c d have previouslybeen pumped to their maximal values. As noted above, the Demon cannot gain anything bydeviating from the scenario when c , . . . , c d are pumped just once at the beginning becausethe total increase in the values of c , . . . , c d brought by running the sub-VASS B could beonly smaller. So, the only reason why Demon might still wish to re-visit B by entering in from a control state p of the sub-VASS A is a “shorter” path to some other control state q ofthe sub-VASS A passing through the sub-VASS B . However, since A is strongly connected,the Demon can always move from p to q via the control states of A and the total decrease inevery counter will be only smaller than the decrease caused by the transitions ( p, − ⃗m, in )and ( out , − ⃗m, q ). To sum up, the optimal strategy for Demon is to use the sub-VASS B only at the beginning to pump all c , . . . , c d to their maximal values, and then schedule anappropriate computation of the sub-VASS A . ◀ B.3 A Proof of Lemma 9
First, let us restate Lemma 9. ▶ Lemma 9.
Let A be a strongly connected demonic VASS with d counters. Let v ∈ N d ∞ ,and let F be a v -consistent function. Then for every counter c i such that v i ̸ = ∞ and C A [ c i , v ] ∈ Θ( n k ) we have that Cval [ c ]( pF ( n )) ∈ Θ( n k ) for every p ∈ Q . Furthermore, thereexist p ∈ Q , an infinite family Π of Demon’s strategies, and a function S ∈ O ( n ) such thatfor every c i , the value of c i in the last configuration of β n [ v , p, F, Π , S ] is Θ( n k ) if C A [ c i , v ] ∈ Θ( n k ) ; Ω( n ) if v i = ∞ or C A [ c i , v ] ∈ Ω( n ) . Let A be a strongly connected VASS. For every cycle γ of A , let ∆( γ ) be the sum of thecounter update vectors of the transitions executed along γ .A proof of Lemma 9 uses the following result of [13]. Let E be the set of all counters c such that C A [ c ] ∈ Ω( n ) . Then the exists in iteration scheme for E , i.e., a sequence ofcycles γ , . . . , γ k such that every counter strictly decremented by some ∆( γ i ) is strictlyincremented by P ki =1 ∆( γ i ). Furthermore, E is precisely the set of all counters strictlyincremented by P ki =1 ∆( γ i ). In [13], it is shown that an iteration scheme can be “iteratedexponentially many times”, producing a computation of length 2 O ( n ) such that all counters of E are simultaneously pumped to the value 2 Ω( n ) (see Lemma 10 in [13]). Furthermore, everycounter c such that C A [ c ] ∈ O ( n k ) can be pumped to the value Ω( n k ) by a computationof polynomial length (using the results of [18], it is easy to show that the length of the C V I T 2 0 1 6 computation can be bounded by O ( n k +1 ); for our purposes, even a singly exponential boundis sufficient, so there is no need to go into the details).The above mentioned results assume that the vector of initial counter values is ⃗n . Now let v ∈ N d ∞ . Consider a VASS ˆ A v obtained by first modifying A into A v (i.e., for every c i suchthat v i = ∞ , every counter update vector u of A is modified so that u i = 0, see Section 3.2),and then extending A v into ˆ A v by the construction of Proposition 8. That is, ˆ A v is obtainedfrom A v by adding the gadget pumping every counter c i such the v i = k < ∞ to Θ( n k ) froman initial configuration where all counters are set to n . Now, the above results are applicableto ˆ A v . That is, for every counter c i such that v i ̸ = ∞ , there exista control state p i ∈ Q ,an infinite family τ i , τ i , . . . of strategies for player Demon in ˆ A v ,a function S i : N → N such that S i ∈ O ( n ) ,such that for every n ∈ N , the value of c i in the configuration reached by applying τ in from p i ⃗n until a maximal computation is obtained or S i ( n ) transitions are executed, isΘ( n k ) if C ˆ A v [ c ] ∈ Θ( n k ),2 Ω( n ) if C ˆ A v [ c ] ∈ Ω( n ) .By applying the observations of Proposition 8, we can safely assume that p i = in where in is the distinguished starting state of the pumping gadget, and the above computationsnever revisit the control state in after passing through the control state out of the gadget.For every i ∈ { , . . . , d } , let Gadget i ( n ) be the maximal value of c i achievable by runningthe pumping gadget of ˆ A v from the control state in where all counters are initialized to n (cf. VASS Program 3). Recall that Gadget i ( n ) ∈ Θ( n v i ).Let F be a v -consistent function. We define a function R : N → N such that R ( n ) is thelargest m satisfying the following conditions: ⌊ F i ( n ) /d ⌋ ) ≥ Gadget i ( m ) + | Q | · M for every i ∈ { , . . . , d } , where Q are the controlstates of A and M is the maximal absolute value of an update vector component of A ; S i ( m ) · M ≤ ⌊ F i ( n ) / ( d +1) ⌋ .Observe that R ∈ Θ( n ). For every n ∈ N and i ∈ { , . . . , d } such that v i ̸ = ∞ , considera Demon’s strategy ϱ in in A defined as follows: Let q be the control state visited by thestrategy τ iR ( n ) right after leaving the control state out of the pumping gadget of ˆ A v . Thestrategy ϱ in takes the shortest path to q and then starts to behave exactly like τ iR ( n ) . Notethat ϱ in can faithfully simulate τ iR ( n ) for at least S i ( R ( n )) steps, which is sufficient to pumpthe counter c i to Θ( n k ) if C v [ c i ] ∈ Θ( n k ), or to 2 Ω( n ) if C v [ c i ] ∈ Ω( n ) . The strategy π n is obtained by “concatenating” all ϱ in (for all counters c i such that v i ̸ = ∞ ), where ϱ in is executed for S i ( R ( n )) steps since initiating the simulation of τ iR ( n ) (if τ iR ( n ) produces amaximal computation, the simulation of τ iR ( n ) by ϱ in terminates immediately). Hence, thetotal length of the whole simulation is bounded by S ( n ) = P i, v i ̸ = ∞ ( | Q | + S i ( R ( n )). Observethat S ( n ) ∈ O ( n ) , and for every counter c i such that v i = ∞ we have that the value of c i after performing π n in the above indicated way is at least ⌊ F i ( n ) / ( d +1) ⌋ , which is 2 Ω( n ) . B.4 An Algorithm Computing
Vectors A In this section, we present an algorithm computing the set
Vectors A ( η ) for every SCC η of D A . Recall that Vectors A ( η ) consists of all u such that there is a path η , . . . , η m where η is a root of D A , η m = η , and u = v m . . Ajdarów and A. Kučera 23:19 Algorithm 4
Computing the function
Vectors A input : A Demonic decomposition D ( A ) of a demonic VASS A output : The function
Vectors A foreach vertex µ of D ( A ) do Vectors A ( µ ) := ∅ end Aux := the set of all vertices of D ( A ) foreach η ∈ Aux where η is a root of D ( A ) do Vectors A ( η ) := { V η ( ⃗ } Aux := Aux ∖ { η } end while Aux ̸ = ∅ do η := an element of Aux such that
Pre ( η ) ∩ Aux = ∅ Aux := Aux ∖ { η } foreach µ ∈ Pre ( η ) do foreach v ∈ Vectors A ( µ ) do Vectors A ( η ) := Vectors A ( η ) ∪ { V η ( v ) } end end end The sets
Vectors A ( η ) are computed by Algorithm 4. In particular, at lines 5–8, Vectors A ( η )is set to V η ( ⃗
1) for every root η of D ( A ). The algorithm then follows the top-down acyclicstructure of D ( A ) and computes Vectors A ( η ) for the remaining components. C Proofs for Section 4C.1
PSPACE lower bounds of Theorem 10
In this section, we prove the
PSPACE lower bounds of Theorem 10. We use a modifiedconstruction of Lemma 6 to obtain a reduction from the QBF problem. Intuitively, theonly change is that Angel determines the assignment for universally quantified propositionalvariables. Let us note that in the original construction of [12], Angel also selected the clauseto be checked. Here, we use the construction of Lemma 6 based on the min gadgets. Let ψ ≡ ∀ x ∃ y ∀ x . . . ∃ y v C ∧ . . . ∧ C m be a quantified Boolean formula where each clause C i contains precisely three literals (recallthat the (in)validity of a given quantified Boolean formula is a PSPACE complete problem).Consider the VASS game A ψ defined by the VASS Program 5, where k ≥ A ψ and the demonic VASS A φ (cf. the VASS Program 1)is that the valuation for the universally quantified variables is chosen by Angel. Formally,the gadget for D- choose is the same as the one for choose (see (Fig. 3), and the gadgetfor A- choose is also the same except that the newly added in state of the gadget is angelic.Note that all other states of A ψ , including the states in gadgets pumping the x i , y i counters,are demonic. Using the observations of Lemma 6, it is easy to see thatif ψ is valid, then L A ψ ∈ Θ( n k +1 );if ψ is not valid, then L A ψ ∈ Θ( n k ).From this we immediately obtain the PSPACE lower bounds of Theorem 10.
C V I T 2 0 1 6
VASS Program 5 A ψ d += d ∗ e ; d += d ∗ e ; · · · ; d k += d k − ∗ e k − ; foreach i = 1 , . . . , v do A- choose: x i += d k or ¯ x i += d k ; D- choose: y i += d k or ¯ y i += d k ; end s += d k ; foreach i = 1 , . . . , m do D- choose: s i += min( ℓ i , s i − ) or s i += min( ℓ i , s i − ) or s i += min( ℓ i , s i − ); end f += s m ∗ n C.2 A Proof of Proposition 13
First, let us restate the proposition. ▶ Proposition 13.
Let A be a VASS game with d counters. Furthermore, let ([ p ] , L ) be avertex of G A , v ∈ N d ∞ , and c i a counter such that v i ̸ = ∞ . Then, one of the following twopossibilities holds:there is k ∈ N such that for every v -consistent F there exist a simple locking Angel’sstrategy σ v in A L and a Demon’s strategy π v in A L such that σ v is independent of F andfor every Demon’s strategy π in A L , we have that max [ c i ]( Comp σ v ,π A L ( p F ( n ))) ∈ O ( n k ) ;for every Angel’s strategy σ in A L , we have that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n k ) .for every v -consistent F there is a Demon’s strategy π v in A L such that for every Angel’sstrategy σ in A L , we have that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n ) . Convention.
For notation simplification, we assume that the counter update vector u inevery transition ( p, u , q ) where p is angelic satisfies u = ⃗ p, u , q ) where u ̸ = ⃗ p,⃗ , q ′ ), ( q ′ , u , q ) where q ′ is a fresh demonic state).Let us fix a vertex ([ p ] , L ) of G A , a vector v ∈ N d ∞ , and a counter c i such that v i ̸ = ∞ .First, consider the case when ([ p ] , L ) is a leaf of G A . Then ([ p ] , L ) is demonic, and can beseen as a strongly connected demonic VASS. The claim follows trivially by applying Lemma 9to ([ p ] , L ) and v .Now suppose that ([ p ] , L ) is a demonic vertex of G A with successors ([ q ] , L ) , . . . , ([ q m ] , L ).Note that ([ p ] , L ) can be seen as a strongly connected demonic VASS after deleting alltransitions from/to the states outside ([ p ] , L ). Let F be a v -consistent function. By applyingLemma 9 to ([ p ] , L ), the vector v , and F , we obtain an infinite family of Demon’s strategies Πand a function S ∈ O ( n ) such that the vector G ( n ) of counter values in the last configurationof β n [ v , p, F, Π , S ] satisfies the following for every ℓ ∈ { , . . . , d } : G ℓ ( n ) ∈ Θ( n k ) if v ℓ ̸ = ∞ and C p ([ p ] ,L ) [ c ℓ , v ] ∈ Θ( n k ); G ℓ ( n ) ∈ Ω( n ) if v ℓ = ∞ or C p ([ p ] ,L ) [ c ℓ , v ] ∈ Ω( n ) .Let u = V ([ p ] ,L ) ( v ), where V is the function defined in Section 3.2. Note that G is a u -consistent function. If u i = ∞ , we define π v as the strategy which behaves like the strategy π n of Π for every computation of A L initiated in p F ( n )). Clearly, max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n ) for every Angel’s strategy σ . If u i ̸ = ∞ , for every j ∈ { , . . . , m } we apply the inductionhypothesis to ([ q j ] , L ), the vector u , the counter c i , and the u -consistent function G . Thus,we obtain that for every j ∈ { , . . . , m } one of the following possibilities holds: . Ajdarów and A. Kučera 23:21 There exists a k j ∈ N , a simple locking Angel’s strategy σ j u in A L and a Demon’s strategy π j u in A L such that σ j u is independent of G andfor every Demon’s strategy π in A L , we have max [ c i ]( Comp σ j u ,π A L ( q j G ( n ))) ∈ O ( n k j );for every Angel’s strategy σ in A L j , we have max [ c i ]( Comp σ,π j u A L ( q j G ( n ))) ∈ Ω( n k j ).There is a Demon’s strategy π j u in A L such that for every Angel’s strategy σ in A L wehave that max [ c i ]( Comp σ,π j u A L ( q j G ( n ))) ∈ Ω( n ) .We distinguish two cases:There is j ∈ { , . . . , m } such that the second possibility holds. Let π v be a Demon’sstrategy such that, for an initial configuration p F ( n ), π v starts by simulating the strategy π n of Π until a configuration with the G ( n ) vector of counter values is reached. Then, π v takes the shortest path to a configuration q j w , and then switches to simulating π j u forthe initial configuration q j G ( n ′ ) where n ′ ∈ N is the largest number such that G ( n ′ ) ≤ w .The properties of π j u (see above) imply that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n ) for anarbitrary Angel’s strategy σ .For all j ∈ { , . . . , m } , the first possibility holds. Let k be the maximum of all k j for j ∈ { , . . . , m } . Furthermore, let σ v be a simple locking strategy which for a computationinitiated in p F ( n ) behaves like the simple locking strategy σ j u when the computationenters a control state of ([ q j ] , L ). Note that a computation initiated in p F ( n ) cannot visitan angelic control state before leaving the component ([ p ] , L ), and the decisions taken bysimple locking strategies may depend on the sequence of previously visited componentsof G A . Hence, σ v is a simple locking strategy. For every Demon’s strategy π , we havethat max [ c i ]( Comp σ v ,π A L ( p F ( n ))) ∈ O ( n k ) by our choice of k and the properties of σ j u strategies (see above). Now consider the Demon’s strategy π v defined in the same way asin the previous case, where j is the index such that k = k j . Then, the properties of π j u imply that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n k ) for an arbitrary Angel’s strategy σ .Finally, suppose that ([ p ] , L ) is angelic. Then [ p ] = { p } , and let ( p,⃗ , q ) , . . . , ( p,⃗ , q m )be the outgoing transitions of p (see the Convention above). For every j ∈ { , . . . , m } , let L j = L ∪ { ( p,⃗ , q j ) } . Let F be a v -consistent function. By induction hypothesis, for every j ∈ { , . . . , m } , one of the following possibilities holds:there exists a k j ∈ N , a simple locking Angel’s strategy σ j v in A L j and a Demon’s strategy π j v in A L j such that σ j v is independent of F andfor every Demon’s strategy π j in A L j , we have max [ c i ]( Comp σ j v ,π j A Lj ( p F ( n ))) ∈ O ( n k j );for every Angel’s strategy σ j in A L j , we have max [ c i ]( Comp σ j ,π j v A Lj ( p F ( n ))) ∈ Ω( n k j ).there is a Demon’s strategy π j v in A L j such that for every Angel’s strategy σ j in A L j wehave that max [ c i ]( Comp σ j ,π j v A Lj ( p F ( n ))) ∈ Ω( n ) .Strictly speaking, the induction hypothesis applies to the initial configurations q j F ( n ), butsince p is a control state of A L j and ( p,⃗ , q j ) is the only out-going transition of p in A L j ,the above claim follows immediately.Let us first assume that there exists j such that the first possibility holds. Then, wefix a j such that k j is minimal, and we put k = k j . Consider a simple locking strategy σ v in A L which starts by locking the transition ( p,⃗ , q j ) and then proceeds by simulating thesimple locking strategy σ j v . For every Demon’s strategy π , we have that Comp σ v ,π A L ( p F ( n ))is the same computation as Comp σ j v ,π A Lj ( p F ( n )). Hence, max [ c i ]( Comp σ v ,π A L ( p F ( n ))) ∈ O ( n k )by induction hypothesis. C V I T 2 0 1 6
Now consider a Demon’s strategy π v in A L defined as follows. Let q v , . . . , q ℓ v ℓ be acomputation in A L initiated in a configuration p F ( n ) such that q ℓ is demonic. Furthermore,let α ≡ q u −→ q u −→ · · · u ℓ − −−−→ q ℓ be the associated path in A L . The mode of α is the j such that ( p,⃗ , q j ) is the last outgoing transition of p occurring in α . The j -th projection of π , denoted by π j , is then obtained by concatenating all subsequences of α initiated by thetransition ( p,⃗ , q j ) and terminated either by the next occurrence of p or by q ℓ . Consider thecomputation γ j in A L j obtained by performing π j from the initial configuration p ⌊ F ( n ) /m ⌋ ,where ⌊ F ( n ) /m ⌋ ( i ) = ⌊ F i ( n ) /m ⌋ . The transition selected by π v after performing thecomputation q v , . . . , q ℓ v ℓ is the transition selected by π j v , after performing γ j . Intuitively, π v “switches” among the strategies π v , . . . , π m v according to the current mode, and thussimulates computations of A L , . . . , A L m initiated in p ⌊ F ( n ) /m ⌋ . The computation firstreaching a terminal configuration is simulated completely . Hence, there exists j such that Comp σ,π v A L ( p F ( n )) “subsumes” Comp σ j ,π j v A L ( p ⌊ F i ( n ) /m ⌋ ), where σ j is the “projection” of σ into A L j . This implies max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n k ) by induction hypothesis and ourchoice of k .Finally, assume that the second possibility holds for all j ∈ { , . . . , m } . Then, weconstruct a Demon’s strategy π v in the same way as above, and conclude (by the samereasoning) that max [ c i ]( Comp σ,π v A L ( p F ( n ))) ∈ Ω( n ) for an arbitrary Angel’s strategy σσ