This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Masaryk University, Czechia and https://www.muni.cz/lide/422654-michal-ajdarow Masaryk University, Czechia and https://www.fi.muni.cz/usr/kucera/[email protected]://orcid.org/0000-0002-6602-8028 \CopyrightMichal Ajdarów and Antonín Kučera \ccsdesc[100]Theory of computation Models of computation \fundingThe work is supported by the Czech Science Foundation, Grant No. 21-24711S.\EventEditorsSerge Haddad and Daniele Varacca \EventNoEds2 \EventLongTitle32nd International Conference on Concurrency Theory (CONCUR 2021) \EventShortTitleCONCUR 2021 \EventAcronymCONCUR \EventYear2021 \EventDateAugust 23–27, 2021 \EventLocationVirtual Conference \EventLogo \SeriesVolume203 \ArticleNo24

Deciding Polynomial Termination Complexity for VASS Programs

Michal Ajdarów    Antonín Kučera
Abstract

We show that for every fixed degree k3k\geq 3, the problem whether the termination/counter complexity of a given demonic VASS is O(nk)\pazocal{O}(n^{k}), Ω(nk)\Omega(n^{k}), and Θ(nk)\Theta(n^{k}) is 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete, 𝐍𝐏\mathbf{NP}-complete, and 𝐃𝐏\mathbf{DP}-complete, respectively. We also classify the complexity of these problems for k2k\leq 2. This shows that the polynomial-time algorithm designed for strongly connected demonic VASS in previous works cannot be extended to the general case. Then, we prove that the same problems for VASS games are 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete. Again, we classify the complexity also for k2k\leq 2. Tractable subclasses of demonic VASS and VASS games are obtained by bounding certain structural parameters, which opens the way to applications in program analysis despite the presented lower complexity bounds.

keywords:
Termination complexity, vector addition systems
category:

1 Introduction

Vector addition systems with states (VASS) are a generic formalism expressively equivalent to Petri nets. In program analysis, VASS are used to model programs with unbounded integer variables, parameterized systems, etc. Thus, various problems about such systems reduce to the corresponding questions about VASS. This approach’s main bottleneck is that interesting questions about VASS tend to have high computational complexity (see, e.g., [7, 14, 15]). Surprisingly, recent results (see below) have revealed computational tractability of problems related to asymptotic complexity of VASS computations, allowing to answer questions like “Does the program terminate in time polynomial in nn for all inputs of size nn?”, or “Is the maximal value of a given variable bounded by O(n4)\pazocal{O}(n^{4}) for all inputs of size nn?”. These results are encouraging and may enhance the existing software tools for asymptotic program analysis such as SPEED [10], COSTA [1], RAML [11], Rank [2], Loopus [17, 18], AProVE [9], CoFloCo [8], C4B [6], and others. In this paper, we give a full classification of the computational complexity of deciding polynomial termination/counter complexity for demonic VASS and VASS games, and solve open problems formulated in previous works. Furthermore, we identify structural parameters making the asymptotic VASS analysis computationally hard. Since these parameters are often small in VASS program abstractions, this opens the way to applications in program analysis despite the established lower complexity bounds.

The termination complexity of a given VASS A\pazocal{A} is a function L:\pazocal{L}:\mathbb{N}\rightarrow\mathbb{N}_{\infty} assigning to every nn the maximal length of a computation initiated in a configuration with all counters initialized to nn. Similarly, the counter complexity of a given counter cc in A\pazocal{A} is a function C[c]:\pazocal{C}[c]:\mathbb{N}\rightarrow\mathbb{N}_{\infty} such that C[c](n)\pazocal{C}[c](n) is the maximal value of cc along a computation initiated in a configuration with all counters set to nn. So far, three types of VASS models have been investigated in previous works.

  • Demonic VASS, where the non-determinism is resolved by an adversarial environment aiming to increase the complexity.

  • VASS Games, where every control state is declared as angelic or demonic, and the non-determinism is resolved by the controller or by the environment aiming to lower and increase 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 in program analysis [5] applicable to arbitrary computational devices including VASS. The use of VASS termination/counter complexity analysis is illustrated in the next example.

Example 1.1.

Consider the program skeleton of Fig. 1 (left). Since a VASS cannot directly model the assignment j:=i and cannot test a counter for zero, the skeleton is first transformed into an equivalent program of Fig. 1 (middle), where the assignment j:=i is implemented using an auxiliary variable Aux and two while loops. Clearly, the execution of the transformed program is only longer than the execution of the original skeleton (for all inputs). For the transformed program, an over-approximating demonic VASS model is obtained by replacing conditionals with non-determinism, see Fig. 1 (right). When all counters are initialized to nn, the VASS terminates after O(n2)\pazocal{O}(n^{2}) transitions. Hence, the same upper bound is valid also for the original program skeleton. Actually, the run-time complexity of the skeleton is Θ(n2)\Theta(n^{2}) where nn is the initial value of i, so the obtained upper bound is asymptotically optimal.

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,0)(0,0,0)(0,0,0)(0,0,0)(0,0,0)(0,0,0)(1,0,0)(-1,0,0)  /* i-- */ (0,0,0)(0,0,0)(0,1,1)(0,-1,-1)  // j:=0; Aux:=0 // (1,+1,+1)(-1,+1,+1)  // i--; j++; Aux++ //(+1,0,1)(+1,0,-1)  // i++; Aux-- //(0,1,0)(0,-1,0)  // j-- //
Figure 1: A skeleton of a simple imperative program (left) and its VASS model (right).

Existing results. In [4], it is shown that the problem whether LO(n)\pazocal{L}\in\pazocal{O}(n) for a given demonic VASS is solvable in polynomial time, and a complete proof method based on linear ranking functions is designed. The polynomiality of termination complexity for a given demonic VASS is also decidable in polynomial time, and if LO(nk)\pazocal{L}\not\in\pazocal{O}(n^{k}) for any kk\in\mathbb{N}, then L2Ω(n)\pazocal{L}\in 2^{\Omega(n)} [13]. The same results hold for counter complexity. In [19], a polynomial time algorithm computing the least kk\in\mathbb{N} such that LO(nk)\pazocal{L}\in\pazocal{O}(n^{k}) for a given demonic VASS is presented (the algorithm first checks if such a kk exists). It is also shown that if LO(nk)\pazocal{L}\not\in\pazocal{O}(n^{k}), then LΩ(nk+1)\pazocal{L}\in\Omega(n^{k+1}). 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 unrestricted demonic VASS can be obtained by extending the presented construction (see the Introduction of [19]). In [12], it was shown that the problem whether the termination/counter complexity of a given demonic VASS belongs to a given level of Grzegorczyk hierarchy is solvable in polynomial time, and the same problem for VASS games is shown 𝐍𝐏\mathbf{NP}-complete. The 𝐍𝐏\mathbf{NP} upper bound follows by observing that player Angel can safely commit to a countreless111A strategy is counterless if the decision depends just on the control state of the configuration currently visited. strategy when minimizing the complexity level in the Grzegorczyk hierarchy. Intuitively, this is because Grzegorczyk classes are closed under function composition (unlike the classes Θ(nk)\Theta(n^{k})). Furthermore, the problem whether LO(n2)\pazocal{L}\in\pazocal{O}(n^{2}) for a given VASS game is shown 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} hard, but the decidability of this problem is left open. As for VASS MDPs, the only existing result is [3], where it is shown that the linearity of termination complexity is solvable in polynomial time for VASS MDPs with a tree-like MEC decomposition.

Our contribution. For demonic VASS, we refute the conjecture of [19] and prove that for general (not necessarily strongly connected) demonic VASS, the problem whether

  • LO(nk)\pazocal{L}\in\pazocal{O}(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, and 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k2k\geq 2;

  • LΩ(nk)\pazocal{L}\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k2k\leq 2, and 𝐍𝐏\mathbf{NP}-complete for k3k\geq 3;

  • LΘ(nk)\pazocal{L}\in\Theta(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=2k=2, and 𝐃𝐏\mathbf{DP}-complete for k3k\geq 3;

  • C[c]O(nk)\pazocal{C}[c]\in\pazocal{O}(n^{k}) is 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete;

  • C[c]Ω(nk)\pazocal{C}[c]\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, and 𝐍𝐏\mathbf{NP}-complete for k2k\geq 2;

  • C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) is 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=1k=1, and 𝐃𝐏\mathbf{DP}-complete for k2k\geq 2.

Since the demonic VASS constructed in our proofs are relatively complicated, we write them in a simple imperative language with a precisely defined VASS semantics. This allows to present the overall proof idea clearly and justify technical correctness by following the control flow of the VASS program, examining possible side effects of the underlying “gadgets”, and verifying that the Demon does not gain anything by deviating from the ideal execution scenario.

When proving the upper bounds, we show that every path in the DAG of strongly connected components can be associated with the (unique) vector describing the maximal simultaneous increase of the counters. Here, the counters pumpable to exponential (or even larger) values require special treatment. We show that this vector is computable in polynomial time. Hence, the complexity of a given counter cc is Ω(nk)\Omega(n^{k}) iff there is a path in the DAG such that the associated maximal increase of cc is Ω(nk)\Omega(n^{k}). Thus, we obtain the 𝐍𝐏\mathbf{NP} upper bound, and the other upper bounds follow similarly. The crucial parameter characterizing hard-to-analyze instances is the number of different paths from a root to a leaf in the DAG decomposition, and tractable subclasses of demonic VASS are obtained by bounding this parameter. We refer to Section 3 for more details.

Then, we turn our attention to VASS games, where the problem of polynomial termination/counter complexity analysis requires completely new ideas. In [12], it was observed that the information about the “asymptotic counter increase performed so far” must be taken into account by player Angel when minimizing the complexity level in the polynomial hierarchy, and counterless strategies are therefore insufficient. However, it is not clear what information is needed to make optimal decisions, and whether this information is finitely representable. We show that player Angel can safely commit to a so-called locking strategy. A strategy for player Angel is locking if whenever a new angelic state pp is visited, one of its outgoing transition is chosen and “locked” so that when pp is revisited, the same locked transition is used. The locked transition choice may depend on the computational history and the transitions 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 Angel is decided by an alternating polynomial time algorithm (and hence in polynomial space). Thus, we obtain the following: For every VASS game and a counter cc, we have that L,C[c]\pazocal{L},\pazocal{C}[c] are either in O(nk)\pazocal{O}(n^{k}) or in Ω(nk+1)\Omega(n^{k+1}). Furthermore, the problem whether

  • LO(nk)\pazocal{L}\in\pazocal{O}(n^{k}) is 𝐍𝐏\mathbf{NP}-complete for k=1k{=}1 and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • LΩ(nk)\pazocal{L}\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k{=}1, 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=2k{=}2, and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k3k{\geq}3;

  • LΘ(nk)\pazocal{L}\in\Theta(n^{k}) is 𝐍𝐏\mathbf{NP}-complete for k=1k{=}1 and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • C[c]O(nk)\pazocal{C}[c]\in\pazocal{O}(n^{k}) is 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete;

  • C[c]Ω(nk)\pazocal{C}[c]\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k{=}1, and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) is 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete.

Similarly to demonic VASS, tractable subclasses of VASS games are obtained by bounding the number of different paths in the locking decomposition.

The VASS model constructed in Example 1.1 is purely demonic. The use of VASS games in program analysis/synthesis is illustrated in the next example.

Example 1.2.

Consider the program of Fig. 2. The condition at line 3 is resolved by the environment in a demonic way. The two branches of if-then-else execute a code modifying the variables j and k. After that, the controller can choose one of the two while-loops at lines 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 reveals that when the variable i is assigned nn at line 1, then

  • the values of j and k are Θ(n)\Theta(n) and Θ(n2)\Theta(n^{2}) when the condition is evaluated to true;

  • the values of j and k are Θ(n2)\Theta(n^{2}) and Θ(n)\Theta(n) when the condition is evaluated to false.

Hence, the controller can keep z in Θ(n)\Theta(n) if an optimal decision is taken. Constructing a VASS game model for the program of Fig. 2 is straightforward (the required gadgets are given in Fig. 3). Using the results of this paper, the above analysis can be performed fully automatically.

1input i;
2j:=0; k:=0; z:=0;
3if condition // demonic choice //
4then while (i>0) do j++; k:=k+i; i–; done
5else j:=i*i; k:=i;
6while (i>0) do j:=j+k; i–; done
7choose: // angelic choice //
8while (j>0) do j–; z++ done
9or: while (k>0) do k–; z++ done
Figure 2: A simple program with both demonic and angelic non-determinism.

2 Preliminaries

The sets of integers and non-negative integers are denoted by \mathbb{Z} and \mathbb{N}, respectively, and we use \mathbb{N}_{\infty} to denote {}\mathbb{N}\cup\{\infty\}. The vectors of d\mathbb{Z}^{d} where d1d\geq 1 are denoted by 𝐯,𝐮,\mathbf{v},\mathbf{u},\ldots, and the vector (n,,n)(n,\ldots,n) is denoted by n\vec{n}.

Definition 2.1 (VASS).

Let d1d\geq 1. A dd-dimensional vector addition system with states (VASS) is a pair A=(Q,Tran)\pazocal{A}=\left(Q,\textit{Tran}\right), where QQ\neq\emptyset is a finite set of states and TranQ×d×Q\textit{Tran}\subseteq Q\times\mathbb{Z}^{d}\times Q is a finite set of transitions such that for every qQq\in Q there exist pQp\in Q and 𝐮d\mathbf{u}\in\mathbb{Z}^{d} such that (q,𝐮,p)Tran(q,\mathbf{u},p)\in\textit{Tran}.

The set QQ is split into two disjoint subsets QAQ_{A} and QDQ_{D} of angelic and demonic states controlled by the players Angel and Demon, respectively. A configuration of A\pazocal{A} is a pair p𝐯Q×dp\mathbf{v}\in Q\times\mathbb{N}^{d}, where 𝐯\mathbf{v} is the vector of counter values. We often refer to counters by their symbolic names. For example, when we say that A\pazocal{A} has three counters x,y,zx,y,z and the value of xx in a configuration p𝐯p\mathbf{v} is 88, we mean that d=3d=3 and 𝐯i=8\mathbf{v}_{i}=8 where ii is the index associated to xx. When the mapping between a counter name and its index is essential, we use cic_{i} to denote the counter with index ii.

A finite path in A\pazocal{A} of length mm is a finite sequence ϱ=p1,𝐮1,p2,𝐮2,,pm\varrho=p_{1},\mathbf{u}_{1},p_{2},\mathbf{u}_{2},\ldots,p_{m} such that (pi,𝐮i,pi+1)Tran(p_{i},\mathbf{u}_{i},p_{i+1})\in Tran for all 1i<m1\leq i<m. We use Δ(ϱ)\Delta(\varrho) to denote the effect of ϱ\varrho, defined as i=1m𝐮i\sum_{i=1}^{m}\mathbf{u}_{i}. An infinite path in A\pazocal{A} is an infinite sequence α=p1,𝐮1,p2,𝐮2,\alpha=p_{1},\mathbf{u}_{1},p_{2},\mathbf{u}_{2},\ldots such that every finite prefix p1,𝐮1,,pmp_{1},\mathbf{u}_{1},\ldots,p_{m} of α\alpha is a finite path in A\pazocal{A}.

A computation of A\pazocal{A} is a sequence of configurations α=p1𝐯1,p2𝐯2,\alpha=p_{1}\mathbf{v}_{1},p_{2}\mathbf{v}_{2},\ldots of length mm\in\mathbb{N}_{\infty} such that for every 1i<m1\leq i<m there is a transition (pi,𝐮i,pi+1)(p_{i},\mathbf{u}_{i},p_{i+1}) satisfying 𝐯i+1=𝐯i+𝐮i\mathbf{v}_{i+1}=\mathbf{v}_{i}+\mathbf{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\pazocal{A} is a function η\eta assigning to every finite computation p1𝐯1,,pm𝐯mp_{1}\mathbf{v}_{1},\ldots,p_{m}\mathbf{v}_{m} where pmQAp_{m}\in Q_{A} (or pmQDp_{m}\in Q_{D}) a transition (pm,𝐮,q)(p_{m},\mathbf{u},q). Every pair of strategies (σ,π)(\sigma,\pi) for Angel/Demon and every initial configuration p𝐯p\mathbf{v} determine the unique maximal computation 𝐶𝑜𝑚𝑝σ,π(p𝐯)\mathit{Comp}^{\sigma,\pi}(p\mathbf{v}) initiated in p𝐯p\mathbf{v}. The maximality means that the computation cannot be prolonged without making some counter negative. For a given counter cc, we use max[c](𝐶𝑜𝑚𝑝σ,π(p𝐯))\textit{max}[c](\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) to denote the supremum of the cc’s values in all configurations visited along 𝐶𝑜𝑚𝑝σ,π(p𝐯)\mathit{Comp}^{\sigma,\pi}(p\mathbf{v}). Furthermore, we use len(𝐶𝑜𝑚𝑝σ,π(p𝐯))\textit{len}(\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) to denote the length of 𝐶𝑜𝑚𝑝σ,π(p𝐯)\mathit{Comp}^{\sigma,\pi}(p\mathbf{v}). Note that max[c]\textit{max}[c] and len can be infinite for certain computations.

For every initial configuration p𝐯p\mathbf{v}, consider a game where the players Angel and Demon aim at minimizing and maximizing the max[c]\textit{max}[c] or len objective, respectively. By applying standard game-theoretic arguments (see Appendix A), we obtain

supπinfσlen(𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{len}(\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) =\displaystyle= infσsupπlen(𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{len}(\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) (1)
supπinfσmax[c](𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) =\displaystyle= infσsupπmax[c](𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{max}[c](\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) (2)

where σ\sigma and π\pi range over all strategies for Angel and Demon, respectively. Hence, there exists a unique termination value of p𝐯p\mathbf{v}, denoted by 𝑇𝑣𝑎𝑙(p𝐯)\mathit{Tval}(p\mathbf{v}), defined by (1). Similarly, for every counter cc there exists a unique maximal counter value, denoted by 𝐶𝑣𝑎𝑙[c](p𝐯)\mathit{Cval}[c](p\mathbf{v}), defined by (2). Furthermore, both players have optimal positional strategies σ\sigma^{*} and π\pi^{*} achieving the outcome specified by the equilibrium value or better in every configuration p𝐯p\mathbf{v} against every strategy of the opponent (here, a positional strategy is a strategy depending only on the currently visited configuration). We refer to Appendix A for details.

The termination complexity and cc-counter complexity of A\pazocal{A} are functions L,C[c]:\pazocal{L},\pazocal{C}[c]:\mathbb{N}\rightarrow\mathbb{N}_{\infty} where L(n)=max{𝑇𝑣𝑎𝑙(pn)pQ}\pazocal{L}(n)=\max\{\mathit{Tval}(p\vec{n})\mid p\in Q\} and C[c](n)=max{𝐶𝑣𝑎𝑙[c](pn)pQ}\pazocal{C}[c](n)=\max\{\mathit{Cval}[c](p\vec{n})\mid p\in Q\}. When the underlying VASS A\pazocal{A} is not clear, we write LA\pazocal{L}{A} and CA[c]\pazocal{C}{A}[c] instead of L\pazocal{L} and C[c]\pazocal{C}[c].

Observe that the asymptotic analysis of termination complexity for a given VASS A\pazocal{A} is trivially reducible to the asymptotic analysis of counter complexity in a VASS B\pazocal{B} obtained from A\pazocal{A} by adding a fresh “step counter” sc incremented by every transition of B\pazocal{B}. Clearly, LAΘ(CB[sc])\pazocal{L}{A}\in\Theta(\pazocal{C}{B}[\textit{sc}]). Therefore, the lower complexity bounds for the considered problems of asymptotic analysis are proven for L\pazocal{L}, while the upper bounds are proven for C[c]\pazocal{C}[c].

3 Demonic VASS

In this section, we classify the computational complexity of polynomial asymptotic analysis for demonic VASS. The following theorem holds regardless whether the counter update vectors are encoded in unary or binary (the lower bounds hold for unary encoding, the upper bounds hold for binary encoding).

Theorem 3.1.

Let k1k\geq 1. For every demonic VASS A\pazocal{A} and counter cc we have that L\pazocal{L} (C[c]\pazocal{C}[c]) is either in O(nk)\pazocal{O}(n^{k}) or in Ω(nk+1)\Omega(n^{k+1}). Furthermore, the problem whether

  • LO(nk)\pazocal{L}\in\pazocal{O}(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, and 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k2k\geq 2;

  • LΩ(nk)\pazocal{L}\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k2k\leq 2, and 𝐍𝐏\mathbf{NP}-complete for k3k\geq 3;

  • LΘ(nk)\pazocal{L}\in\Theta(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=2k=2, and 𝐃𝐏\mathbf{DP}-complete for k3k\geq 3;

  • C[c]O(nk)\pazocal{C}[c]\in\pazocal{O}(n^{k}) is 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete;

  • C[c]Ω(nk)\pazocal{C}[c]\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k=1, and 𝐍𝐏\mathbf{NP}-complete for k2k\geq 2;

  • C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) is 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=1k=1, and 𝐃𝐏\mathbf{DP}-complete for k2k\geq 2.

The next theorem identifies the crucial parameter influencing the complexity of polynomial asymptotic analysis for demonic VASS. Let D(A)\pazocal{D}(\pazocal{A}) be the standard DAG of strongly connected components of A\pazocal{A}. For every leaf (bottom SCC) η\eta of D(A)\pazocal{D}(\pazocal{A}), let Deg(η)\textit{Deg}(\eta) be the total number of all paths from a root of D(A)\pazocal{D}(\pazocal{A}) to η\eta.

Theorem 3.2.

Let Λ\Lambda be a class of demonic VASS such that for every AΛ\pazocal{A}\in\Lambda and every leaf η\eta of D(A)\pazocal{D}(\pazocal{A}) we have that Deg(η)\textit{Deg}(\eta) is bounded by a fixed constant depending only on Λ\Lambda.

Then, the problems whether LAO(nk)\pazocal{L}{A}\in\pazocal{O}(n^{k}), LAΩ(nk)\pazocal{L}{A}\in\Omega(n^{k}), LAΘ(nk)\pazocal{L}{A}\in\Theta(n^{k}) for given AΛ\pazocal{A}\in\Lambda and kk\in\mathbb{N}, are solvable in polynomial time (where the kk is written in binary). The same results hold also for C[c]\pazocal{C}[c] (for a given counter cc of A\pazocal{A}).

The degree of the polynomial bounding the running time of the decision algorithm for the three problems of Theorem 3.2 increases with the increasing size of the constant bounding Deg(η)\textit{Deg}(\eta). From the point of view of program analysis, Theorem 3.2 has a clear intuitive meaning. If A\pazocal{A} is an abstraction of a program P\pazocal{P}, then the instructions in P\pazocal{P} increasing the complexity of the asymptotic analysis of A\pazocal{A} are branching instructions such as if-then-else that are not embedded within loops. If P\pazocal{P} executes many such constructs in a sequence, a termination point can be reached in many ways (“zigzags” in the P\pazocal{P}’s control-flow graph). This increases Deg(η)\textit{Deg}(\eta), where η\eta is a leaf of D(A)\pazocal{D}(\pazocal{A}) containing the control state modeling the termination point of P\pazocal{P}.

3.1 Lower bounds

1 d2 += d1e1;d3 += d2e2;;dk += dk1ek1;d_{2}\texttt{\,+=\,}d_{1}*e_{1};\ \ d_{3}\texttt{\,+=\,}d_{2}*e_{2};\ \cdots\ ;\ \ d_{k}\texttt{\,+=\,}d_{k-1}*e_{k-1};
2 foreach i=1,,vi=1,\ldots,v do
3    choose:  xi += dkx_{i}\texttt{\,+=\,}d_{k} or x¯i += dk;\bar{x}_{i}\texttt{\,+=\,}d_{k};
4   
5 end foreach
6 s0 += dk;s_{0}\texttt{\,+=\,}d_{k};
7 foreach i=1,,mi=1,\ldots,m do
8    choose:  si += min(1i,si1)s_{i}\texttt{\,+=\,}\min(\ell^{i}_{1},s_{i-1}) or si += min(2i,si1)s_{i}\texttt{\,+=\,}\min(\ell^{i}_{2},s_{i-1}) or si += min(3i,si1);s_{i}\texttt{\,+=\,}\min(\ell^{i}_{3},s_{i-1});
9   
10 end foreach
f += smnf\texttt{\,+=\,}s_{m}*n
VASS Program 1 Aφ\pazocal{A}_{\varphi}
inout xx + α\alpha + zz + xx α\alpha + zz yyz += xyz\texttt{\,+=\,}x*yinout yy + xx + α\alpha + yy α\alpha x += yx\texttt{\,+=\,}yinout si1s_{i-1} \ell + sis_{i} + α\alpha + \ell α\alpha si += min(,si1)s_{i}\texttt{\,+=\,}\min(\ell,s_{i-1})ininoutinoutoutins1\textit{ins}_{1}ins2\textit{ins}_{2}ins1;ins2\textit{ins}_{1};\ \textit{ins}_{2}ininoutinoutoutins1\textit{ins}_{1}insj\textit{ins}_{j}choose: ins1; or  or insj\textbf{choose: }\textit{ins}_{1};\textbf{ or }\cdots\textbf{ or }\textit{ins}_{j}
Figure 3: The gadgets of Aφ\pazocal{A}_{\varphi}.
Lemma 3.3.

Let k2k\geq 2. For every propositional formula φ\varphi in 3-CNF there exists a demonic VASS Aφ\pazocal{A}_{\varphi}, with counter cc, constructible in time polynomial in |φ||\varphi| such that

  • if φ\varphi is satisfiable, then LAφΘ(nk+1)\pazocal{L}_{\pazocal{A}_{\varphi}}\in\Theta(n^{k+1}) and CAφ[c]Θ(nk)\pazocal{C}_{\pazocal{A}_{\varphi}}[c]\in\Theta(n^{k});

  • if φ\varphi is not satisfiable, then LAφΘ(nk)\pazocal{L}_{\pazocal{A}_{\varphi}}\in\Theta(n^{k}) and CAφ[c]Θ(n)\pazocal{C}_{\pazocal{A}_{\varphi}}[c]\in\Theta(n).

Proof 3.4.

Let φC1Cm\varphi\ \equiv\ C_{1}\wedge\cdots\wedge C_{m} be a propositional formula where every Ci1i2i3iC_{i}\equiv\ell_{1}^{i}\vee\ell_{2}^{i}\vee\ell_{3}^{i} is a clause with three literals over propositional variables X1,,XvX_{1},\ldots,X_{v} (a literal is a propositional variable or its negation). We construct a VASS Aφ\pazocal{A}_{\varphi} with the counters

  • x1,,xvx_{1},\cdots,x_{v}, x¯1,,x¯v\bar{x}_{1},\cdots,\bar{x}_{v} used to encode an assignment of truth values to X1,,XvX_{1},\ldots,X_{v}. In the following, we identify literals ji\ell_{j}^{i} of φ\varphi with their corresponding counters (i.e., if jiXu\ell_{j}^{i}\equiv X_{u}, the corresponding counter is xux_{u}; and if ji¬Xu\ell_{j}^{i}\equiv\neg X_{u}, the corresponding counter is x¯u\bar{x}_{u}).

  • s0,,sm=cs_{0},\ldots,s_{m}=c used to encode the validity of clauses under the chosen assignment,

  • ff used to encode the (in)validity of φ\varphi under the chosen assignment,

  • d1,,dkd_{1},\ldots,d_{k} and e1,,ek1e_{1},\ldots,e_{k-1} used to compute nkn^{k},

  • and some auxiliary counters used in gadgets.

The structure of Aφ\pazocal{A}_{\varphi} is shown in VASS Program 1. The basic instructions are implemented by the gadgets of Fig. 3 (top). Counter changes associated to a given transition are indicated by the corresponding labels, where c-c and +c+c mean decrementing and incrementing a given counter by one (the other counters are unchanged). Hence, the empty label represents no counter change, i.e., the associated counter update vector is 0\vec{0}. The auxiliary counter α\alpha is unique for every instance of these gadgets and it is not modified anywhere else.

The constructs ins1;ins2\textit{ins}_{1};\,\textit{ins}_{2} and choose: ins1; or  or insj\textbf{choose: }\textit{ins}_{1};\textbf{ or }\cdots\textbf{ or }\textit{ins}_{j} are implemented by connecting the underlying gadgets as shown in Fig. 3 (bottom). The foreach statements are just concise representations of the corresponding sequences of instructions connected by ‘;’.

Now suppose that the computation of VASS Program 1 is executed from line 1 where all counters are initialized to nn. One can easily verify that all gadgets implement the operations associated to their labels up to some “asymptotically irrelevant side effects”. More precisely,

  • the z += xyz\texttt{\,+=\,}x*y gadget ensures that the Demon can increase the value of counter zz by val(x)+val(y)(val(x)+n)\textit{val}(x)+\textit{val}(y)\cdot(\textit{val}(x)+n) (but not more) if he plays optimally, where val(x)\textit{val}(x) and val(y)\textit{val}(y) are the values stored in xx and yy when initiating the gadget. Recall that the counter α\alpha is unique for the gadget, and its initial value is nn. Also note that the value of yy is decreased to 0 when the Demon strives to maximally increase the value of zz.

  • The x += yx\texttt{\,+=\,}y gadget ensures that the Demon can add val(y)\textit{val}(y) to the counter xx and then reset yy to the value val(y)+n\textit{val}(y)+n (but not more) if he plays optimally. Again, note that α\alpha is a unique counter for the gadget with initial value nn.

  • The si += min(,si1)s_{i}\texttt{\,+=\,}\min(\ell,s_{i-1}) gadget allows the Demon to increase sis_{i} by the minimum of val()\textit{val}(\ell) and val(si1)\textit{val}(s_{i-1}), and then restore \ell to val()+n\textit{val}(\ell)+n (but not more).

Now, the VASS Program 1 is easy to follow. We describe its execution under the assumption that the Demon plays optimally. It is easy to verify that the Demon cannot gain anything by deviating from the below described scenario where certain counters are pumped to their maximal values (in particular, the auxiliary counters are never re-used outside their gadgets, hence the Demon is not motivated to leave any positive values in them).

By executing line 1, the Demon pumps the counter dkd_{k} to the value Θ(nk)\Theta(n^{k}). Then, the Demon determines a truth assignment for every XiX_{i}, where i{1,,v}i\in\{1,\ldots,v\}, by pumping either the counter xix_{i} or the counter x¯i\bar{x}_{i} to the value Θ(nk)\Theta(n^{k}). A key observation is that when the chosen assignment makes φ\varphi true, then every clause contains a literal such that the value of its associated counter is Θ(nk)\Theta(n^{k}). Otherwise, there is a clause CiC_{i} such that all of the three counters corresponding to 1i\ell_{1}^{i}, 2i\ell_{2}^{i}, 3i\ell_{3}^{i} have the value nn. The Demon continues by pumping s0s_{0} to the value Θ(nk)\Theta(n^{k}) at line 1. Then, for every i=1,,mi=1,\ldots,m, he selects a literal ji\ell_{j}^{i} of CiC_{i} and pumps sis_{i} to the minimum of val(si1)\textit{val}(s_{i-1}) and val(ji)\textit{val}(\ell_{j}^{i}). Observe that val(si1)\textit{val}(s_{i-1}) is either Θ(n)\Theta(n) or Θ(nk)\Theta(n^{k}), and the same holds for val(si)\textit{val}(s_{i}) after executing the instruction. Hence, sms_{m} is pumped either to Θ(nk)\Theta(n^{k}) or Θ(n)\Theta(n), depending on whether the chosen assignment sets every clause to true or not, respectively. Note that the length of the whole computation up to line 1 is Θ(nk)\Theta(n^{k}), regardless whether the chosen assignment sets the formula φ\varphi to true or false. If sms_{m} was pumped to Θ(nk)\Theta(n^{k}), then the last instruction at line 1 can pump the counter ff to Θ(nk+1)\Theta(n^{k+1}) in Θ(nk+1)\Theta(n^{k+1}) transitions. Hence, if φ\varphi is satisfiable, the Demon can schedule a computation of length Θ(nk+1)\Theta(n^{k+1}) and along the way pump c=smc=s_{m} to Θ(nk)\Theta(n^{k}). Otherwise, the length of the longest computation is Θ(nk)\Theta(n^{k}) and counter c=smc=s_{m} is bounded by Θ(n)\Theta(n). Also observe that if the Demon starts executing Aφ\pazocal{A}_{\varphi} in some other control state (i.e., not in the first instruction of line 1), the maximal length of a computation as well as the maximal value of cc is only smaller.

Recall that the class 𝐃𝐏\mathbf{DP} consists of problems that are intersections of one problem in 𝐍𝐏\mathbf{NP} and another problem in 𝐜𝐨𝐍𝐏\mathbf{coNP}. The class 𝐃𝐏\mathbf{DP} is expected to be somewhat larger than 𝐍𝐏𝐜𝐨𝐍𝐏\mathbf{NP}\cup\mathbf{coNP}, and it is contained in the 𝐏𝐍𝐏\mathbf{P}^{\mathbf{NP}} level of the polynomial hierarchy. The standard 𝐃𝐏\mathbf{DP}-complete problem is Sat-Unsat, where an instance is a pair φ,ψ\varphi,\psi of propositional formulae and the question is whether φ\varphi is satisfiable and ψ\psi is unsatisfiable [16]. Hence, the 𝐃𝐏\mathbf{DP} lower bounds of Theorem 3.1 follow directly from the next lemmas (a proof can be found in Appendix B).

Lemma 3.5.

Let k3k\geq 3. For every pair φ,ψ\varphi,\psi of propositional formulae in 3-CNF there exists a demonic VASS Aφ,ψ\pazocal{A}_{\varphi,\psi} such that LAφ,ψΘ(nk)\pazocal{L}_{\pazocal{A}_{\varphi,\psi}}\in\Theta(n^{k}) iff φ\varphi is satisfiable and ψ\psi is unsatisfiable.

Lemma 3.6.

Let k2k\geq 2. For every pair φ,ψ\varphi,\psi of propositional formulae in 3-CNF there exists a demonic VASS Aφ,ψ\pazocal{A}_{\varphi,\psi} along with a counter cc such that CAφ,ψ[c]Θ(nk)\pazocal{C}_{\pazocal{A}_{\varphi,\psi}}[c]\in\Theta(n^{k}) iff φ\varphi is satisfiable and ψ\psi is unsatisfiable.

3.2 Upper bounds

The upper complexity bounds of Theorem 3.1 are proven for C[c]\pazocal{C}[c]. For the sake of clarity, we first sketch the main idea and then continue with developing a formal proof.

Intuition. For a given demonic VASS A\pazocal{A}, we compute its SCC decomposition and proceed by analyzing the individual SCCs in the way indicated in Fig. 4. We start in a top SCC with all counters initialized to nn. Here, we can directly apply the results of [19, 13] and decide in polynomial time whether C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) for some kk\in\mathbb{N} or C[c]2Ω(n)\pazocal{C}[c]\in 2^{\Omega(n)} (in the first case, we can also determine the kk). We perform this analysis for every counter cc and thus obtain the vector describing the maximal asymptotic growth of the counters (such as (n2,n,2Ω(n))(n^{2},n,2^{\Omega(n)}) in Fig. 4). Observe that

  • although the asymptotic growth of C[c]\pazocal{C}[c] has been analyzed for each counter independently, all counters can be pumped to their associated asymptotic values simultaneously. Intuitively, this is achieved by considering the “pumping computations” for the smaller vector (n/d,,n/d)(\lfloor n/d\rfloor,\ldots,\lfloor n/d\rfloor) of initial counter values (dd is the dimension of A\pazocal{A}), and then simply “concatenating” these computations in a configuration with all counters initialized to nn;

  • if the asymptotic growth of C[c]\pazocal{C}[c] is Θ(n)\Theta(n), the computation simultaneously pumping the counters to their asymptotic values may actually decrease the value of cc (the computation can be arranged so that the resulting value of cc stays above n/d\lfloor n/d\rfloor for all sufficiently large nn). For example, the top SCC of Fig. 4 achieves the simultaneous asymptotic growth of all counters from (n,n,n)(n,n,n) to (n2,n,2Ω(n))(n^{2},n,2^{\Omega(n)}), but this does not imply the counters can be simultaneously increased above the original value nn (nevertheless, the simultaneous increase in the first and the third counter above nn is certainly possible for all sufficiently large nn).

A natural idea how to proceed with next SCCs is to perform a similar analysis for larger vectors of initial counter values. Since we are interested just in the asymptotic growth of the counters, we can safely set the initial value of a counter previously pumped to Θ(nk)\Theta(n^{k}) to precisely nkn^{k}. However, it is not immediately clear how to treat the counters previously pumped to 2Ω(n)2^{\Omega(n)}. We show that the length of a computation “pumping” the counters to their new asymptotic values in the considered SCC C\pazocal{C} is at most exponential in nn. Consequently, the “pumping computation” in C\pazocal{C} can be constructed so that the resulting value of the “large” counters stays above one half of their original value. This means the value of “large” counters is still in 2Ω(n)2^{\Omega(n)} after completing the computation in C\pazocal{C}. Furthermore, the large counters can be treated as if their initial value was infinite when analyzing C\pazocal{C}. This “infinite” initial value is implemented simply by modifying every counter update vector 𝐮\mathbf{u} in C\pazocal{C} so that 𝐮[j]=0\mathbf{u}[j]=0 for every “large” counter cjc_{j}. This adjustment in the structure of C\pazocal{C} is denoted by putting “\infty” into the corresponding component of the initial counter value vector (see Fig. 4). This procedure is continued until processing all SCCs. Note that the same SCC may be processed multiple times for different vectors of initial counter values corresponding to different paths from a top SCC. In Fig. 4, the bottom SCC is processed for the initial vectors (n5,n,)(n^{5},n,\infty) and (n2,,)(n^{2},\infty,\infty) corresponding to the two paths from the top SCC. The number of such initial vectors can be exponential in the size of A\pazocal{A}, as witnessed by the VASS constructed in the proof of Lemma 3.3.

(n,n,n)(n,n,n)(n2,n,2Ω(n))(n^{2},n,2^{\Omega(n)})(n2,n,)(n^{2},n,\infty)(n2,2Ω(n),)(n^{2},2^{\Omega(n)},\infty)(n2,n,)(n^{2},n,\infty)(n5,n,)(n^{5},n,\infty)(n5,n,)(n^{5},n,\infty)(n5,n5,)(n^{5},n^{5},\infty)(n2,,)(n^{2},\infty,\infty)(n2,,)(n^{2},\infty,\infty)
Figure 4: Analyzing C[c]\pazocal{C}[c] in a demonic VASS by SCC decomposition.

Now we give a formal proof. Let A\pazocal{A} be a demonic VASS with dd counters. For every counter cc and every 𝐯d\mathbf{v}\in\mathbb{N}^{d}, we define the function C[c,𝐯]:\pazocal{C}[c,\mathbf{v}]:\mathbb{N}\rightarrow\mathbb{N}_{\infty} where C[c,𝐯](n)\pazocal{C}[c,\mathbf{v}](n) is the maximum of all 𝐶𝑣𝑎𝑙[c](p𝐮)\mathit{Cval}[c](p\mathbf{u}) where pQp\in Q and 𝐮=(n𝐯(1),,n𝐯(d))\mathbf{u}=(n^{\mathbf{v}(1)},\ldots,n^{\mathbf{v}(d)}).

Proposition 3.7.

Let A\pazocal{A} be a strongly connected demonic VASS with dd counters, and let 𝐯d\mathbf{v}\in\mathbb{N}^{d} such that 𝐯(i)2jd\mathbf{v}(i)\leq 2^{j\cdot d} for every idi\leq d, where j<|Q|j<|Q|. For every counter cc, we have that either C[c,𝐯]Θ(nk)\pazocal{C}[c,\mathbf{v}]\in\Theta(n^{k}) for some 1k2(j+1)d1\leq k\leq 2^{(j{+}1)\cdot d}, or C[c,𝐯]Ω(2n)\pazocal{C}[c,\mathbf{v}]\in\Omega(2^{n}). It is decidable in polynomial time which of the two possibilities holds. In the first case, the value of kk is computable in polynomial time.

In [19], a special variant of Proposition 3.7 covering the subcase when 𝐯=1\mathbf{v}=\vec{1} is proven. In the introduction part of [19], it is mentioned that a generalization of this result (equivalent to Proposition 3.7) can be obtained by modifying the techniques presented in [19]. Although no explicit proof is given, the modification appears feasible. We give a simple explicit proof of Proposition 3.7, using the algorithm of [19] for the 𝐯=1\mathbf{v}=\vec{1} subcase as a “black-box procedure”. We refer to Appendix B for details.

Now we extend the function C[c,𝐯]\pazocal{C}[c,\mathbf{v}] so that 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}. Here, the \infty components of 𝐯\mathbf{v} correspond to counters that have already been pumped to “very large” values and do not constrain the computations in A\pazocal{A}. As we shall see, “very large” actually means “at least singly exponential in nn”.

Let 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, and let A𝐯\pazocal{A}_{\mathbf{v}} be the VASS obtained from A\pazocal{A} by modifying every counter update vector 𝐮\mathbf{u} into 𝐮\mathbf{u}^{\prime}, where 𝐮(i)=𝐮(i)\mathbf{u}^{\prime}(i)=\mathbf{u}(i) if 𝐯(i)\mathbf{v}(i)\neq\infty, otherwise 𝐮(i)=0\mathbf{u}^{\prime}(i)=0. Hence, the counters set to \infty in 𝐯\mathbf{v} are never changed in A𝐯\pazocal{A}_{\mathbf{v}}. Furthermore, let 𝐯\mathbf{v}^{\prime} be the vector obtained from 𝐯\mathbf{v} by changing all \infty components into 11. We put CA[c,𝐯]=CA𝐯[c,𝐯]\pazocal{C}_{\pazocal{A}}[c,\mathbf{v}]=\pazocal{C}_{\pazocal{A}_{\mathbf{v}}}[c,\mathbf{v}^{\prime}].

For a given 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, we say that F:dF:\mathbb{N}\rightarrow\mathbb{N}^{d} is 𝐯\mathbf{v}-consistent if for every i{1,,d}i\in\{1,\ldots,d\} we have that the projection Fi:F_{i}:\mathbb{N}\rightarrow\mathbb{N} is either Θ(nk)\Theta(n^{k}) if 𝐯i=k\mathbf{v}_{i}=k, or 2Ω(n)2^{\Omega(n)} if 𝐯i=\mathbf{v}_{i}=\infty. Intuitively, a 𝐯\mathbf{v}-consistent function assigns to every nn\in\mathbb{N} a vector F(n)F(n) of initial counter values growing consistently with 𝐯\mathbf{v}.

Given 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, a control state pQp\in Q, a 𝐯\mathbf{v}-consistent function FF, an infinite family Π=π1,π2,\Pi=\pi_{1},\pi_{2},\ldots of Demon’s strategies in A\pazocal{A}, a function S:S:\mathbb{N}\rightarrow\mathbb{N}, and nn\in\mathbb{N}, we use βn[𝐯,p,F,Π,S]\beta_{n}[\mathbf{v},p,F,\Pi,S] to denote the computation of A\pazocal{A} starting at pF(n)pF(n) obtained by applying πn\pi_{n} until a maximal computation is produced or S(n)S(n) transitions are executed.

The next lemma says that if A\pazocal{A} is strongly connected, then all counters can be pumped simultaneously to the values asymptotically equivalent to CA[c,𝐯]\pazocal{C}_{\pazocal{A}}[c,\mathbf{v}] so that the counters previously pumped to exponential values stay exponential.

Lemma 3.8.

Let A\pazocal{A} be a strongly connected demonic VASS with dd counters. Let 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, and let FF be a 𝐯\mathbf{v}-consistent function. Then for every counter cic_{i} such that 𝐯i\mathbf{v}_{i}\neq\infty and CA[ci,𝐯]Θ(nk)\pazocal{C}_{\pazocal{A}}[c_{i},\mathbf{v}]\in\Theta(n^{k}) we have that 𝐶𝑣𝑎𝑙[ci](pF(n))Θ(nk)\mathit{Cval}[c_{i}](pF(n))\in\Theta(n^{k}) for every pQp\in Q. Furthermore, there exist pQp\in Q, an infinite family Π\Pi of Demon’s strategies, and a function S2O(n)S\in 2^{\pazocal{O}(n)} such that for every cic_{i}, the value of cic_{i} in the last configuration of βn[𝐯,p,F,Π,S]\beta_{n}[\mathbf{v},p,F,\Pi,S] is

  • Θ(nk)\Theta(n^{k}) if CA[ci,𝐯]Θ(nk)\pazocal{C}_{\pazocal{A}}[c_{i},\mathbf{v}]\in\Theta(n^{k});

  • 2Ω(n)2^{\Omega(n)} if 𝐯i=\mathbf{v}_{i}=\infty or CA[ci,𝐯]2Ω(n)\pazocal{C}{A}[c_{i},\mathbf{v}]\in 2^{\Omega(n)}.


A proof of Lemma 3.8 uses the result of [13] saying that counters pumpable to exponential values can be simultaneously pumped by a computation of exponential length from a configuration where all counters are set to nn (the same holds for polynomially bounded counters, where the length of the computation can be bounded even by a polynomial). Using the construction of Proposition 3.7, these results are extended to our setting with 𝐯\mathbf{v}-consistent initial counter values. Then, the initial counter values are virtually “split into dd boxes” of size F(n)/d\lfloor F(n)/d\rfloor. The computations pumping the individual counters are then run “each in its own box” for these smaller initial vectors and concatenated. As the computation of one “box” cannot affect any other “box”, no computation can undo the effects of previous computations. The details can be found in Appendix B.4

Let VA:dd\pazocal{V}_{\pazocal{A}}:\mathbb{N}_{\infty}^{d}\rightarrow\mathbb{N}_{\infty}^{d} be a function such that, for every 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d},

VA(𝐯)(i)={kif 𝐯i and CA[ci,𝐯]Θ(nk),otherwise.\pazocal{V}{A}(\mathbf{v})(i)=\begin{cases}k&\mbox{if $\mathbf{v}_{i}\neq\infty$ and $\pazocal{C}_{\pazocal{A}}[c_{i},\mathbf{v}]\in\Theta(n^{k})$,}\\ \infty&\mbox{otherwise.}\end{cases}

Note that every SCC (vertex) η\eta of D(A)\pazocal{D}(\pazocal{A}) can be seen as a strongly connected demonic VASS after deleting all transitions leading from/to the states outside η\eta. If the counters are simultaneously pumped to 𝐯\mathbf{v}-consistent values before entering η\eta, then η\eta can further pump the counters to Vη(𝐯)\pazocal{V}_{\eta}(\mathbf{v})-consistent values (see Lemma 3.8). According to Lemma 3.7, Vη(𝐯)\pazocal{V}_{\eta}(\mathbf{v}) is computable in polynomial time for every 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d} where every finite 𝐯i\mathbf{v}_{i} is bounded by 2jd2^{j\cdot d} for some j<|Q|j<|Q|.

Observe that all computations of A\pazocal{A} can be divided into finitely many pairwise disjoint classes according to their corresponding paths in DA\pazocal{D}{A} (i.e., the sequence of visited SCCs of DA\pazocal{D}{A}). For each such sequence η1,,ηm\eta_{1},\ldots,\eta_{m}, the vectors 𝐯0,,𝐯m\mathbf{v}_{0},\ldots,\mathbf{v}_{m} where 𝐯0=1\mathbf{v}_{0}=\vec{1} and 𝐯i=Vηi(𝐯i1)\mathbf{v}_{i}=\pazocal{V}_{\eta_{i}}(\mathbf{v}_{i-1}) are computable in time polynomial in |A||\pazocal{A}| (note that m|Q|m\leq|Q|). The asymptotic growth of the counters achievable by computations following the path η1,,ηm\eta_{1},\ldots,\eta_{m} is then given by 𝐯m\mathbf{v}_{m}. Hence, CA[ci]Ω(nk)\pazocal{C}{A}[c_{i}]\in\Omega(n^{k}) iff there is a path η1,,ηm\eta_{1},\ldots,\eta_{m} in DA\pazocal{D}{A} such that 𝐯m(i)k\mathbf{v}_{m}(i)\geq k. Similarly, CA[ci]O(nk)\pazocal{C}{A}[c_{i}]\in\pazocal{O}(n^{k}) iff for every path η1,,ηm\eta_{1},\ldots,\eta_{m} in DA\pazocal{D}{A} we have that 𝐯m(i)k\mathbf{v}_{m}(i)\leq k. From this we immediately obtain the upper complexity bounds of Theorem 3.1.

Furthermore, for every SCC η\eta of DA\pazocal{D}{A}, we can compute the set VectorsA(η)\textit{Vectors}{A}(\eta) of all 𝐮\mathbf{u} such that there is a path η1,,ηm\eta_{1},\ldots,\eta_{m} where η1\eta_{1} is a root of DA\pazocal{D}{A}, ηm=η\eta_{m}=\eta, and 𝐮=𝐯m\mathbf{u}=\mathbf{v}_{m}. A full description of the algorithm is given in Appendix B.5. If Deg(η)\textit{Deg}(\eta) is bounded by a fixed constant independent of A\pazocal{A} for every leaf η\eta of DA\pazocal{D}_{\pazocal{A}}, then the algorithm terminates in polynomial time, which proves Theorem 3.2.

4 VASS Games

The computational complexity of polynomial asymptotic analysis for VASS games is classified in our next theorem. The parameter characterizing hard instances is identified at the end of this section.

Theorem 4.1.

Let k1k\geq 1. For every VASS game A\pazocal{A} and counter cc we have that L\pazocal{L} (C[c]\pazocal{C}[c]) is either in O(nk)\pazocal{O}(n^{k}) or in Ω(nk+1)\Omega(n^{k+1}). Furthermore, the problem whether

  • LO(nk)\pazocal{L}\in\pazocal{O}(n^{k}) is 𝐍𝐏\mathbf{NP}-complete for k=1k{=}1 and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • LΩ(nk)\pazocal{L}\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k{=}1, 𝐜𝐨𝐍𝐏\mathbf{coNP}-complete for k=2k{=}2, and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k3k{\geq}3;

  • LΘ(nk)\pazocal{L}\in\Theta(n^{k}) is 𝐍𝐏\mathbf{NP}-complete for k=1k{=}1 and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • C[c]O(nk)\pazocal{C}[c]\in\pazocal{O}(n^{k}) is 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete;

  • C[c]Ω(nk)\pazocal{C}[c]\in\Omega(n^{k}) is in 𝐏\mathbf{P} for k=1k{=}1, and 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete for k2k{\geq}2;

  • C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) is 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-complete.

Furthermore, we show that for every VASS game A\pazocal{A}, either LO(n2d|Q|)\pazocal{L}\in\pazocal{O}(n^{2^{d|Q|}}) or L2Ω(n)\pazocal{L}\in 2^{\Omega(n)}. In the first case, the kk such that LΘ(nk)\pazocal{L}\in\Theta(n^{k}) can be computed in polynomial space. The same results hold for C[c]\pazocal{C}[c].

In [12], it has been shown that the problem whether LO(n)\pazocal{L}\in\pazocal{O}(n) is 𝐍𝐏\mathbf{NP}-complete, and if LO(n)\pazocal{L}\not\in\pazocal{O}(n), then LΩ(n2)\pazocal{L}\in\Omega(n^{2}). This yields the 𝐍𝐏\mathbf{NP} and 𝐜𝐨𝐍𝐏\mathbf{coNP} bounds of Theorem 4.1 for k=1,2k=1,2. Furthermore, it has been shown that the problem whether LO(n2)\pazocal{L}\in\pazocal{O}(n^{2}) is 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE}-hard, and this proof can be trivially generalized to obtain all 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} lower bounds of Theorem 4.1. For the sake of completeness, we sketch the arguments in Appendix C.

The key insight behind the proof of Theorem 4.1 is that player Angel can safely commit to a simple locking strategy when minimizing the counter complexity. We start by introducing locking strategies.

Definition 4.2.

Let A\pazocal{A} be a VASS game. We say that a strategy σ\sigma for player Angel is locking if for every computation p1𝐯1,,pm𝐯mp_{1}\mathbf{v}_{1},\dots,p_{m}\mathbf{v}_{m} where pmQAp_{m}\in Q_{A} and for every k<mk<m such that pk=pmp_{k}=p_{m} we have that σ(p1𝐯1,,pk𝐯k)=σ(p1𝐯1,,pm𝐯m)\sigma(p_{1}\mathbf{v}_{1},\dots,p_{k}\mathbf{v}_{k})=\sigma(p_{1}\mathbf{v}_{1},\dots,p_{m}\mathbf{v}_{m}).

In other words, when an angelic control state pp is visited for the first time, a locking strategy selects and “locks” an outgoing transition of pp so that whenever pp is revisited, the previously locked transition is taken. Observe that the choice of a “locked” transition may depend 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\pazocal{A} becomes “more and more demonic”. We capture these changes as a finite acyclic graph GA\pazocal{G}{A} called the locking decomposition of A\pazocal{A}. Then, we say that a locking strategy is simple if the choice of a locked transition after performing a given history depends only on the finite path in GA\pazocal{G}{A} associated to the history. We show that Angel can achieve an asymptotically optimal termination/counter complexity by using only simple locking strategies. Since the height of GA\pazocal{G}{A} is polynomial in |A||\pazocal{A}|, the existence of an appropriate simple locking strategy for Angel can be decided by an alternating polynomial-time algorithm. As 𝐀𝐏=𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{AP}=\mathbf{PSPACE}, this proves the 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} upper bounds of Theorem 4.1. Furthermore, our construction identifies the structural parameters of GA\pazocal{G}{A} making the polynomial asymptotic analysis of VASS games hard. When these parameters are bounded by fixed constants, the problems of Theorem 4.1 are solvable in polynomial time.

4.1 Locking sets and the locking decomposition of A\pazocal{A}

Let A\pazocal{A} be a VASS game. A Demonic decomposition of A\pazocal{A} is a finite directed graph DA\pazocal{D}{A} defined as follows. Let Q×Q{\sim}\subseteq Q\times Q be an equivalence where pqp\sim q iff either p=qp=q, or both p,qp,q are demonic and mutually reachable from each other via a finite path leading only through demonic control states. The vertices of DA\pazocal{D}{A} are the equivalence classes Q/Q/{\sim}, and [p][q][p]\rightarrow[q] iff [p][q][p]\neq[q] and (p,𝐮,q)Tran(p,\mathbf{u},q)\in\textit{Tran} for some 𝐮\mathbf{u}. For demonic VASS, DA\pazocal{D}{A} becomes the standard DAG decomposition. For VASS games, DA\pazocal{D}{A} is not necessarily acyclic.

A locking set of A\pazocal{A} is a set of transitions LTranL\subseteq\textit{Tran} such that (p,𝐮,q)L(p,\mathbf{u},q)\in L implies pQAp\in Q_{A}, and (p,𝐮,q),(p,𝐮,q)L(p,\mathbf{u},q),(p^{\prime},\mathbf{u}^{\prime},q^{\prime})\in L implies ppp\neq p^{\prime}. A control state pp is locked by LL if LL contains an outgoing transition of pp. We use \mathscr{L} to denote the set of all locking sets of A\pazocal{A}. For every LL\in\mathscr{L}, let AL\pazocal{A}_{L} be the VASS game obtained from A\pazocal{A} by “locking” the transitions of LL. That is, each control state pp locked by LL becomes demonic in AL\pazocal{A}_{L}, and the only outgoing transition of pp in AL\pazocal{A}_{L} is the transition (p,𝐮,q)L(p,\mathbf{u},q)\in L.

Definition 4.3.

The locking decomposition of A\pazocal{A} is a finite directed graph GA\pazocal{G}{A} where the set of vertices and the set of edges of GA\pazocal{G}{A} are the least sets VV and \rightarrow satisfying the following conditions:

  • All elements of VV are pairs ([p],L)([p],L) where LL\in\mathscr{L} and [p][p] is a vertex of DAL\pazocal{D}_{\pazocal{A}_{L}}. When pp is demonic/angelic in AL\pazocal{A}_{L}, we say that ([p],L)([p],L) is demonic/angelic.

  • VV contains all pairs of the form ([p],)([p],\emptyset).

  • If ([p],L)V([p],L)\in V where pp is demonic in AL\pazocal{A}_{L} and [p][q][p]\rightarrow[q] is an edge of DAL\pazocal{D}_{\pazocal{A}_{L}}, then ([q],L)V([q],L)\in V and ([p],L)([q],L)([p],L)\rightarrow([q],L).

  • If ([p],L)V([p],L)\in V where pp is angelic in AL\pazocal{A}_{L}, then for every (p,𝐮,q)Tran(p,\mathbf{u},q)\in\textit{Tran} we have that ([q],L)V([q],L^{\prime})\in V and ([p],L)([q],L)([p],L)\rightarrow([q],L^{\prime}), where L=L{(p,𝐮,q)}L^{\prime}=L\cup\{(p,\mathbf{u},q)\}.

It is easy to see that GA\pazocal{G}{A} is acyclic and the length of every path in GA\pazocal{G}{A} is bounded by |Q|+|QA||Q|+|Q_{A}|, where at most |Q||Q| vertices in the path are demonic. Note that every computation of A\pazocal{A} obtained by applying a locking strategy determines its associated path in GA\pazocal{G}{A} in the natural way. A locking strategy σ\sigma is simple if the choice of a locked transition depends only on the path in GA\pazocal{G}{A} associated to the performed history. (i.e., if two histories determine the same path in GA\pazocal{G}{A}, then the strategy makes the same choice for both histories).

4.2 Upper bounds

Let A\pazocal{A} be a VASS game with dd counters. For every pQp\in Q and 𝐯d\mathbf{v}\in\mathbb{N}^{d}, let CAp[c,𝐯](n)=𝐶𝑣𝑎𝑙[c](p𝐮)\pazocal{C}{A}^{p}[c,\mathbf{v}](n)=\mathit{Cval}[c](p\mathbf{u}) where 𝐮=(n𝐯(1),,n𝐯(d))\mathbf{u}=(n^{\mathbf{v}(1)},\ldots,n^{\mathbf{v}(d)}). We extend this notation to the vectors 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d} in the same way as in Section 3.2, i.e., for a given 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, we put CAp[c,𝐯]=CA𝐯p[c,𝐯]\pazocal{C}_{\pazocal{A}}^{p}[c,\mathbf{v}]=\pazocal{C}_{\pazocal{A}_{\mathbf{v}}}^{p}[c,\mathbf{v}^{\prime}]. Recall that 𝐯\mathbf{v}^{\prime} is the vector obtained from 𝐯\mathbf{v} by changing all \infty components into 11, and A𝐯\pazocal{A}_{\mathbf{v}} is the VASS obtained from A\pazocal{A} by modifying every counter update vector 𝐮\mathbf{u} into 𝐮\mathbf{u}^{\prime}, where 𝐮(i)=𝐮(i)\mathbf{u}^{\prime}(i)=\mathbf{u}(i) if 𝐯(i)\mathbf{v}(i)\neq\infty, otherwise 𝐮(i)=0\mathbf{u}^{\prime}(i)=0. The main technical step towards obtaining the 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} upper bounds of Theorem 4.1 is the next proposition.

Proposition 4.4.

Let A\pazocal{A} be a VASS game with dd counters. Furthermore, let ([p],L)([p],L) be a vertex of GA\pazocal{G}{A}, 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}, and cic_{i} a counter such that 𝐯i\mathbf{v}_{i}\neq\infty. Then, one of the following two possibilities holds:

  • there is kk\in\mathbb{N} such that for every 𝐯\mathbf{v}-consistent FF there exist a simple locking Angel’s strategy σ𝐯\sigma_{\mathbf{v}} in AL\pazocal{A}_{L} and a Demon’s strategy π𝐯\pi_{\mathbf{v}} in AL\pazocal{A}_{L} such that σ𝐯\sigma_{\mathbf{v}} is independent of FF and

    • for every Demon’s strategy π\pi in AL\pazocal{A}_{L}, we have that max[ci](𝐶𝑜𝑚𝑝ALσ𝐯,π(pF(n)))O(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma_{\mathbf{v}},\pi}(p\,F(n)))\in\pazocal{O}(n^{k});

    • for every Angel’s strategy σ\sigma in AL\pazocal{A}_{L}, we have that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))Ω(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in\Omega(n^{k}).

  • for every 𝐯\mathbf{v}-consistent FF there is a Demon’s strategy π𝐯\pi_{\mathbf{v}} in AL\pazocal{A}_{L} such that for every Angel’s strategy σ\sigma in AL\pazocal{A}_{L}, we have that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in 2^{\Omega(n)}.

Proposition 4.4 is proven by induction on the height of the subgraph rooted by ([p],L)([p],L). The case when ([p],L)([p],L) is demonic (which includes the base case when ([p],L)([p],L) is a leaf) follows from the constructions used in the proof of Proposition 3.7. When the vertex ([p],L)([p],L) is angelic, it has immediate successors of the form ([qi],Li)([q_{i}],L_{i}) where Li=L{(p,𝐮i,qi)}L_{i}=L\cup\{(p,\mathbf{u}_{i},q_{i})\}. We show that by locking one of the (p,𝐮i,qi)(p,\mathbf{u}_{i},q_{i}) transitions in pp, Angel can minimize the growth of cic_{i} in asymptotically the same way as if he used all of these transitions freely when revisiting pp. See Appendix C.2 for details.

Observe that every computation in A\pazocal{A} where Angel uses some simple locking strategy determines the unique corresponding path in GA\pazocal{G}{A} (initiated in a vertex of the form ([p],)([p],\emptyset)) in the natural way. Hence, all such computations can be divided into finitely many pairwise disjoint classes according to their corresponding paths in GA\pazocal{G}{A}. Let ([p1],L1),,([pk],Lk)([p_{1}],L_{1}),\ldots,([p_{k}],L_{k}) be a path in GA\pazocal{G}{A} where L1=L_{1}=\emptyset. Consider the corresponding sequence 𝐯0,,𝐯k\mathbf{v}_{0},\ldots,\mathbf{v}_{k} where 𝐯0=1\mathbf{v}_{0}=\vec{1} and 𝐯i\mathbf{v}_{i} is equal either to V[pi](𝐯i1)\pazocal{V}_{[p_{i}]}(\mathbf{v}_{i-1}) or to 𝐯i1\mathbf{v}_{i-1}, depending on whether ([pi],Li)([p_{i}],L_{i}) is demonic or angelic, respectively. Here, V\pazocal{V} is the function defined in Section 3.2 (observe that the component [p][p] of DAL\pazocal{D}_{A_{L}} containing pp can be seen as a strongly connected demonic VASS after deleting all transitions from/to the states outside [p][p]). The vector 𝐯k\mathbf{v}_{k} describes the maximal asymptotic growth of the counters achievable by Demon when Angel uses the simple locking strategy associated to the path. Furthermore, the sequence 𝐯0,,𝐯k\mathbf{v}_{0},\ldots,\mathbf{v}_{k} is computable in time polynomial in |A||\pazocal{A}| and all finite components of 𝐯k\mathbf{v}_{k} are bounded by 2d|Q|2^{d\cdot|Q|} because the total number of all demonic ([pi],Li)([p_{i}],L_{i}) in the path is bounded by |Q||Q| (cf. Proposition 3.7).

The problem whether C[ci]O(nk)\pazocal{C}[c_{i}]\in\pazocal{O}(n^{k}) can be decided by an alternating polynomial-time algorithm which selects an initial vertex of the form ([p],)([p],\emptyset) universally, and then constructs a maximal path in GA\pazocal{G}{A} from ([p],)([p],\emptyset) where the successors of demonic/angelic vertices are chosen universally/existentially, respectively. After obtaining a maximal path ([p1],L1),,([pk],Lk)([p_{1}],L_{1}),\ldots,([p_{k}],L_{k}), the vector 𝐯k\mathbf{v}_{k} is computed in polynomial time, and the algorithm answers yes/no depending on whether 𝐯k(i)k\mathbf{v}_{k}(i)\leq k or not, respectively. The problem whether C[ci]Ω(nk)\pazocal{C}[c_{i}]\in\Omega(n^{k}) is decided similarly, but here the initial vertex is chosen existentially, the successors of demonic/angelic vertices are chosen existentially/universally, and the algorithm answers yes/no depending on whether 𝐯k(i)k\mathbf{v}_{k}(i)\geq k or not, respectively. This proves the 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} upper bounds of Theorem 4.1.

Observe that the crucial parameter influencing the computational hardness of the asymptotic analysis for VASS games is the number of maximal paths in GA\pazocal{G}{A}. If |QA||Q_{A}| and Deg([p],L)\textit{Deg}([p],L) are bounded by constants, then the above alternating polynomial time algorithms can be simulated by deterministic polynomial time algorithms. Thus, we obtain the following:

Theorem 4.5.

Let Λ\Lambda be a class of VASS games such that for every AΛ\pazocal{A}\in\Lambda we have that |QA||Q_{A}| and Deg([p],L)\textit{Deg}([p],L), where ([p],L)([p],L) is a leaf of GA\pazocal{G}{A}, are bounded by a fixed constant depending only on Λ\Lambda. Then, the problems whether LAO(nk)\pazocal{L}{A}\in\pazocal{O}(n^{k}), LAΩ(nk)\pazocal{L}{A}\in\Omega(n^{k}), LAΘ(nk)\pazocal{L}{A}\in\Theta(n^{k}) for given AΛ\pazocal{A}\in\Lambda and kk\in\mathbb{N}, are solvable in polynomial time (where the kk is written in binary). The same results hold also for C[c]\pazocal{C}[c] (for a given counter cc of A\pazocal{A}).

5 Conclusions, future work

We presented a precise complexity classification for the problems of polynomial asymptotic complexity of demonic VASS and VASS games. We also identified the structural parameters making these problems computationally hard, and we indicated that these parameters may actually stay reasonably small when dealing with VASS abstractions of computer programs. The actual applicability and scalability of the presented results to the problems of program analysis requires a more detailed study including experimental evaluation.

From a theoretical point of view, a natural question is whether the scope of effective asymptotic analysis can be extended from purely non-deterministic VASS to VASS with probabilistic transitions (i.e., VASS MDPs and VASS stochastic games). These problems are challenging and motivated by their applicability to probabilistic program analysis.

References

  • [1] 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 user interfaces. ENTCS, 258(1):109–121, 2009.
  • [2] C. Alias, A. Darte, P. Feautrier, and L. Gonnord. Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In Proceedings of SAS 2010, pages 117–133, 2010.
  • [3] T. Brázdil, K. Chatterjee, A. Kučera, P. Novotný, and D. Velan. Deciding fast termination for probabilistic VASS with nondeterminism. In Proceedings of ATVA 2019, volume 11781 of LNCS, pages 462–478. Springer, 2019.
  • [4] T. Brázdil, K. Chatterjee, A. Kučera, P. Novotný, D. Velan, and F. Zuleger. Efficient algorithms for asymptotic bounds on termination time in VASS. In Proceedings of LICS 2018, pages 185–194. ACM Press, 2018.
  • [5] M. Broy and M. Wirsing. On the algebraic specification of nondeterministic programming languages. In Proceedings of CAAP’81, volume 112 of LNCS, pages 162–179. Springer, 1981.
  • [6] Q. Carbonneaux, J. Hoffmann, T. W. Reps, and Z. Shao. Automated resource analysis with coq proof objects. In Proceedings of CAV 2017, pages 64–85, 2017.
  • [7] W. Czerwiński, S. Lasota, R. Lazić, J. Leroux, and F. Mazowiecki. The reachability problem for Petri nets is not elementary. In Proceedings of STOC 2019, pages 24–33. ACM Press, 2019.
  • [8] A. F.-Montoya and R. Hähnle. Resource analysis of complex programs with cost equations. In Proceedings of APLAS 2014, pages 275–295, 2014.
  • [9] 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 program termination and complexity automatically with aprove. J. Autom. Reasoning, 58(1):3–31, 2017.
  • [10] S. Gulwani, K. K. Mehra, and T. M. Chilimbi. SPEED: precise and efficient static estimation of program computational complexity. In Proceedings of POPL 2009, pages 127–139, 2009.
  • [11] J. Hoffmann, K. Aehlig, and M. Hofmann. Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst., 34(3):14:1–14:62, 2012.
  • [12] 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.
  • [13] 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.
  • [14] R. Lipton. The reachability problem requires exponential space. Technical report 62, Yale University, 1976.
  • [15] E.W. Mayr and A.R. Meyer. The complexity of the finite containment problem for Petri nets. JACM, 28(3):561–576, 1981.
  • [16] Ch. Papadimitriou. Computational Complexity. Addison, 1994.
  • [17] M. Sinn, F. Zuleger, and H. Veith. A simple and scalable static analysis for bound analysis and amortized complexity analysis. In Proccedings of CAV 2014, pages 745–761, 2014.
  • [18] M. Sinn, F. Zuleger, and H. Veith. Complexity and resource bound analysis of imperative programs using difference constraints. J. Autom. Reasoning, 59(1):3–45, 2017.
  • [19] F. Zuleger. The polynomial complexity of vector addition systems with states. In Proceedings of FoSSaCS 2020, volume 12077 of LNCS, pages 622–641. Springer, 2020.

Appendix A The Existence of Equilibrium Value in VASS Games

In this section, we sketch a proof for the equalities

supπinfσlen(𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{len}(\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) =\displaystyle= infσsupπlen(𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{len}(\mathit{Comp}^{\sigma,\pi}(p\mathbf{v}))
supπinfσmax[c](𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\mathit{Comp}^{\sigma,\pi}(p\mathbf{v})) =\displaystyle= infσsupπmax[c](𝐶𝑜𝑚𝑝σ,π(p𝐯))\displaystyle\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{max}[c](\mathit{Comp}^{\sigma,\pi}(p\mathbf{v}))

used in Section 2. These results appear folklore and plausible. Still, they do not immediately follow from the standard determinacy results for Borel objectives because the reward function is not bounded. Due to the importance of these equalities, we believe they are worth a proof sketch.

We prove the determinacy result for arbitrary finitely-branching games with countably many vertices. Consider a game G=(V,,c)G=(V,{\rightarrow},c) where VV is a countably infinite set of vertices partitioned into the subsets VDV_{D} and VAV_{A} of demonic and angelic vertices, V×V{\rightarrow}\subseteq V\times V is a finitely-branching transition relation (i.e., every vertex vv has only finitely many immediate successors), and c:Vc:V\rightarrow\mathbb{N} is a cost function. Furthermore, we fix an initial vertex v^\hat{v}. For every maximal path α\alpha initiated in v^\hat{v}, let max[c](α)\textit{max}[c](\alpha) be the supremum of the costs of all vertices visited by α\alpha. We show that

supπinfσmax[c](ασ,π)=infσsupπmax[c](ασ,π)\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\alpha^{\sigma,\pi})\quad=\quad\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{max}[c](\alpha^{\sigma,\pi})

where π\pi and σ\sigma range over the strategies for Demon/Angel in GG, and ασ,π\alpha^{\sigma,\pi} is the unique maximal path initiated in v^\hat{v} determined by π\pi and σ\sigma.

Let Γ:VV\Gamma:\mathbb{N}_{\infty}^{V}\rightarrow\mathbb{N}_{\infty}^{V} be a (Bellman) operator such that, for a given f:Vf:V\rightarrow\mathbb{N}_{\infty}, we have that Γ(f)=g\Gamma(f)=g, where g:Vg:V\rightarrow\mathbb{N}_{\infty} is defined as follows:

g(v)={max{c(v),max{f(u)vu}}if vVDmax{c(v),min{f(u)vu}}if vVAg(v)=\begin{cases}\max\big{\{}c(v),\max\{f(u)\mid v\rightarrow u\}\big{\}}&\mbox{if }v\in V_{D}\\ \max\big{\{}c(v),\min\{f(u)\mid v\rightarrow u\}\big{\}}&\mbox{if }v\in V_{A}\end{cases}

Since Γ\Gamma is a continuous operator over the CPO of all functions VV\rightarrow\mathbb{N}_{\infty} with component-wise ordering, there is the least fixed-point μΓ=i=0Γi()\mu\Gamma=\bigsqcup_{i=0}^{\infty}\Gamma^{i}(\perp) of Γ\Gamma, where \perp is the least element (i.e., a function assigning 0 to every vertex). Consider two memoryless strategies π\pi^{*} and σ\sigma^{*} for Demon and Angel such that

  • for every vVDv\in V_{D}, the strategy π\pi^{*} selects a successor of vv with the maximal μΓ\mu\Gamma value;

  • for every vVAv\in V_{A}, the strategy σ\sigma^{*} selects a successor of vv with the minimal μΓ\mu\Gamma value.

Now, it suffices to show that

μΓ(v^)supπinfσmax[c](ασ,π)infσsupπmax[c](ασ,π)μΓ(v^)\mu\Gamma(\hat{v})\quad\leq\quad\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\alpha^{\sigma,\pi})\quad\leq\quad\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \sup_{\pi}\ \textit{max}[c](\alpha^{\sigma,\pi})\quad\leq\quad\mu\Gamma(\hat{v}) (3)

The second inequality of (3) holds trivially. For the first inequality, observe that

infσmax[c](ασ,π)supπinfσmax[c](ασ,π)\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\alpha^{\sigma,\pi^{*}})\quad\leq\quad\sup_{\pi}\ \operatornamewithlimits{inf\vphantom{p}}_{\sigma}\ \textit{max}[c](\alpha^{\sigma,\pi})

Hence, it suffices to show μΓ(v^)infσmax[c](ασ,π)\mu\Gamma(\hat{v})\leq\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\textit{max}[c](\alpha^{\sigma,\pi^{*}}), which is achieved by demonstrating Γi()(v^)infσmax[c](ασ,π)\Gamma^{i}(\perp)(\hat{v})\leq\operatornamewithlimits{inf\vphantom{p}}_{\sigma}\textit{max}[c](\alpha^{\sigma,\pi^{*}}) for every ii\in\mathbb{N} (by induction on ii). The last inequality in (3) is proven similarly (using σ\sigma^{*}).

Appendix B Proofs for Section 3

B.1 A proof of Lemma 3.5

See 3.5

Proof B.1.

The structure of Aφ,ψ\pazocal{A}_{\varphi,\psi} is given by the VASS Program 2. The program starts by executing the first eight lines of the VASS Program 1 constructed for φ\varphi and k1k-1, followed by the first eight lines of the same program constructed for ψ\psi and k1k-1 where all variables representing the counters are fresh and previously unused. According to the proof of Lemma 3.3, the Demon can perform Θ(nk1)\Theta(n^{k-1}) transitions when executing the first two lines of the VASS Program 2 regardless whether the formulae φ,ψ\varphi,\psi are satisfiable or not. Let s(Aφ)s(\pazocal{A}_{\varphi}) and s(Aψ)s(\pazocal{A}_{\psi}) be the counters of Aφ\pazocal{A}_{\varphi} and Aψ\pazocal{A}_{\psi} corresponding to the counter sms_{m} of the VASS Program 1. According to Lemma 3.3, we have the following:

  • If φ\varphi is satisfiable, then the counter s(Aφ)s(\pazocal{A}_{\varphi}) can be pumped to Θ(nk1)\Theta(n^{k-1}); otherwise, it can be pumped only to Θ(n)\Theta(n).

  • If ψ\psi is satisfiable, then the counter s(Aψ)s(\pazocal{A}_{\psi}) can be pumped to Θ(nk1)\Theta(n^{k-1}); otherwise, it can be pumped only to Θ(n)\Theta(n).

The instructions at lines 2 and 2 ensure that LAφ,ψΘ(nk)\pazocal{L}_{\pazocal{A}_{\varphi,\psi}}\in\Theta(n^{k}) iff the counter s(Aφ)s(\pazocal{A}_{\varphi}) can be pumped to Θ(nk1)\Theta(n^{k-1}) and the counter s(Aψ)s(\pazocal{A}_{\psi}) can be pumped only to Θ(n)\Theta(n). More precisely, the instructions at line 2 multiply the values of these two counters. Hence, if both values are Θ(nk1)\Theta(n^{k-1}), the multiplication gadget executes Θ(n2k2)\Theta(n^{2k-2}) transitions, which is beyond Θ(nk)\Theta(n^{k}). If one of the counter values is Θ(n)\Theta(n) and the other is Θ(nk1)\Theta(n^{k-1}), the multiplication takes Θ(nk)\Theta(n^{k}) transitions. Finally, if both values are Θ(n)\Theta(n), the multiplication takes Θ(n2)\Theta(n^{2}) transitions. The instructions at line 2 compute the square of the value stored in s(Aψ)s(\pazocal{A}_{\psi}), which takes either Θ(n2k2)\Theta(n^{2k-2}) or Θ(n2)\Theta(n^{2}) transitions, depending on whether the value of s(Aψ)s(\pazocal{A}_{\psi}) is Θ(nk1)\Theta(n^{k-1}) or Θ(n)\Theta(n), respectively. So, the only case when these instructions produce a sequence of transitions of length Θ(nk)\Theta(n^{k}) is when the value of s(Aφ)s(\pazocal{A}_{\varphi}) is Θ(nk1)\Theta(n^{k-1}) and the value of s(Aψ)s(\pazocal{A}_{\psi}) is Θ(n)\Theta(n).

1 lines 11 of Aφ\pazocal{A}_{\varphi} constructed for k1k-1;
2 lines 11 of Aψ\pazocal{A}_{\psi} constructed for k1k-1;  /* all counters are fresh */
3 a += s(Aφ);a\texttt{\,+=\,}s(\pazocal{A}_{\varphi});   b += s(Aψ);b\texttt{\,+=\,}s(\pazocal{A}_{\psi});   e += abe\texttt{\,+=\,}a*b;   /* a,b,ea,b,e are fresh counters */
c += s(Aψ);c\texttt{\,+=\,}s(\pazocal{A}_{\psi});   d += s(Aψ);d\texttt{\,+=\,}s(\pazocal{A}_{\psi});   f += cdf\texttt{\,+=\,}c*d;     /* c,d,fc,d,f are fresh counters */
VASS Program 2 Aφ,ψ\pazocal{A}_{\varphi,\psi}

B.2 A proof of Lemma 3.6

See 3.6

Proof B.2.

The structure of Aφ,ψ\pazocal{A}_{\varphi,\psi} is given by the VASS Program 3. The program starts by executing the first eight lines of the VASS Program 1 constructed for φ\varphi and k+1k+1, followed by the first eight lines of the same program constructed for ψ\psi and k+1k+1 where all variables representing the counters are fresh and previously unused. Let s(Aφ)s(\pazocal{A}_{\varphi}) and s(Aψ)s(\pazocal{A}_{\psi}) be the counters of Aφ\pazocal{A}_{\varphi} and Aψ\pazocal{A}_{\psi} corresponding to the counter sms_{m} of the VASS Program 1. According to Lemma 3.3, we have the following:

  • If φ\varphi is satisfiable, then the counter s(Aφ)s(\pazocal{A}_{\varphi}) can be pumped to Θ(nk+1)\Theta(n^{k+1}); otherwise, it can be pumped only to Θ(n)\Theta(n).

  • If ψ\psi is satisfiable, then the counter s(Aψ)s(\pazocal{A}_{\psi}) can be pumped to Θ(nk+1)\Theta(n^{k+1}); otherwise, it can be pumped only to Θ(n)\Theta(n).

The instructions at line 3 pump dk1d_{k-1} to Θ(nk1)\Theta(n^{k-1}). Thus the instructions at line 3 ensure if φ\varphi is unsatisfiable then cc can be pumped at most to Θ(n)\Theta(n), and if φ\varphi is satisfiable then cc can be pumped at most to Θ(nk+1)\Theta(n^{k+1}) or Θ(nk)\Theta(n^{k}) depending on whether ψ\psi is satisfiable or unsatisfiable, respectively. Therefore CAφ,ψ[c]Θ(nk)\pazocal{C}_{\pazocal{A}_{\varphi,\psi}}[c]\in\Theta(n^{k}) iff φ\varphi is satisfiable and ψ\psi is unsatisfiable.

1 lines 11 of Aφ\pazocal{A}_{\varphi} constructed for k+1k+1;
2 lines 11 of Aψ\pazocal{A}_{\psi} constructed for k+1k+1;  /* all counters are fresh */
3 d2 += d1e1;d3 += d2e2;;dk1 += dk2ek2;d_{2}\texttt{\,+=\,}d_{1}*e_{1};\ \ d_{3}\texttt{\,+=\,}d_{2}*e_{2};\ \cdots\ ;\ \ d_{k-1}\texttt{\,+=\,}d_{k-2}*e_{k-2};  /* all counters are fresh */
4 c += s(Aφ);c\texttt{\,+=\,}s(\pazocal{A}_{\varphi});   b += s(Aψ)dk1;b\texttt{\,+=\,}s(\pazocal{A}_{\psi})*d_{k-1};   c += min(a,b)c\texttt{\,+=\,}min(a,b);  /* a,b,ca,b,c are fresh counters */
VASS Program 3 Aφ,ψ\pazocal{A}_{\varphi,\psi}

B.3 A proof of Proposition 3.7

In this section we give a full proof of Proposition 3.7. We start by recalling the special variant proven in [19].

Proposition B.3 (see [19]).

Let A\pazocal{A} be a strongly connected demonic VASS with dd counters. For every counter cc, we have that either C[c]Θ(nk)\pazocal{C}[c]\in\Theta(n^{k}) for some 1k2d1\leq k\leq 2^{d}, or C[c]Ω(2n)\pazocal{C}[c]\in\Omega(2^{n}). It is decidable in polynomial time which of the two possibilities holds. In the first case, the kk is computable in polynomial time.

Our proof of Proposition 3.7 is obtained by modifying a given demonic VASS A\pazocal{A} into another demonic VASS A^\hat{\pazocal{A}} and applying Proposition B.3 to A^\hat{\pazocal{A}}. See 3.7

Proof B.4.

Let c1,,cdc_{1},\ldots,c_{d} be the counters of A\pazocal{A}. We start by constructing a VASS B\pazocal{B} that “pumps” every cic_{i} to n𝐯(i)n^{\mathbf{v}(i)} from an initial configuration with all counters set to nn (see VASS Program 4). Since the components of 𝐯\mathbf{v} can be exponential in dd, the trivial technique used in line 1 of VASS Program 1 is not applicable because it requires Ω(2jd)\Omega(2^{j\cdot d}) new counters and control states. Hence, B\pazocal{B} needs to be constructed more carefully using repeated squaring. Let max𝐯\max_{\mathbf{v}} be the maximal component of 𝐯\mathbf{v}, and let =log(max𝐯)\ell=\lfloor\log(\max_{\mathbf{v}})\rfloor. Then, for every 1id1\leq i\leq d, there is a vector ti{0,1}+1\vec{t}_{i}\in\{0,1\}^{\ell+1} computable in time polynomial in |A||\pazocal{A}| such that 𝐯(i)=ti(20,,2)\mathbf{v}(i)=\vec{t}_{i}*(2^{0},\ldots,2^{\ell}). Let fif_{i} be the least index kk such that ti(k)=1\vec{t}_{i}(k)=1. At line 4, the counter mjm_{j} is pumped to Θ(n2j)\Theta(n^{2^{j}}). Note that when maximizing the value of mjm_{j}, the corresponding gadget (see Fig. 3) leaves 0 either in mj1m_{j-1} or in α\alpha, and the value of both counters is at most 11. The nested loop at lines 44 increase the counter sis_{i} by nti(20,,2)n^{\vec{t}_{i}*(2^{0},\ldots,2^{\ell})} for every i=1,,di=1,\ldots,d using the mjm_{j} counters. Note that every counter is initialized to nn, so no computation is needed for j=0j=0. Also note that the if statements at lines 44 are purely symbolic—the conditions ti(j)=1\vec{t}_{i}(j)=1, fi=jf_{i}=j and fijf_{i}\neq j are constants denoting either true or false, and the instructions following then are either included into the code of B\pazocal{B} or not. At lines 44, the values stored in s1,,sds_{1},\ldots,s_{d} are added to the counters c1,,cdc_{1},\ldots,c_{d}. The gadget for the instruction x += [y]x\texttt{\,+=\,}[y] “reads” the value of yy destructively, i.e., the counter yy is not restored to its original value (cf. the gadget for x += yx\texttt{\,+=\,}y of Fig. 3).

Note that the VASS B\pazocal{B} has two distinguished control states in and out, and uses κ\kappa auxiliary counters different from c1,,cdc_{1},\ldots,c_{d}. Hence, the total number of counters of B\pazocal{B} is d+κd+\kappa. The transition update vectors of B\pazocal{B} are constructed so that the first dd components specify the updates for c1,,cdc_{1},\ldots,c_{d}. An important observation is that even if we extended B\pazocal{B} with a transition (out,0,in)(\textit{out},\vec{0},\textit{in}) allowing for “restarting” the computation of B\pazocal{B}, this extra transition would be of no use when maximizing the values of c1,,cc_{1},\ldots,c_{\ell}. The best the Demon could do is to maximize the value of all mjm_{j}, then maximize all sis_{i}, and then empty sis_{i} by transferring its content to cic_{i}. If the Demon violated from this scenario, leaving some positive values in the auxiliary counters of B\pazocal{B} and then “restarting” the computation of B\pazocal{B} using the transition (out,0,in)(\textit{out},\vec{0},\textit{in}), the resulting value of c1,,cc_{1},\ldots,c_{\ell} would be only smaller.

Now we construct a VASS U\pazocal{U} with d+κd+\kappa counters by taking the union of A\pazocal{A} and B\pazocal{B}, where the transition update vectors of A\pazocal{A} are extended so that they do not modify the extra κ\kappa counters of B\pazocal{B}. Furthermore, for every control state pp of A\pazocal{A}, we add to U\pazocal{U} the transitions (p,m,in)(p,-\vec{m},\textit{in}) and (out,m,p)(\textit{out},-\vec{m},p). Here, m=|Q|Mm=|Q|\cdot M, where MM is the maximal absolute value of an update vector component in A\pazocal{A}. Observe that U\pazocal{U} is strongly connected and its size is polynomial in the size of A\pazocal{A}.

We show that for every cic_{i}, where i{1,,d}i\in\{1,\ldots,d\}, the asymptotic growth of C[ci]\pazocal{C}[c_{i}] in U\pazocal{U} is the same as the asymptotic growth of C[ci,𝐯]\pazocal{C}[c_{i},\mathbf{v}] in A\pazocal{A}. Hence, it suffices to apply Proposition B.3 to U\pazocal{U}.

Clearly, CA[ci,𝐯]O(CU[ci])\pazocal{C}_{\pazocal{A}}[c_{i},\mathbf{v}]\in\pazocal{O}(\pazocal{C}_{\pazocal{U}}[c_{i}]) because U\pazocal{U} can use the sub-VASS B\pazocal{B} to pump every cjc_{j} to Θ(n𝐯(j))\Theta(n^{\mathbf{v}(j)}) and then simulate a computation of A\pazocal{A}. It remains to show CU[ci]O(CA[ci,𝐯])\pazocal{C}_{\pazocal{U}}[c_{i}]\in\pazocal{O}(\pazocal{C}_{\pazocal{A}}[c_{i},\mathbf{v}]). To see this, it suffices to verify that the best strategy for the Demon who aims at maximizing the value of cic_{i} in a computation of U\pazocal{U} initiated in a configuration with all counters set to nn is to start in the in state of the sub-VASS B\pazocal{B} and pump all c1,,cdc_{1},\ldots,c_{d} to their maximal values, and then continue by simulating A\pazocal{A} without ever returning to the in state of the sub-VASS B\pazocal{B}. Such a computation can be “simulated” by A\pazocal{A} from an initial configuration where every cjc_{j} is set to n𝐯(j)n^{\mathbf{v}(j)}, which proves our claim.

Obviously, an extra “detour” to B\pazocal{B} is of no use if the counters c1,,cdc_{1},\ldots,c_{d} have previously been pumped to their maximal values. As noted above, the Demon cannot gain anything by deviating from the scenario when c1,,cdc_{1},\ldots,c_{d} are pumped just once at the beginning because the total increase in the values of c1,,cdc_{1},\ldots,c_{d} brought by running the sub-VASS B\pazocal{B} could be only smaller. So, the only reason why Demon might still wish to re-visit B\pazocal{B} by entering in from a control state pp of the sub-VASS A\pazocal{A} is a “shorter” path to some other control state qq of the sub-VASS A\pazocal{A} passing through the sub-VASS B\pazocal{B}. However, since A\pazocal{A} is strongly connected, the Demon can always move from pp to qq via the control states of A\pazocal{A} and the total decrease in every counter will be only smaller than the decrease caused by the transitions (p,m,in)(p,-\vec{m},\textit{in}) and (out,m,q)(\textit{out},-\vec{m},q). To sum up, the optimal strategy for Demon is to use the sub-VASS B\pazocal{B} only at the beginning to pump all c1,,cdc_{1},\ldots,c_{d} to their maximal values, and then schedule an appropriate computation of the sub-VASS A\pazocal{A}.

1 foreach j=1,,j=1,\ldots,\ell do
2      mj += mj1mj1;m_{j}\texttt{\,+=\,}m_{j-1}*m_{j-1};
3      foreach i=1,,di=1,\ldots,d do
4           if ti(j)=1\vec{t}_{i}(j)=1 then
5                if fi=jf_{i}=j then  si += mj;s_{i}\texttt{\,+=\,}m_{j};
6                if fijf_{i}\neq j then  a(i,j) += si;si += mja(i,j);a(i,j)\texttt{\,+=\,}s_{i};\ \ s_{i}\texttt{\,+=\,}m_{j}*a(i,j);
7               
8           end if
9          
10      end foreach
11     
12 end foreach
13
14foreach i=1,,di=1,\ldots,d do
15      ci += [si];c_{i}\texttt{\,+=\,}[s_{i}];                                                                             inoutyy
16     + xxx += [y]x\texttt{\,+=\,}[y]
17 end foreach
VASS Program 4 The “pumping” VASS B\pazocal{B}

B.4 A Proof of Lemma 3.8

First, let us restate Lemma 3.8.

See 3.8

Let A\pazocal{A} be a strongly connected VASS. For every cycle γ\gamma of A\pazocal{A}, let Δ(γ)\Delta(\gamma) be the sum of the counter update vectors of the transitions executed along γ\gamma.

First we will need the following result of [13]. Let E\pazocal{E} be the set of all counters cc such that CA[c]2Ω(n)\pazocal{C}_{\pazocal{A}}[c]\in 2^{\Omega(n)}. Then there exists an iteration scheme for E\pazocal{E}, i.e., a sequence of cycles γ1,,γk\gamma_{1},\ldots,\gamma_{k} such that every counter strictly decremented by some Δ(γi)\Delta(\gamma_{i}) is strictly incremented by i=1kΔ(γi)\sum_{i=1}^{k}\Delta(\gamma_{i}). Furthermore, E\pazocal{E} is precisely the set of all counters strictly incremented by i=1kΔ(γi)\sum_{i=1}^{k}\Delta(\gamma_{i}). In [13], it is shown that an iteration scheme can be “iterated exponentially many times”, producing a computation of length 2O(n)2^{\pazocal{O}(n)} such that all counters of E\pazocal{E} are simultaneously pumped to the value 2Ω(n)2^{\Omega(n)} (see Lemma 10 in [13]).

Second, every counter cc such that CA[c]O(nk)\pazocal{C}_{\pazocal{A}}[c]\in\pazocal{O}(n^{k}) can be pumped to the value Ω(nk)\Omega(n^{k}) by a computation of polynomial length (using the results of [19], it is easy to show that the length of the computation can be bounded by O(nk+1)\pazocal{O}(n^{k+1}); for our purposes, even a singly exponential bound is 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\vec{n}. Now let 𝐯d\mathbf{v}\in\mathbb{N}_{\infty}^{d}. Consider a VASS A^𝐯\hat{\pazocal{A}}_{\mathbf{v}} obtained by first modifying A\pazocal{A} into A𝐯\pazocal{A}_{\mathbf{v}} (i.e., for every cic_{i} such that 𝐯i=\mathbf{v}_{i}=\infty, every counter update vector 𝐮\mathbf{u} of A\pazocal{A} is modified so that 𝐮i=0\mathbf{u}_{i}=0, see Section 3.2), and then extending A𝐯\pazocal{A}_{\mathbf{v}} into A^𝐯\hat{\pazocal{A}}_{\mathbf{v}} by the construction of Proposition 3.7. That is, A^𝐯\hat{\pazocal{A}}_{\mathbf{v}} is obtained from A𝐯\pazocal{A}_{\mathbf{v}} by adding the gadget pumping every counter cic_{i} such the 𝐯i=k<\mathbf{v}_{i}=k<\infty to Θ(nk)\Theta(n^{k}) from an initial configuration where all counters are set to nn. Now, the above results are applicable to A^𝐯\hat{\pazocal{A}}_{\mathbf{v}}. That is, for every counter cic_{i} such that 𝐯i\mathbf{v}_{i}\neq\infty, there exist

  • a control state piQp_{i}\in Q,

  • an infinite family τ1i,τ2i,\tau^{i}_{1},\tau^{i}_{2},\ldots of strategies for player Demon in A^𝐯\hat{\pazocal{A}}_{\mathbf{v}},

  • a function Si:S_{i}:\mathbb{N}\rightarrow\mathbb{N} such that Si2O(n)S_{i}\in 2^{\pazocal{O}(n)},

such that for every nn\in\mathbb{N}, the value of cic_{i} in the configuration reached by applying τni\tau^{i}_{n} from pinp_{i}\vec{n} until a maximal computation is obtained or Si(n)S_{i}(n) transitions are executed, is

  • Θ(nk)\Theta(n^{k}) if CA^𝐯[c]Θ(nk)\pazocal{C}_{\hat{A}_{\mathbf{v}}}[c]\in\Theta(n^{k}),

  • 2Ω(n)2^{\Omega(n)} if CA^𝐯[c]2Ω(n)\pazocal{C}_{\hat{A}_{\mathbf{v}}}[c]\in 2^{\Omega(n)}.

By applying the observations of Proposition 3.7, we can safely assume that pi=inp_{i}=\textit{in} where in is the distinguished starting state of the pumping gadget, and the above computations never revisit the control state in after passing through the control state out of the gadget. Let Pi(n)P_{i}(n) be the length of the computation from configuration inn\textit{in}\thinspace\vec{n} under strategy τni\tau^{i}_{n} until the control state out is reached (and \infty if out is never reached), and let Ti:T_{i}:\mathbb{N}\rightarrow\mathbb{N} be such that Ti(n)=max(0,Si(n)Pi(n)1)T_{i}(n)=\max(0,S_{i}(n)-P_{i}(n)-1). Note that Ti2O(n)T_{i}\in 2^{\pazocal{O}(n)}.

For every i{1,,d}i\in\{1,\ldots,d\}, let Gadgeti(n)\textit{Gadget}_{i}(n) be the maximal value of cic_{i} achievable by running the pumping gadget of A^𝐯\hat{A}_{\mathbf{v}} from the control state in where all counters are initialized to nn (cf. VASS Program 4). Recall that Gadgeti(n)Θ(n𝐯i)\textit{Gadget}_{i}(n)\in\Theta(n^{\mathbf{v}_{i}}). Also let Gadget(n)=(Gadget1(n),,Gadgetd(n))\textit{Gadget}(n)=(\textit{Gadget}_{1}(n),\dots,\textit{Gadget}_{d}(n)).

Let FF be a 𝐯\mathbf{v}-consistent function. We define a function R:R:\mathbb{N}\rightarrow\mathbb{N} such that R(n)R(n) is the largest mm satisfying the following condition:

  • Fi(n)/dGadgeti(m)+|Q|M\lfloor F_{i}(n)/d\rfloor\geq\textit{Gadget}_{i}(m)+|Q|\cdot M for every i{1,,d}i\in\{1,\ldots,d\}, where QQ are the control states of A\pazocal{A} and MM is the maximal absolute value of an update vector component of A\pazocal{A};

Observe that RΘ(n)R\in\Theta(n). For every nn\in\mathbb{N} and i{1,,d}i\in\{1,\ldots,d\} such that 𝐯i\mathbf{v}_{i}\neq\infty, consider a Demon’s strategy ϱni\varrho^{i}_{n} in A\pazocal{A} defined as follows: Let qq be the control state visited by the strategy τR(n)i\tau^{i}_{R(n)} right after leaving the control state out of the pumping gadget of A^𝐯\hat{A}_{\mathbf{v}}. The strategy ϱni\varrho^{i}_{n} takes the shortest path to qq and then starts to behave exactly like τR(n)i\tau^{i}_{R(n)}. Note that ϱni\varrho^{i}_{n} can faithfully simulate τR(n)i\tau^{i}_{R(n)} either until τR(n)i\tau^{i}_{R(n)} produces a maximal computation (for initial configuration qGadget(R(n))q\thinspace\textit{Gadget}(R(n))) or for at least Ti(R(n))T_{i}(R(n)) steps, which is sufficient to pump the counter cic_{i} to Θ(nk)\Theta(n^{k}) if C𝐯[ci]Θ(nk)\pazocal{C}_{\mathbf{v}}[c_{i}]\in\Theta(n^{k}), or to 2Ω(n)2^{\Omega(n)} if C𝐯[ci]2Ω(n)\pazocal{C}_{\mathbf{v}}[c_{i}]\in 2^{\Omega(n)}. The strategy πn\pi_{n} is obtained by “concatenating” all ϱni\varrho^{i}_{n} (for all counters cic_{i} such that 𝐯i\mathbf{v}_{i}\neq\infty), where ϱni\varrho^{i}_{n} is executed either for Ti(R(n))T_{i}(R(n)) steps since initiating the simulation of τR(n)i\tau^{i}_{R(n)} or until τR(n)i\tau^{i}_{R(n)} produces a maximal computation. Note that each simulation of τR(n)i\tau^{i}_{R(n)} "assumes" that the counters are set to Gadget(R(n))\textit{Gadget}(R(n)), and therefore the most any ϱni\varrho^{i}_{n} can lower any counter cjc_{j} is by Gadgetj(R(n))+|Q|M\textit{Gadget}_{j}(R(n))+|Q|\cdot M. Therefore we can assume that πn\pi_{n} "splits the counters into dd boxes" of size F(n)/d\lfloor F(n)/d\rfloor, and performs each simulation in it’s own box. Hence, no simulation can "undo" the effect of the previous simulations. Also let S(n)S(n) be the maximal number of steps πn\pi_{n} takes until the last simulation ϱni\varrho^{i}_{n} is finished from initial configuration pF(n)pF(n) for any pQp\in Q. The total length of the whole simulation is bounded by S(n)i,𝐯i(|Q|+Ti(R(n))S(n)\leq\sum_{i,\mathbf{v}_{i}\neq\infty}\left(|Q|+T_{i}(R(n)\right). Observe that S(n)2O(n)S(n)\in 2^{\pazocal{O}(n)}, and for every counter cic_{i} such that 𝐯i=\mathbf{v}_{i}=\infty we have that the value of cic_{i} after performing πn\pi_{n} in the above indicated way is at least Fi(n)/d\lfloor F_{i}(n)/d\rfloor, which is 2Ω(n)2^{\Omega(n)}, since the ii-th box "remains untouched".

B.5 An Algorithm Computing VectorsA\textit{Vectors}_{\pazocal{A}}

In this section, we present an algorithm computing the set VectorsA(η)\textit{Vectors}_{\pazocal{A}}(\eta) for every SCC η\eta of DA\pazocal{D}{A}. Recall that VectorsA(η)\textit{Vectors}{A}(\eta) consists of all 𝐮\mathbf{u} such that there is a path η1,,ηm\eta_{1},\ldots,\eta_{m} where η1\eta_{1} is a root of DA\pazocal{D}{A}, ηm=η\eta_{m}=\eta, and 𝐮=𝐯m\mathbf{u}=\mathbf{v}_{m}.

The sets VectorsA(η)\textit{Vectors}_{\pazocal{A}}(\eta) are computed by Algorithm 5. In particular, at lines 55, VectorsA(η)\textit{Vectors}{A}(\eta) is set to Vη(1)\pazocal{V}_{\eta}(\vec{1}) for every root η\eta of D(A)\pazocal{D}(\pazocal{A}). The algorithm then follows the top-down acyclic structure of D(A)\pazocal{D}(\pazocal{A}) and computes VectorsA(η)\textit{Vectors}{A}(\eta) for the remaining components.

input : A Demonic decomposition D(A)\textnormal{{D}}(\pazocal{A}) of a demonic VASS A\pazocal{A}
output : The function VectorsA\textit{Vectors}{A}
1 foreach vertex μ\mu of D(A)\textnormal{{D}}(\pazocal{A}) do
2      VectorsA(μ):=\textit{Vectors}{A}(\mu):=\emptyset
3     
4 end foreach
5 𝐴𝑢𝑥:=\mathit{Aux}:= the set of all vertices of D(A)\textnormal{{D}}(\pazocal{A})
6 foreach η𝐴𝑢𝑥\eta\in\mathit{Aux} where η\eta is a root of D(A)\textnormal{{D}}(\pazocal{A}) do
7      VectorsA(η):={Vη(1)}\textit{Vectors}{A}(\eta):=\{\pazocal{V}_{\eta}(\vec{1})\}
8      𝐴𝑢𝑥:=𝐴𝑢𝑥{η}\mathit{Aux}:=\mathit{Aux}\smallsetminus\{\eta\}
9     
10 end foreach
11 while 𝐴𝑢𝑥\mathit{Aux}\neq\emptyset do
12      η:=\eta:= an element of 𝐴𝑢𝑥\mathit{Aux} such that Pre(η)𝐴𝑢𝑥=\textit{Pre}(\eta)\cap\mathit{Aux}=\emptyset
13      𝐴𝑢𝑥:=𝐴𝑢𝑥{η}\mathit{Aux}:=\mathit{Aux}\smallsetminus\{\eta\}
14      foreach μPre(η)\mu\in\textit{Pre}(\eta) do
15           foreach 𝐯VectorsA(μ)\mathbf{v}\in\textit{Vectors}{A}(\mu) do
16                VectorsA(η):=VectorsA(η){Vη(𝐯)}\textit{Vectors}{A}(\eta):=\textit{Vectors}{A}(\eta)\cup\{\pazocal{V}_{\eta}(\mathbf{v})\}
17           end foreach
18          
19      end foreach
20     
21 end while
Algorithm 5 Computing the function VectorsA\textit{Vectors}{A}

Appendix C Proofs for Section 4

C.1 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} lower bounds of Theorem 4.1

In this section, we prove the 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} lower bounds of Theorem 4.1. We use a modified construction of Lemma 3.3 to obtain a reduction from the QBF problem. Intuitively, the only change is that Angel determines the assignment for universally quantified propositional variables. Let us note that in the original construction of [12], Angel also selected the clause to be checked. Here, we use the construction of Lemma 3.3 based on the min\min gadgets. Let

ψx1y1x2yvC1Cm\psi\quad\equiv\quad\forall x_{1}\,\exists y_{1}\,\forall x_{2}\ldots\exists y_{v}\ C_{1}\wedge\ldots\wedge C_{m}

be a quantified Boolean formula where each clause CiC_{i} contains precisely three literals (recall that the (in)validity of a given quantified Boolean formula is a 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} complete problem).

Consider the VASS game Aψ\pazocal{A}_{\psi} defined by the VASS Program 6, where k2k\geq 2 is a constant. Note that the only difference between Aψ\pazocal{A}_{\psi} and the demonic VASS Aφ\pazocal{A}_{\varphi} (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 gadget for 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ψ\pazocal{A}_{\psi}, including the states in gadgets pumping the xi,yix_{i},y_{i} counters, are demonic. Using the observations of Lemma 3.3, it is easy to see that

  • if ψ\psi is valid, then LAψΘ(nk+1)\pazocal{L}_{\pazocal{A}_{\psi}}\in\Theta(n^{k+1}) and CAψ[sm]Θ(nk)\pazocal{C}_{\pazocal{A}_{\psi}}[s_{m}]\in\Theta(n^{k});

  • if ψ\psi is not valid, then LAψΘ(nk)\pazocal{L}_{\pazocal{A}_{\psi}}\in\Theta(n^{k}) and CAψ[sm]Θ(n)\pazocal{C}_{\pazocal{A}_{\psi}}[s_{m}]\in\Theta(n).

From this we immediately obtain the 𝐏𝐒𝐏𝐀𝐂𝐄\mathbf{PSPACE} lower bounds of Theorem 4.1.

1 d2 += d1e1;d3 += d2e2;;dk += dk1ek1;d_{2}\texttt{\,+=\,}d_{1}*e_{1};\ \ d_{3}\texttt{\,+=\,}d_{2}*e_{2};\ \cdots\ ;\ \ d_{k}\texttt{\,+=\,}d_{k-1}*e_{k-1};
2 foreach i=1,,vi=1,\ldots,v do
3    A-choose:  xi += dkx_{i}\texttt{\,+=\,}d_{k} or x¯i += dk;\bar{x}_{i}\texttt{\,+=\,}d_{k};
4    D-choose:  yi += dky_{i}\texttt{\,+=\,}d_{k} or y¯i += dk;\bar{y}_{i}\texttt{\,+=\,}d_{k};
5   
6 end foreach
7s0 += dk;s_{0}\texttt{\,+=\,}d_{k};
8 foreach i=1,,mi=1,\ldots,m do
9    D-choose:  si += min(1i,si1)s_{i}\texttt{\,+=\,}\min(\ell^{i}_{1},s_{i-1}) or si += min(2i,si1)s_{i}\texttt{\,+=\,}\min(\ell^{i}_{2},s_{i-1}) or si += min(3i,si1);s_{i}\texttt{\,+=\,}\min(\ell^{i}_{3},s_{i-1});
10   
11 end foreach
f += smnf\texttt{\,+=\,}s_{m}*n
VASS Program 6 Aψ\pazocal{A}_{\psi}

C.2 A Proof of Proposition 4.4

First, let us restate the proposition.

See 4.4

Convention. For notation simplification, we assume that the counter update vector 𝐮\mathbf{u} in every transition (p,𝐮,q)(p,\mathbf{u},q) where pp is angelic satisfies 𝐮=0\mathbf{u}=\vec{0} (a transition (p,𝐮,q)(p,\mathbf{u},q) where 𝐮0\mathbf{u}\neq\vec{0} can be split into (p,0,q)(p,\vec{0},q^{\prime}), (q,𝐮,q)(q^{\prime},\mathbf{u},q) where qq^{\prime} is a fresh demonic state).

Let us fix a vertex ([p],L)([p],L) of GA\pazocal{G}{A}, a vector 𝐯d\mathbf{v}\in\mathbb{N}^{d}_{\infty}, and a counter cic_{i} such that 𝐯i\mathbf{v}_{i}\neq\infty. First, consider the case when ([p],L)([p],L) is a leaf of GA\pazocal{G}{A}. Then ([p],L)([p],L) is demonic, and can be seen as a strongly connected demonic VASS. The claim follows trivially by applying Lemma 3.8 to ([p],L)([p],L) and 𝐯\mathbf{v}.

Now suppose that ([p],L)([p],L) is a demonic vertex of GA\pazocal{G}{A} with successors ([q1],L),,([qm],L)([q_{1}],L),\ldots,([q_{m}],L). Note that ([p],L)([p],L) can be seen as a strongly connected demonic VASS after deleting all transitions from/to the states outside ([p],L)([p],L). Let FF be a 𝐯\mathbf{v}-consistent function. By applying Lemma 3.8 to ([p],L)([p],L), the vector 𝐯\mathbf{v}, and FF, we obtain an infinite family of Demon’s strategies Π\Pi and a function S2O(n)S\in 2^{\pazocal{O}(n)} such that the vector G(n)G(n) of counter values in the last configuration of βn[𝐯,p,F,Π,S]\beta_{n}[\mathbf{v},p,F,\Pi,S] satisfies the following for every {1,,d}\ell\in\{1,\ldots,d\}:

  • G(n)Θ(nk)G_{\ell}(n)\in\Theta(n^{k}) if 𝐯\mathbf{v}_{\ell}\neq\infty and C([p],L)p[c,𝐯]Θ(nk)\pazocal{C}^{p}_{([p],L)}[c_{\ell},\mathbf{v}]\in\Theta(n^{k});

  • G(n)2Ω(n)G_{\ell}(n)\in 2^{\Omega(n)} if 𝐯=\mathbf{v}_{\ell}=\infty or C([p],L)p[c,𝐯]2Ω(n)\pazocal{C}^{p}_{([p],L)}[c_{\ell},\mathbf{v}]\in 2^{\Omega(n)}.

Let 𝐮=V([p],L)(𝐯)\mathbf{u}=\pazocal{V}_{([p],L)}(\mathbf{v}), where V\pazocal{V} is the function defined in Section 3.2. Note that GG is a 𝐮\mathbf{u}-consistent function. If 𝐮i=\mathbf{u}_{i}=\infty, we define π𝐯\pi_{\mathbf{v}} as the strategy which behaves like the strategy πn\pi_{n} of Π\Pi for every computation of AL\pazocal{A}_{L} initiated in pF(n)p\,F(n). Clearly, max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in 2^{\Omega(n)} for every Angel’s strategy σ\sigma. If 𝐮i\mathbf{u}_{i}\neq\infty, for every j{1,,m}j\in\{1,\ldots,m\} we apply the induction hypothesis to ([qj],L)([q_{j}],L), the vector 𝐮\mathbf{u}, the counter cic_{i}, and the 𝐮\mathbf{u}-consistent function GG. Thus, we obtain that for every j{1,,m}j\in\{1,\ldots,m\} one of the following possibilities holds:

  • There exists a kjk_{j}\in\mathbb{N}, a simple locking Angel’s strategy σ𝐮j\sigma^{j}_{\mathbf{u}} in AL\pazocal{A}_{L} and a Demon’s strategy π𝐮j\pi^{j}_{\mathbf{u}} in AL\pazocal{A}_{L} such that σ𝐮j\sigma^{j}_{\mathbf{u}} is independent of GG and

    • for every Demon’s strategy π\pi in AL\pazocal{A}_{L}, we have max[ci](𝐶𝑜𝑚𝑝ALσ𝐮j,π(qjG(n)))O(nkj)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma^{j}_{\mathbf{u}},\pi}(q_{j}\,G(n)))\in\pazocal{O}(n^{k_{j}});

    • for every Angel’s strategy σ\sigma in AL\pazocal{A}_{L}, we have max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐮j(qjG(n)))Ω(nkj)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi^{j}_{\mathbf{u}}}(q_{j}\,G(n)))\in\Omega(n^{k_{j}}).

  • There is a Demon’s strategy π𝐮j\pi^{j}_{\mathbf{u}} in AL\pazocal{A}_{L} such that for every Angel’s strategy σ\sigma in AL\pazocal{A}_{L} we have that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐮j(qjG(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi^{j}_{\mathbf{u}}}(q_{j}\,G(n)))\in 2^{\Omega(n)}.

We distinguish two cases:

  • There is j{1,,m}j\in\{1,\ldots,m\} such that the second possibility holds. Let π𝐯\pi_{\mathbf{v}} be a Demon’s strategy such that, for an initial configuration pF(n)p\,F(n), π𝐯\pi_{\mathbf{v}} starts by simulating the strategy πn\pi_{n} of Π\Pi until a configuration with the G(n)G(n) vector of counter values is reached. Then, π𝐯\pi_{\mathbf{v}} takes the shortest path to a configuration qj𝐰q_{j}\mathbf{w}, and then switches to simulating π𝐮j\pi^{j}_{\mathbf{u}} for the initial configuration qjG(n)q_{j}G(n^{\prime}) where nn^{\prime}\in\mathbb{N} is the largest number such that G(n)𝐰G(n^{\prime})\leq\mathbf{w}. The properties of π𝐮j\pi^{j}_{\mathbf{u}} (see above) imply that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in 2^{\Omega(n)} for an arbitrary Angel’s strategy σ\sigma.

  • For all j{1,,m}j\in\{1,\ldots,m\}, the first possibility holds. Let kk be the maximum of all kjk_{j} for j{1,,m}j\in\{1,\ldots,m\}. Furthermore, let σ𝐯\sigma_{\mathbf{v}} be a simple locking strategy which for a computation initiated in pF(n)p\,F(n) behaves like the simple locking strategy σ𝐮j\sigma_{\mathbf{u}}^{j} when the computation enters a control state of ([qj],L)([q_{j}],L). Note that a computation initiated in pF(n)p\,F(n) cannot visit an angelic control state before leaving the component ([p],L)([p],L), and the decisions taken by simple locking strategies may depend on the sequence of previously visited components of GA\pazocal{G}{A}. Hence, σ𝐯\sigma_{\mathbf{v}} is a simple locking strategy. For every Demon’s strategy π\pi, we have that max[ci](𝐶𝑜𝑚𝑝ALσ𝐯,π(pF(n)))O(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma_{\mathbf{v}},\pi}(p\,F(n)))\in\pazocal{O}(n^{k}) by our choice of kk and the properties of σ𝐮j\sigma_{\mathbf{u}}^{j} strategies (see above). Now consider the Demon’s strategy π𝐯\pi_{\mathbf{v}} defined in the same way as in the previous case, where jj is the index such that k=kjk=k_{j}. Then, the properties of π𝐮j\pi^{j}_{\mathbf{u}} imply that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))Ω(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in\Omega(n^{k}) for an arbitrary Angel’s strategy σ\sigma.

Finally, suppose that ([p],L)([p],L) is angelic. Then [p]={p}[p]=\{p\}, and let (p,0,q1),,(p,0,qm)(p,\vec{0},q_{1}),\ldots,(p,\vec{0},q_{m}) be the outgoing transitions of pp (see the Convention above). For every j{1,,m}j\in\{1,\ldots,m\}, let Lj=L{(p,0,qj)}L_{j}=L\cup\{(p,\vec{0},q_{j})\}. Let FF be a 𝐯\mathbf{v}-consistent function. By induction hypothesis, for every j{1,,m}j\in\{1,\ldots,m\}, one of the following possibilities holds:

  • there exists a kjk_{j}\in\mathbb{N}, a simple locking Angel’s strategy σ𝐯j\sigma^{j}_{\mathbf{v}} in ALj\pazocal{A}_{L_{j}} and a Demon’s strategy π𝐯j\pi^{j}_{\mathbf{v}} in ALj\pazocal{A}_{L_{j}} such that σ𝐯j\sigma^{j}_{\mathbf{v}} is independent of FF and

    • for every Demon’s strategy πj\pi^{j} in ALj\pazocal{A}_{L_{j}}, we have max[ci](𝐶𝑜𝑚𝑝ALjσ𝐯j,πj(pF(n)))O(nkj)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L_{j}}}^{\sigma^{j}_{\mathbf{v}},\pi^{j}}(p\,F(n)))\in\pazocal{O}(n^{k_{j}});

    • for every Angel’s strategy σj\sigma^{j} in ALj\pazocal{A}_{L_{j}}, we have max[ci](𝐶𝑜𝑚𝑝ALjσj,π𝐯j(pF(n)))Ω(nkj)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L_{j}}}^{\sigma^{j},\pi^{j}_{\mathbf{v}}}(p\,F(n)))\in\Omega(n^{k_{j}}).

  • there is a Demon’s strategy π𝐯j\pi^{j}_{\mathbf{v}} in ALj\pazocal{A}_{L_{j}} such that for every Angel’s strategy σj\sigma^{j} in ALj\pazocal{A}_{L_{j}} we have that max[ci](𝐶𝑜𝑚𝑝ALjσj,π𝐯j(pF(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L_{j}}}^{\sigma^{j},\pi^{j}_{\mathbf{v}}}(p\,F(n)))\in 2^{\Omega(n)}.

Strictly speaking, the induction hypothesis applies to the initial configurations qjF(n)q_{j}\,F(n), but since pp is a control state of ALjA_{L_{j}} and (p,0,qj)(p,\vec{0},q_{j}) is the only out-going transition of pp in ALj\pazocal{A}_{L_{j}}, the above claim follows immediately.

Let us first assume that there exists jj such that the first possibility holds. Then, we fix a jj such that kjk_{j} is minimal, and we put k=kjk=k_{j}. Consider a simple locking strategy σ𝐯\sigma_{\mathbf{v}} in AL\pazocal{A}_{L} which starts by locking the transition (p,0,qj)(p,\vec{0},q_{j}) and then proceeds by simulating the simple locking strategy σ𝐯j\sigma^{j}_{\mathbf{v}}. For every Demon’s strategy π\pi, we have that 𝐶𝑜𝑚𝑝ALσ𝐯,π(pF(n))\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma_{\mathbf{v}},\pi}(p\,F(n)) is the same computation as 𝐶𝑜𝑚𝑝ALjσ𝐯j,π(pF(n))\mathit{Comp}_{\pazocal{A}_{L_{j}}}^{\sigma^{j}_{\mathbf{v}},\pi}(p\,F(n)). Hence, max[ci](𝐶𝑜𝑚𝑝ALσ𝐯,π(pF(n)))O(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma_{\mathbf{v}},\pi}(p\,F(n)))\in\pazocal{O}(n^{k}) by induction hypothesis.

Now consider a Demon’s strategy π𝐯\pi_{\mathbf{v}} in AL\pazocal{A}_{L} defined as follows. Let q1𝐯1,,q𝐯q_{1}\mathbf{v}_{1},\ldots,q_{\ell}\mathbf{v}_{\ell} be a computation in AL\pazocal{A}_{L} initiated in a configuration pF(n)p\,F(n) such that qq_{\ell} is demonic. Furthermore, let αq1𝐮1q2𝐮2𝐮1q\alpha\equiv q_{1}\xrightarrow{\mathbf{u}_{1}}q_{2}\xrightarrow{\mathbf{u}_{2}}\cdots\xrightarrow{\mathbf{u}_{\ell-1}}q_{\ell} be the associated path in AL\pazocal{A}_{L}. The mode of α\alpha is the jj such that (p,0,qj)(p,\vec{0},q_{j}) is the last outgoing transition of pp occurring in α\alpha. The jj-th projection of π\pi, denoted by πj\pi_{j}, is then obtained by concatenating all subsequences of α\alpha initiated by the transition (p,0,qj)(p,\vec{0},q_{j}) and terminated either by the next occurrence of pp or by qq_{\ell}. Consider the computation γj\gamma_{j} in ALj\pazocal{A}_{L_{j}} obtained by performing πj\pi_{j} from the initial configuration pF(n)/mp\,\lfloor F(n)/m\rfloor, where F(n)/m(i)=Fi(n)/m\lfloor F(n)/m\rfloor(i)=\lfloor F_{i}(n)/m\rfloor. The transition selected by π𝐯\pi_{\mathbf{v}} after performing the computation q1𝐯1,,q𝐯q_{1}\mathbf{v}_{1},\ldots,q_{\ell}\mathbf{v}_{\ell} is the transition selected by π𝐯j\pi^{j}_{\mathbf{v}}, after performing γj\gamma_{j}. Intuitively, π𝐯\pi_{\mathbf{v}} “switches” among the strategies π𝐯1,,π𝐯m\pi^{1}_{\mathbf{v}},\ldots,\pi^{m}_{\mathbf{v}} according to the current mode, and thus simulates computations of AL1,,ALm\pazocal{A}_{L_{1}},\ldots,\pazocal{A}_{L_{m}} initiated in pF(n)/mp\,\lfloor F(n)/m\rfloor. The computation first reaching a terminal configuration is simulated completely. Hence, there exists jj such that 𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n))\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)) “subsumes” 𝐶𝑜𝑚𝑝ALσj,π𝐯j(pF(n)/m)\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma^{j},\pi^{j}_{\mathbf{v}}}(p\,\lfloor F(n)/m\rfloor), where σj\sigma^{j} is the “projection” of σ\sigma into ALj\pazocal{A}_{L_{j}}. This implies max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))Ω(nk)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in\Omega(n^{k}) by induction hypothesis and our choice of kk.

Finally, assume that the second possibility holds for all j{1,,m}j\in\{1,\ldots,m\}. Then, we construct a Demon’s strategy π𝐯\pi_{\mathbf{v}} in the same way as above, and conclude (by the same reasoning) that max[ci](𝐶𝑜𝑚𝑝ALσ,π𝐯(pF(n)))2Ω(n)\textit{max}[c_{i}](\mathit{Comp}_{\pazocal{A}_{L}}^{\sigma,\pi_{\mathbf{v}}}(p\,F(n)))\in 2^{\Omega(n)} for an arbitrary Angel’s strategy σ\sigma.