{'fraction_non_alphanumeric': 0.04510461008966579, 'fraction_numerical': 0.011910153065845485, 'mean_word_length': 3.539987664473684, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 27, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Reachability in Two-Clock Timed Automata is PSPACE-complete

A recent result of Haase et al. has shown that reachability in two-clock timed automata is log-space equivalent to reachability in bounded one-counter automata. We show that reachability in bounded one-counter automata is PSPACE-complete.


Introduction
Timed automata [1] are a successful and widely used formalism, which are used in the analysis and verification of real time systems. A timed automaton is a nondeterministic finite automaton that is equipped with a number of real-valued clocks, which allow the automaton to measure the passage of time.
Perhaps the most fundamental problem for timed automata is the reachability problem: given an initial state, can the automaton perform a sequence of transitions in order to reach a specified target state? In their seminal paper on timed automata [1], Alur and Dill showed that this problem is PSPACE-complete. To show hardness for PSPACE, their proof starts with a linear bounded automaton (LBA), which is a non-deterministic Turing machine with a fixed tape length n. They produce a timed automaton with 2n + 1 clocks, and showed that the timed automaton can reach a specified state if and only if the LBA halts.
However, the work of Alur and Dill did not address the case where the number of clocks is small. This was rectified by Courcoubetis and Yannakakis [4], who showed that reachability in timed automata with only three clocks is still PSPACE-complete. Their proof cleverly encodes the tape of an LBA in a single clock, and then uses the two additional clocks to perform all necessary operations on the encoded tape. In contrast to this, Laroussinie et al. have shown that reachability in one-clock timed automata is complete for NLOGSPACE, and therefore no more difficult than computing reachability in directed graphs [7].
The complexity of reachability in two-clock timed automata has been left open. The best known lower bound was given by Laroussinie et al., who gave a proof that the problem is NP-hard via a very natural reduction from subsetsum [7]. Moreover, the problem lies in PSPACE, because reachability in two-clock timed automata is obviously easier than reachability in three-clock timed automata. However, the PSPACE-hardness proof of Courcoubetis and Yannakakis seems to fundamentally require three clocks, and does not naturally extend to the two-clock case. Naves [8] has shown that several extensions to two-clock timed automata lead to PSPACE-completeness, but his work does not advance upon the NP-hard lower bound for unextended two-clock timed automata.
In a recent paper, Haase et al. have shown a link between reachability in timed automata and reachability in bounded counter automata [6]. A bounded counter automaton is a non-deterministic finite automaton equipped with a set of counters, and the transitions of the automaton may add or subtract arbitrary integer constants to the counters. The state space of each counter is bounded by some natural number b, so the counter may only take values in the range [0, b]. Moreover, transitions may only be taken if they do not increase or decrease a counter beyond the allowable bounds. This gives these seemingly simple automata a surprising amount of power, because the bounds can be used to implement inequality tests against the counters.
Haase et al. show that reachability in two-clock timed automata is log-space equivalent to reachability in bounded one-counter automata. Reachability in bounded one-counter automata has also been studied in the context of one-clock timed automata with energy constraints [2], where it was shown that the problem lies in PSPACE, and is NP-hard. It has also been shown that the reachability problem for unbounded one-counter automata is NP-complete [5], but the NP containment proof does not seem to generalise to bounded one-counter automata.
Our contribution. We show that satisfiability for quantified boolean formulas can be reduced, in polynomial time, to reachability in bounded one-counter automata. Hence, we show that reachability in bounded one-counter automata is PSPACE-complete, and therefore we resolve the complexity of reachability in two-clock timed automata. Our reduction uses two intermediate steps: subsetsum games and bounded counter-stack automata.
Counter automata are naturally suited for solving subset-sum problems, so our reduction starts with a quantified version of subset-sum, which we call subsetsum games. One interpretation of satisfiability for quantified boolean formulas is to view the problem as a game between an existential player, and a universal player. The players take in turns to set their propositions to true or false, and the existential player wins if and only if the boolean formula is satisfied. Subsetsum games follow the same pattern, but apply it to subset-sum: the two players alternate in choosing numbers from sets, and the existential player wins if and only if the chosen numbers sum to a given target. Previous work by Travers can be applied to show that subset-sum games are PSPACE-complete [9].
We reduce subset-sum games to reachability in bounded one-counter automata. However, we will not do this directly. Instead, we introduce bounded counter-stack automata, which are able to store multiple counters, but have a stack-like restriction on how these counters may be accessed. These automata are a convenient intermediate step, because having access to multiple counters makes it easier for us to implement subset-sum games. Moreover, the stack based restrictions means that it is relatively straightforward to to show that reachability in bounded counter-stack automata is reducible, in polynomial time, to reachability in bounded one-counter automata, which completes our result.

Bounded one-counter automata
A bounded one-counter automaton has a single counter that can store values between 0 and some bound b ∈ N. The automaton may add or subtract values from the counter, so long as the bounds of 0 and b are not overstepped. This can be used to test inequalities against the counter. For example, to test whether the counter is larger than some n ∈ N, we first attempt to subtract n + 1 from the counter, then, if that works, we add n + 1 back to the counter. This creates a sequence of two transitions which can be taken if, and only if, the counter is greater than n. A similar construction can be given for less-than tests. For the sake of convenience, we will include explicit inequality testing in our formal definition, with the understanding that this is not actually necessary.
We now give a formal definition. For two integers a, b ∈ Z we define [a, b] = {n ∈ Z : a ≤ n ≤ b} to be the subset of integers between a and b. A bounded one-counter automaton is defined by a tuple (L, b, ∆, l 0 ), where L is a finite set of locations, b ∈ N is a global counter bound, ∆ specifies the set of transitions, and l 0 ∈ L is the initial location. Each transition in ∆ has the form (l, p, g 1 , g 2 , l ′ ), where l and l ′ are locations, p ∈ [−b, b] specifies how the counter should be modified, and g 1 , g 2 ∈ [0, b] give lower and upper guards for the counter.
Each state of the automaton consists of a location l ∈ L along with a counter value c. Thus, we define the set of states to be L × [0, b]. A transition exists between a state (l, c) ∈ S, and a state (l ′ , c ′ ) ∈ S if there is a transition (l, p, g 1 , g 2 , l ′ ) ∈ ∆, where g 1 ≤ c ≤ g 2 , and c ′ = c + p.
The reachability problem for bounded one-counter automaton is: starting at the state (l 0 , 0), can the automaton reach a specified target state (l t , c t )? It has been shown that the reachability problem for bounded one-counter automata is equivalent to the reachability problem for two-clock timed automata.
Theorem 1 ( [6]). Reachability in bounded one-counter automata is log-space equivalent to reachability in two-clock timed automata.

Subset-sum games
A subset-sum game is played between an existential player and a universal player. The game is specified by a pair (ψ, T ), where T ∈ N, and ψ is a list: The game is played in rounds. In the first round, the universal player chooses an element from {A 1 , B 1 }, and the existential player responds by choosing an element from {E 1 , F 1 }. In the second round, the universal player chooses an element from {A 2 , B 2 }, and existential player responds by choosing an element from {E 2 , F 2 }. This pattern repeats for rounds 3 through n. Thus, at the end of the game, the players will have constructed a sequence of numbers, and the existential player wins if and only if the sum of these numbers is T .
Formally, the set of plays of the game is the set: A play P ∈ P is winning for the existential player if and only if P = T . A strategy for the existential player is a list of functions s = (s 1 , s 2 , . . . , s n ), where each function s i dictates how the existential player should play in the ith round of the game. Thus, each function s i is of the form: This means that the function s i maps the first i moves of the universal player to a decision for the existential player in the ith round.
A play P conforms to a strategy s if the decisions made by the existential player in P always agree with s. More formally, for each i in the range 1 ≤ i ≤ n, we define F i = P ∩ 1≤j≤i {A j , B j } to be the first i moves made by the universal player. The play P conforms to a strategy s = (s 1 , s 2 , . . . , s k ) if s i (F i ) ∈ P , for all i. Given a strategy s, we define the set of conforming plays to be Plays(s). Note that, since the universal player makes exactly n choices, the set Plays(s) contains exactly 2 n different plays.
A strategy s is winning if every play P ∈ Plays(s) is winning for the existential player. The subset-sum game problem is to decide, for a given SSG instance (ψ, T ), whether the existential player has a winning strategy for (ψ, T ).
The SSG problem clearly lies in PSPACE, because it can be solved on a polynomial time alternating Turing machine. A quantified version of subset-sum has been shown to be PSPACE-hard, via a reduction from quantified boolean formulas [9]. Since SSGs are essentially a quantified version of subset-sum, the proof of PSPACE-hardness easily carries over. See Appendix A for further details.

Counter-Stack Automata
Outline. In this section we ask: can we use a bounded one-counter automaton to store multiple counters? The answer is yes, but doing so forces an interesting set of restrictions on the way in which the counters are accessed. By the end of this section, we will have formalised these restrictions as counter-stack automata.
Suppose that we have a bounded-one counter automaton with counter c and bound b = 15. Hence, the width of the counter is 4 bits. Now suppose that we wish to store two 2-bit counters c 1 and c 2 in c. We can do this as follows: We allocate the top two bits of c to store c 2 , and the bottom two bits to store c 1 . We can easily write to both counters: if we want to increment c 2 then we add 4 to c, and if we want to increment c 1 then we add 1 to c. However, if we want to test equality, then things become more interesting. It is easy to test equality against c 2 : if we want to test whether c 2 = 2, then we test whether 8 ≤ c ≤ 11 holds. But, we cannot easily test whether c 1 = 2 because we would have to test whether c is 2, 6, 10, or 14, and this list grows exponentially as the counters get wider. However, if we know that c 2 = 1, then we only need to test whether c = 6. Thus, we arrive at the following guiding principal: if you want to test equality against c i , then you must know the values of c j for all j > i. Counter-stack automata are a formalisation of this principal.
Counter-stack automata. A counter-stack automaton has a set of k distinct counters, which are referred to as c 1 through c k . For our initial definitions, we will allow the counters to take all values from N, but we will later refine this by defining bounded counter-stack automata. The defining feature of a counter-stack automaton is that the counters are arranged in a stack-like fashion: -All counters may be increased at any time. When the automaton increases a counter, it adds a specified number n ∈ N to that counter. The automaton has the ability to perform equality tests against a counter, but the stack-based restrictions must be respected. An example of a valid equality test would be c k = 3 ∧ c k−1 = 10, because c k−1 = 10 only needs to be tested in the case where c k = 3 is known to hold. Conversely, the test c k−1 = 10 by itself is invalid, because it places no restrictions on the value of c k .
The automaton may also reset a counter, but the stack-based restrictions apply. Counter c i may only be reset by a transition, if that transition tests equality against the values of c i through c k . For example, c k−1 may only be reset if the transition is guarded by a test of the form c k−1 = n 1 ∧ c k−2 = n 2 .
Formal definition. A counter-stack automaton is a tuple (L, C, ∆, l 0 ), where L is a finite set of locations, C = [1, k] is a set of counter indexes, l 0 ∈ L is an initial state, and ∆ specifies the transition relation. Each transition in ∆ has the form (l, E, I, R, l ′ ) where: is defined for some i, then E(j) must be defined for all j ∈ C with j > i. -I ∈ N k specifies the how the counters must be increased, -R ⊆ C specifies the set of counters that must be reset. It is required that E(r) is defined for every r ∈ R.
Each state of the automaton is a location annotated with values for each of the k counters. That is, the state space of the automaton is L × N k . A state (l, c 1 , c 2 , . . . , c k ) can transition to a state (l ′ , c ′ 1 , c ′ 2 , . . . , c ′ k ) if, and only if, there exists a transition (l, E, I, R, l ′ ) ∈ ∆, where the following conditions hold: A run is a sequence of states s 0 , s 1 , . . . , s n , where each s i can transition to s i+1 . To solve the reachability problem for counter-stack automata, we must decide whether there is a run from (l 0 , 0, 0, . . . , 0) to a target state (l t , t 1 , t 2 , . . . , t k ).
A counter-stack automaton is b-bounded, for some b ∈ N, if it is impossible for the automaton to increase a counter beyond b. Formally, this condition requires that, for every state (l, c 1 , c 2 , . . . , c k ) that can be reached by a run from (l 0 , 0, 0, . . . , 0), we have c i ≤ b for all i. We say that a counter-stack automaton Simulation by a bounded one-counter automaton. A bounded counterstack automaton is designed to be simulated by a bounded one-counter automaton. To do this, we follow the construction outlined at the start of this section: we split the bits of the counter c into k chunks, where each chunk represents one of the counters c i . Note that the boundedness assumption is crucial, because otherwise incrementing c i may overflow the allotted space, and inadvertently modify the value of c i+1 . See Appendix B for more details of the construction.

Outline Of The Construction
Our goal is to show that reachability in bounded counter-stack automata is PSPACE-hard. To do this, we will show that subset-sum games can be solved by bounded counter-stack automata. In this section, we give an overview of our construction using the following two-round QSS game.
For brevity, we will refer to this instance as (ψ, T ) for the rest of this section. The construction is split into two parts: the play gadget, and the reset gadget. The play gadget. The play gadget is shown in Figure 1. The construction uses 9 counters. The locations are represented by circles, and the transitions are represented by edges. The annotations on the transitions describe the increments, resets, and equality tests: the notation c i + n indicates that n is added to counter i, the notation R(c i ) indicates that counter i is reset to 0, and the notation c i = n indicates that the transition may only be taken when c i = n is satisfied. This gadget allows the automaton to implement a play of the SSG. The locations u 1 and u 2 allow the automaton to choose the first and second moves of the universal player, while the locations e 1 and e 2 allow the automaton to choose the first and second moves for the existential player. As the play is constructed, a running total is stored in c 9 , which is the top counter on the stack. The final transition between w 1 and w 2 checks whether the existential player wins the play, and then resets c 9 . Thus, the set of runs between u 1 and w 2 corresponds precisely to the set of plays won by the existential player in the SSG.
In addition to this, each outgoing transition from u i or e i comes equipped with its own counter. This counter is incremented if and only if the corresponding edge is used during the play, and this allows us to check precisely which play was chosen. These counters will be used by the reset gadget. The idea behind our construction is to force the automaton to pass through the play gadget multiple times. Each time we pass through the play gadget, we will check a different play, and our goal is to check a set of plays that verify whether the existential player has a winning strategy for the SSG.
Which plays should be checked? In our example, we must check four plays. The format of these plays is shown in Table 1. Table 1. The set of plays that the automaton will check.
The table shows four different plays, which cover every possible strategy choice of the universal player. Clearly, if the existential player does have a winning strategy, then that strategy should be able to win against all strategy choices of the universal player. The plays are given in a very particular order: the first two plays contain A 1 , while the second two plays contain B 1 . Moreover, we always check A 2 , before moving on to B 2 .
We want to force the decisions made at e 1 and e 2 to form a coherent strategy for the existential player. In this game, a strategy for the existential player is a pair s = (s 1 , s 2 ), where s i describes the move that should be made at e i . It is critical to note that s 1 only knows whether A 1 or B 1 was chosen at u 1 . This restriction is shown in the table: the automaton may choose freely between E 1 and F 1 in the first play. However, in the second play, the automaton must make the same choice as it did in the first play. The same relationship holds between the third and fourth plays. These restrictions ensure that the plays shown in Table 1 are a description of a strategy for the existential player.

Fig. 2. The reset gadget
The reset gadget. The reset gadget, shown in Figure 2, enforces the constraints shown in Table 1. The locations w 2 and u 1 represent the same locations as they did in Figure 1. To simplify the diagram, we have only included meaningful equality tests. Whenever we omit a required equality test, it should be assumed that the counter is 0. For example, the outgoing transitions from r 2 implicitly include the requirement that c 7 , c 8 , and c 9 are all 0. We consider the following reachability problem: can (t, 0, 0, . . . , 0) be reached from (u 1 , 0, 0, . . . , 0)? The structure of the reset gadget places restrictions on the runs that reach t. All such runs pass through the reset gadget exactly four times, and the following table describes each pass: To see why these paths must be taken, observe that, for every i ∈ {1, 3}, each pass through the play gadget increments either c i or c i+1 , but not both. This means that the first time that we arrive at r 2 , we must take the transition directly to u 1 , because the guard on the transition to r ′ 1 cannot possibly be satisfied after a single pass through the play gadget. When we arrive at r 2 on the second pass, we are forced to take the transition to r ′ 1 , because we cannot have c 5 = 1 and c 6 = 0 after two passes through the play gadget. This transition resets both c 5 and c 6 , so the pattern can repeat again on the third and fourth visits to r 2 . The location r 1 behaves in the same way as r 2 , but the equality tests are scaled up, because r 1 is only visited on every second pass through the reset gadget.
We can now see that all strategies of the universal player must be considered. The transition between r 2 and u 1 forces the play gadget to increment c 5 , and therefore the first and third plays must include A 2 . Similarly, the transition between r 2 and r ′ 1 forces the second and fourth plays to include B 2 . Meanwhile, the transition between r 1 and u 1 forces the first and second plays to include A 1 , and the transition between r 1 and t forces the third and fourth plays to include B 1 . Thus, we select the universal player strategies exactly as Table 1 prescribes.
The transitions between r ′ 1 and r 1 check that the existential player is playing a coherent strategy. When the automaton arrives at r ′ 1 during the second pass, it verifies that either E 1 was included in the first and second plays, or that F 1 was included in the first and second plays. If this is not the case, then the automaton gets stuck. The counters c 3 and c 4 are reset when moving to r 1 , which allows the same check to occur during the fourth pass. For the sake of completeness, we have included the transitions between r ′ 2 and r 2 , which perform the same check for E 2 and F 2 . However, since the existential player is allowed to change this decision on every pass, the automaton can never get stuck at r ′ 2 . The end result is that location t can be reached if and only if the existential player has a winning strategy for (ψ, T ). As we will show in the next section, the construction extends to arbitrarily large SSGs, which then leads to a proof that reachability in counter-stack automata is PSPACE-hard. Note that all counters in this construction are bounded: c 9 is clearly bounded by the maximum value that can be achieved by a play of the SSG, and reset gadget ensures that no other counter may exceed 4. Thus, we will have completed our proof of PSPACEhardness for bounded one-counter automata and two-clock timed automata.

Formal Definition and Proof
Sequential strategies for SSGs. We start by formalising the ideas behind Table 1. Recall that the table gives a strategy for the existential player in the form of a list of plays. Moreover, the table gave a very specific ordering in which these plays must appear. We now formalise this ordering.
We start by dividing the integers in the interval [1, 2 n ] into i-blocks. The 1-blocks partition the interval into two equally sized blocks. The first 1-block consists of the range [1, 2 n−1 ], and the second 1-block consists of the range [2 n−1 + 1, 2 n ]. There are four 2-blocks, which partition the 1-blocks into two equally sized sub-ranges. This pattern continues until we reach the n-blocks.
Formally, for each i ∈ {1, 2, . . . , n}, then there are 2 i distinct i-blocks. The set of i-blocks can be generated by considering the intervals [k + 1, k + 2 n−i ] for the first 2 i numbers k ≥ 0 that satisfy k mod 2 n−i = 0. An i-block is even if k is an even multiple of 2 n−i , and it is odd if k is an odd multiple of 2 n−i .
The ordering of the plays in Table 1 can be described using blocks. There are four 2-blocks, and A 2 appears only in even 2-blocks, while B 2 only appears in odd 2-blocks. Similarly, A 1 only appears in the even 1-block, while B 1 only appears in the odd 1-block. The restrictions on the existential player can also be described using blocks: the existential player's strategy may not change between E i and F i during a i-block. We generalise this idea in the following definition.
Definition 4 (Sequential strategy). A sequential strategy for the existential player in (ψ, T ) is a list of 2 n plays S = P 1 , P 2 , . . . , P 2 n , where for every i-block L we have: -If L is an even i-block, then P j must contain A i for all j ∈ L.
-If L is an odd i-block, then P j must contain B i for all j ∈ L.
-We either have E i ∈ P j for all j ∈ L, or we have F i ∈ P j for all j ∈ L.
We say that S is winning for the existential player if P j = T for every P j ∈ S. Since a sequential strategy is simply a strategy written in the form of a list, we have the following lemma. See Appendix C for further details.

Lemma 5. The existential player has a winning strategy if and only if the existential player has a sequential winning strategy.
The base automaton. We describe the construction in two steps. Recall, from Figures 1 and 2, that the top counter is used by the play gadget to store the value of the play, and to test whether the play is winning. We begin by constructing a version of the automaton that omits the top counter. That is, if c k is the top counter, we modify the play gadget by removing all increases to c k , and the equality test for c k between w 1 and w 2 . We call this the base automaton. Later, we will add the constraints for c k back in, to construct the full automaton.
We now give a formal definition of the base automaton. Throughout this definition, we keep consistency with the location and counter names used in Figures 1 and 2. For each natural number n, we define a counter-stack automaton A n as follows. The automaton has the following set of locations The automaton uses k = 2n + 1 counters. The top counter c k is reserved for the full automaton, and will not be used in this construction. We will identify counters 1 through 2n using the following shorthands. For each integer i, we define a i = c 4(i−1)+1 , we define b i = c 4(i−1)+2 , we define e i = c 4(i−1)+3 , and we define f i = c 4(i−1)+4 . Note that, in Figure 1, we have a 1 = c 1 and a 2 = c 5 , and these are precisely the counters associated with A 1 and A 2 , respectively. The same relationship holds between b i and B i , and so on.
The transitions of the automaton are defined as follows. Whenever we omit a required equality test against a counter c i , it should be assumed that the transition includes the test c i = 0.
-Each location u i has two transitions to e i .
• A transition that adds 1 to a i .
• A transition that adds 1 to b i . -We define u n+1 to be a shorthand for w 1 . Each location e i has two transitions to u i+1 .
• A transition that adds 1 to e i .
• A transition that adds 1 to f i . -Location w 1 has a transition to w 2 , and w 2 has a transition to r ′ n . These transitions do not increase any counter, and do not test any equalities.
-Each location r ′ i has two outgoing transitions to r i . • A transition that tests e i = 2 n−i and f i = 0.
• A transition that tests e i = 0 and f i = 2 n−i .
-We define r ′ 0 to be shorthand for location t. Each location r i has two outgoing transitions.
• A transition to u 1 that tests a i = 2 n−i and b i = 0.
• A transition to r ′ i−1 that tests a i = 2 n−i and b i = 2 n−i .
Runs in the base automaton. We now describe the set of runs are possible in the base automaton. We decompose every run of the automaton into segments, such that each segment contains a single pass through the play gadget. More formally, we decompose R into segments R 1 , R 2 , . . . , where each segment R i starts at u 1 , and ends at the next visit to u 1 . We say that a run gets stuck if the run does not end at (t, 0, 0, . . . , 0), and if the final state of the run has no outgoing transitions. We say that a run R gets stuck during an i-block L if there exists a j ∈ L such that R j gets stuck. The following lemma gives a characterisation of the runs in A n . See Appendix D for further details. -If L is an even i-block, then R j must increment a i for every j ∈ L.
-If L is an odd i-block, then R j must increment b i for every j ∈ L.
-Either R j increments e i for every j ∈ L, or R j increments f i for every j ∈ L.
We say that a run is successful if it eventually reaches (t, 0, 0, . . . , 0). By definition, a run is successful if and only if it never gets stuck. Also, the transition from r 1 to t ensures that every successful run must have exactly 2 n segments. With these facts in mind, if we compare Lemma 6 with Definition 4, then we can see that the set of successful runs in A n corresponds exactly to the set of sequential strategies for the existential player in the SSG.
Since we eventually want to implement A n as a bounded one-counter automaton, it is important to prove the A n is bounded. We do this in the following Lemma. See Appendix E for full details. The full automaton. Let (ψ, T ) be an SSG instance, where ψ is: We will construct a counter-stack automaton A ψ from A n . Recall that the top counter c k is unused in A n . We modify the transitions of A n as follows. Let δ be a transition. If δ increments a i then it also adds A i to c k , if δ increments b i then it also adds B i to c k , if δ increments e i then it also adds E i to c k , and if δ increments f i then it also adds F i to c k . We also modify the transition between w 1 and w 2 , so that it checks whether c k = T , and resets c k .
Since we only add extra constraints to A n , the set of successful runs in A ψ is contained in the set of successful runs of A n . Recall that the set of successful runs in A n encodes the set of sequential strategies for the existential player in (ψ, T ). In A ψ , we simply check whether each play in the sequential strategy is winning for the existential player. Thus, we have shown the following lemma.
Lemma 8. The set of successful runs in A ψ corresponds precisely to the set of winning sequential strategies for the existential player in (ψ, T ).
We also have that A ψ is bounded. Counters c 1 through c k−1 are bounded due to Lemma 7, and counter c k is bounded by This completes the reduction from subset-sum games to bounded counter-stack automata, and gives us our main theorem.

Theorem 9. Reachability in bounded counter-stack automata is PSPACE-hard.
Corollary 10. We have: -Reachability in bounded one-counter automata is PSPACE-complete.

A Proof of Lemma 2
Outline. A quantified version of subset-sum has already been shown to be PSPACE-hard [9], and the proof easily carries over for the case of SSGs. For the sake of completeness, we provide a direct proof that SSGs are PSPACE-hard, which closely follows the ideas laid out in [9].
The proof follows the NP-hardness proof for subset-sum, taken from [3][Theorem 34.10]. The key observation is that, if we begin with a quantified version of 3-SAT, then we end up with an SSG.
Subset-sum is NP-hard. We now give a summary of the NP-hardness proof given in [3][Theorem 34.10]. We will describe the reduction using a worked example taken from [3]. Consider the following 3-CNF formula: This formula has three variables, x 1 , x 2 , and x 3 , and four clauses, C 1 through C 4 . The reduction assumes that there is no clause C i that contains both x i and ¬x i , because otherwise C i would be always be satisfied.
The reduction constructs a subset-sum instance, which is described in the following table: Each row should be read as a number written in decimal. For example, the first row specifies the number v 1 = 1001001. The subset-sum instance asks whether there is a subset of rows v 1 through s ′ 4 that sums to row t.
The table is constructed according to the following rules. Each column is labelled: the first three columns are labelled by the variables x 1 through x 3 , and the rest of the columns are labelled by the clauses C 1 through C 4 . For each variable x i we define two rows: v i has a 1 in column x i , and a 1 in every column C i that contains x i .
v ′ i has a 1 in column x i , and a 1 in every column C i that contains ¬x i .
In addition to these, for each clause C i we define two slack rows: the row s i has a 1 in column C i , and the row s ′ i has a 2 in column C i . To see that this reduction works, suppose that we know a satisfying assignment of the CNF formula. We can use this to construct a solution to the subset-sum instance. If x i is true in the satisfying assignment, then we select v i , and if it is false then we select v ′ i . In doing so, we construct a subset with the following properties: -For each column x i , we have that the sum of that column is 1, because we never select both v i and v ′ i . -For each column C i , we have that the sum of that column is at least 1, because every clause must be satisfied. -For each column C i , we have that the sum of that column is at most 3, because each clause contains exactly 3 variables.
These properties ensure that, for each column C i , we can always select a subset of the slack columns, s i and s ′ i , so that the sum of the column is 4. Thus, every satisfying assignment of the CNF formula corresponds to a solution of the subset-sum instance.
For similar reasons, every solution of the subset-sum instance corresponds to a satisfying assignment of the CNF formula, by simply ignoring the slack rows. Since every column C i must sum to 4, we know that after removing the slacks, each column must sum to at least 1. This, combined with the fact that v i and v ′ i cannot be selected at the same time, implies that we have a satisfying assignment for the CNF formula.
See [3] for a full proof correctness of the NP-hardness reduction.
Changing the format. Our definition of an SSG requires a very specific format for the input instance. In particular, each quantifier is associated with exactly two natural numbers. However, the reduction that we have described can be written down very naturally as a one-player SSG, in which only the existential player is allowed to move. For our example, the instance is (V S 1 S 2 S 3 S 4 , t), where: Note that it is valid to force the choice between v i and v ′ i , because no solution of the subset-sum instance can contain both of these numbers.
Subset-sum games are PSPACE-complete. It is now easy to reduce a quantified boolean formula to an SSG. We simply follow the existing reduction, but if variable x i is universally quantified, then we use ∀{v i , v ′ i } rather than ∃{v i , v ′ i }. For example, if we consider the quantified boolean formula ∀x 1 ∃x 2 ∀x 3 φ, where φ is defined as before, then we produce the quantified subset-sum instance (V ′ S 1 S 2 S 3 S 4 , t), where: and S i is defined as before. The final step is to ensure a strict alternation of quantifiers, which the definition of an SSG requires. This can easily be achieved by inserting "dummy" quantifiers, where necessary. That is, we can insert ∃{0, 0} between two consecutive ∀ quantifiers, and we can insert ∀{0, 0} between two consecutive ∃ quantifiers. This change obviously cannot affect the winner of the SSG.

B Proof of Lemma 3
Let S = (L, C, ∆, l 0 ) be a b-bounded counter-stack automaton. Without loss of generality, we will assume that b = 2 n − 1, which means that each counter in S is n bits wide. We will construct a bounded one-counter automaton B = (L ′ , b ′ , ∆ ′ , l ′ 0 ) that simulates S. We will refer to the counters of S as c 1 through c k , and the counter of B as c.
We will follow the approach laid out at the start of Section 4. That is, we will set the bound b ′ = 2 k·n − 1 so that c is k · n bits wide. We then partition these bits in order to implement the counters c 1 through c k . The counter c k will use the n most significant bits, the counter c k−1 will use the next n most significant bits, and so on.
We introduce some notation to formalise this encoding. Let x ∈ [0, b] be a counter value for counter c i . We define Enc(x, i) = x · 2 (i−1)·n . To understand this definition, note that for i = 1, we have Enc(x, i) = x. Then, for i = 2, we have that Enc(x, i) is the value of x bit-shifted to the left n times. Thus, this definition simply translates x to the correct position in c.
We can now define the translation. We will set L ′ = L and l ′ 0 = l 0 , which means that both automata have the same set of locations, and the same start location. We will use the transitions in ∆ ′ to simulate S. For each transition t = (l, E, I, R, l ′ ) ∈ ∆, we construct a transition t ′ = (l, p, g 1 , g 2 , l ′ ) ∈ ∆ ′ between the same pair of locations. We want to have the following property: transition t can be used from a state (l, c 1 , c 2 , . . . , c k ) in S if and only if transition t ′ can be used from the state (l, i Enc(c i , i)) in B.
We begin by defining p. We set: In other words, for each counter i / ∈ R that is not to be reset, we add Enc(I i , i) to c, which correctly adds I i to c i . Note that the boundedness assumption on S implies that the counters can never overflow due to this operation. For the counters i ∈ R, we subtract E(i) from c i . Recall that E(i) must always be defined for the indices i ∈ R. Furthermore, the transition may only be taken if c i = E(i). Thus, subtracting E(i) from c i will correctly set it to 0.
Next we define the inequality tests. Let j be the smallest index for which E(j) is defined. Our guards are: Enc(E(i), i), It is straightforward to show that, in our encoding scheme, we have c i = E(i) for all i ≥ j if and only if g 1 ≤ c ≤ g 2 .
If we are given a target state s = (t, c 1 , c 2 , . . . , c k ) for S, then we can translate it into a target state s ′ = (t, i Enc(c i , i)) for B. The equivalence between the transitions in ∆, and the transitions in ∆ ′ implies that s can be reached from (l 0 , 0, 0, . . . , 0) if and only if s ′ can be reached from (l ′ 0 , 0). This completes the proof of Lemma 3.

C Proof of Lemma 5
Let s = (s 1 , s 2 , . . . , s n ) be a winning strategy for the existential player. We define a sequential winning strategy as follows. Recall that Plays(s) contains exactly 2 n plays. We argue that these plays can be ordered so that they form a sequential strategy. We give an iterative procedure that achieves this task: the first step of the procedure will ensure that the 1-blocks contain the correct plays, the second step will ensure that the 2-blocks contain the correct plays, and so on. In the first step, we observe that exactly 2 n−1 of the plays contain A 1 , while exactly 2 n−1 of the plays contain B 1 , so we can order the plays so that the even 1-block contains all plays containing A 1 . Now suppose that we have found the i-blocks. We observe that each i-block L has exactly 2 n−(i+1) plays that contain A i+1 . Therefore, for each i-block L, we can order the plays in L so that the even (i + 1)-block has all plays that contain A i+1 , and the odd (i + 1)-block has all plays that contain B i+1 . At the end of this procedure, we will have a list of plays S = P 1 , P 2 , . . . , P 2 n where: -P j contains A i whenever j is in an even i-block.
-P j contains B i whenever j is in an odd i-block.
So S satisfies the first two conditions of Definition 4. We argue that S also satisfies the third condition. Let L be an i-block. By definition, for every j < i, there is a unique j-block that contains L. These blocks define a play prefix F ∈ Π 1≤j≤i {A i , B i }, and, for each play P j with j ∈ L, we have F ⊆ P j . Since S is a reordering of Plays(s), we must have s i (F ) ∈ P j for every j ∈ L. Hence, S satisfies Definition 4. Moreover, since s is winning, we have that every play in Plays(s) is winning, and therefore S is a sequential winning strategy. Now let S = P 1 , P 2 , . . . , P 2 n be a winning sequential strategy. We give a high level description of a winning strategy for the SSG. At the start of the strategy we set L 0 = [1, 2 n ]. In each round i of the game, let D i ∈ {A i , B i } be the decision made by the universal player. We select L i to be the unique i-block in L i−1 such that D i ∈ P j for all j ∈ L i . We play E i if E i ∈ P j for all j ∈ L i , and we play F i if F i ∈ P j for all j ∈ L i . It is straightforward to encode this strategy in the form s = (s 1 , s 2 , . . . , s n ). By construction, when we play s, the outcome of the game will be some play P j from S. Since every play P j in S is winning for the existential player, we have that s is a winning strategy.

D Proof of Lemma 6
Let R be a run in A n . The following lemma describes the set of reset states that each segment of R must pass through.
Lemma 11. Let R be a run in A n . Either: -R j visits precisely the reset locations {r ′ i , r i } for which j mod 2 n−i = 0, or -R j gets stuck.
Proof. We will prove this lemma by induction over i. The base case, where i = n, is trivial because j mod 2 n−n is always equal to 0, and it is clear from the construction that every segment R j must always visit both r ′ n and r n . For the inductive step, suppose that the lemma has been shown for i + 1, and will show that the lemma holds for i. We know that, in order to reach r ′ i or r i , a segment must first visit r ′ i+1 . By the inductive hypothesis, we know that only segments R j with j mod 2 n−(i+1) visit r i+1 . At the start of R, we have a i = b i = 0. On the first visit to r i+1 , we clearly cannot take the transition to r ′ i , because we have a i + b i = 2 n−(i+1) , and the transition to r ′ i requires a i + b i = 2 n−i . Thus, we either have to take the transition to u 1 , or we get stuck. On the second visit to r i+1 , we cannot take the transition to u 1 , because we have a i + b i = 2 n−i , and the transition to u 1 requires a i + b i = 2 n−(i+1) . Thus, either we get stuck, or we take the transition to r ′ i . The transition between r i+1 and r ′ i resets a i and b i . Thus, we can repeat the argument, and conclude that locations r ′ i and r i are only visited by segments R j where j mod 2 n−i = 0. ⊓ ⊔ Having shown Lemma 11 it is now easy to prove Lemma 6. Let R be a run of A n . For the counters a i and b i , we have the following facts: -At the start of the first i-block, we have a i = b i = 0.
-Each i-block contains exactly 2 n−i segments. Each segment must increment one of a i or b i , but not both. -At the end of each odd i-block, we must take the transition from r i to u 1 to avoid getting stuck. This transition requires a i = 2 n−i and b i = 0.
-At the end of each even i-block, we must take the transition from r i to r ′ i−1 to avoid getting stuck. This transition requires a i = 2 n−i and b i = 2 n−i , and resets a i and b i to 0.
These facts imply that a i must be incremented during every run in an odd iblock to prevent the automaton getting stuck, and b i must be incremented during every run in an even i-block to prevent the automaton getting stuck. It can also be verified that, if a i is incremented during every run in an odd i-block, and b i is incremented during every run in an even i-block, then the automaton will never get stuck at r i . Similarly, for the counters e i and f i we have the following facts.
-At the start of the first i-block, we have e i = f i = 0.
-Each i-block contains exactly 2 n−i runs. Each run must increment one of e i or f i , but not both. -At the end of each i-block, we must take one of the two transitions from r ′ i to r i to avoid getting stuck. These transitions require that e i = 2 n−i and f i = 0, or e i = 0 and f i = 2 n−i .
These facts imply that either e i is incremented during every run in an i-block, or f i is incremented during every run in an i-block, or the automaton will get stuck when moving from r ′ i to r i at end of the i-block. It can also be verified that, if the automaton increases e i during every run in an i-block, then the automaton will not get stuck moving from r ′ i to r i , and if the automaton increases f i during every run in an i-block, then the automaton will not get stuck moving from r ′ i to r i .
Note that, in A n , it is only possible for R to get stuck at the locations r ′ i and r i . Therefore, we have shown that R does not get stuck if and only if the three conditions of Lemma 6 hold for R.

E Proof of Lemma 7
This lemma follows from Lemma 11. Let R be a run. Lemma 11 implies that the transition from r i to r ′ i−1 is taken in every segment R j such that j mod 2 n−(i−1) . This transition resets both a i and b i to 0. Therefore, neither of these counters may exceed 2 n−(i−1) . Similarly, Lemma 11 implies that every segment R j such that j mod 2 n−i = 0 must move from r ′ i to r i . Both of the transitions from between r ′ i and r i reset e i and f i , and therefore neither of these counters may exceed 2 n−i .