Reachability in two-parametric timed automata with one parameter is EXPSPACE-complete

Parametric timed automata (PTA) are an extension of timed automata in which clocks can be compared against parameters. The reachability problem asks for the existence of an assignment of the parameters to the non-negative integers such that reachability holds in the underlying timed automaton. The reachability problem for PTA is long known to be undecidable, already over three parametric clocks. A few years ago, Bundala and Ouaknine proved that for PTA over two parametric clocks and one parameter the reachability problem is decidable and also showed a lower bound for the complexity class PSPACE^NEXP. Our main result is that the reachability problem for two-parametric timed automata with one parameter is EXPSPACE-complete. Our contribution is two-fold. For the EXPSPACE lower bound we make use of deep results from complexity theory, namely a serializability characterization of EXPSPACE (based on Barrington's Theorem) and a logspace translation of numbers in chinese remainder representation to binary representation. For the EXPSPACE upper bound, we give a careful exponential time reduction from PTA over two parametric clocks and one parameter to a slight subclass of parametric one-counter automata (POCA) over one parameter based on a minor adjustment of a construction due to Bundala and Ouaknine. We provide a series of techniques to partition a fictitious run of a POCA into several carefully chosen subruns that allow us to prove that it is sufficient to consider a parameter value of exponential magnitude only. This allows us to show a doubly-exponential upper bound on the value of the only parameter of a PTA over two parametric clocks and one parameter. We hope that extensions of our techniques lead to finally establishing decidability of the long-standing open problem of reachability in parametric timed automata with two parametric clocks (and arbitrarily many parameters).


Introduction
Background. In the 1990's timed automata have been introduced by Alur and Dill [2]. They extend finite automata by clocks that can be compared against integer constants and provide a popular formalism to reason about the behavior of real-time systems with desirable algorithmic properties; for intance the reachability/emptiness problem is decidable and in fact PSPACE-complete [1].
For a more general means to specify the behavior of under-specified systems, such as embedded systems, Alur, Henzinger and Vardi [3] have introduced parametric timed automata (PTA) only a few years later. Here, the clocks can additionally be compared against parameters that can take unspecified non-negative integer values. Towards the verification of safety properties, or loosely speaking ruling out the existence of an execution to a bad state, the reachability problem for PTA in turn asks for the existence of an assignment of the parameters to the non-negative integers such that reachability holds in the resulting timed automaton.
A clock of a PTA that is being compared to at least one parameter is called parametric. On the negative side, it has been shown in [3] that already for PTA that contain three parametric clocks reachability is undecidable -even in the presence of one parameter [8]. On the positive side however, Alur, Henzinger and Vardi have shown in [3] that reachability is decidable for PTA that contain only one parametric clock, yet by an algorithm whose running time is non-elementary.
Reachability in PTA with two or less parametric clocks has not attracted much attention for many years, up until recently.
For PTA over one parametric clock, Bundala and Ouaknine have shown a first elementary complexity upper bound for the reachability problem; it is shown to be NEXP-hard and in 2NEXP [10]. The matching NEXP upper bound has been proven by Beneš et al. in [8] (also in the continuous time setting), we refer to [9] for an alternative proof by Bollig, Quaas and Sangnier using alternating 2-way automata.
Bundala and Ouaknine [10] have recently advanced the decidability and complexity status of the reachability problem for PTA over two parametric clocks [10]: it is shown that in presence of one parameter the reachability problem is decidable and hard for the complexity class PSPACE NEXP . To the best of our knowledge, this is in fact the largest subclass of PTA for which reachability is known to be decidable. For showing the above-mentioned decidability result [10] provides a reduction from PTA over two parametric clocks to a suitable formalism of parametric one-counter automata. Such an approach via parametric one-counter automata has already successfully been applied to model checking freeze-LTL as shown by Demri and Sangnier [12] and Lechner et al. [21], yet notably over a weaker model of parametric one-counter automata than the one introduced in [10]. On this note, it is worth mentioning that inter-reductions between the reachability problem of (non-parametric) timed automata involving two clocks and one-counter automata have already been established by Haase et al. [16,17].
Decidability of reachability in PTA over two parametric clocks (without parameter restrictions) is still considered to be a challenging open problem to the best of our knowledge. For instance, as already remarked in [3], there is an easy reduction from the existential fragment of Presburger Arithmetic with divisibility to reachability in PTA over two parametric clocks.
Our contribution. Our main result (Theorem 5) states that reachability in parametric timed automata over two parametric clocks and one parameter is EXPSPACE-complete. Our contribution is two-fold.
Inspired by [13,14], for the EXPSPACE lower bound we make use of deep results from complexity theory, namely a serializability characterization of EXPSPACE (in turn originally based on Barrington's Theorem [7]) and a logspace translation of numbers in chinese remainder representation to binary representation due to Chiu, Davida, and Litow [11]. It is shown that with small PTA over two parametric clocks and one parameter one can simulate serializability computations.
For the EXPSPACE upper bound, we first give a careful exponential time reduction from PTA over two parametric clocks and one parameter to a (slight subclass of) parametric one-counter automata over one parameter based on a minor adjustment of a construction due to Bundala and Ouaknine [10]. In solving the reachability problem for parametric one-counter automata with one parameter, we provide a series of techniques to partition a fictitious run into several carefully chosen subruns that allow us to prove that it is sufficient to consider a parameter value of exponential magnitude. This allows us to show a doubly-exponential upper bound on the value of the only parameter of PTA with two parametric clocks and one parameter. We hope that extensions of our techniques lead to finally establishing decidability of the long-standing open problem of reachability in parametric timed automata with two parametric clocks (and arbitrarily many parameters) and, if decidability holds, determinining its precise computational complexity.
As the results in [3], our results hold for PTA over discrete time. Indeed, for PTA with closed (i.e., non-strict) clock constraints and parameters ranging over integers, techniques [19,23] exist that allow to reduce the reachability problem over continuous time to discrete time. There is a plethora of variants of PTA that have recently been studied, we refer to [4] for an extensive overview by André.
Overview of this paper. In Section 2 we introduce general notations and state our main result. Our EXPSPACE lower bound can be found in Section 3. Section 4 introduces parametric onecounter automata and states an exponential time reduction from reachability in parametric timed automata with two parametric clocks and one parameter to reachability in parametric one-counter automata. Section 5 states the EXPSPACE upper bound and the central Small Parameter Theorem (Theorem 18). It also gives an overview of the proof of the Small Parameter Theorem, which itself stretches over Sections 6,7,8, and 9.

Preliminaries
We assume the reader is familiar with Turing machines and standard complexity classes such as LOGSPACE, PSPACE and EXPSPACE. We refer to [24,5] for further details on complexity. We also assume the reader is familiar with (deterministic) finite automata and regular languages, we refer to [18] for more details on this.
By Z we denote the integers and by N = {0, 1, . . .} we denote the non-negative integers. For every a, b ∈ Z with a ≤ b we define [a, b] = {k ∈ Z a ≤ k ≤ b}. For every n ≥ 1 we define nZ = {n ⋅ z z ∈ Z}. For every number n ∈ N we define log(n) = min{i + 1 i ∈ N, n ≤ 2 i }, which is the smallest number of bits necessary to write down n in binary. For every finite alphabet A we denote by A * the set of finite words over A and denote the empty word by ε. For all a ∈ A and all w ∈ A * let w a denote the number of occurrences of the letter a in w. For every finite set M ⊂ N ∖ {0} let LCM(M ) = min{n ≥ 1 ∀m ∈ M ∖ {0} ∶ m n} denote the least common multiple of the elements in M . For any j ∈ N let LCM(j) = LCM( [1, j]) denote the least common multiple of the numbers {1, . . . , j}. For any two sets X and S, let X S denote the set of all functions from S to X. For any set S let P(S) = {X X ⊆ S} denote the power set of S.
A guard over a finite set of clocks Ω and a finite set of parameters P is a comparison of the form g = ω e, where ω ∈ Ω, e ∈ P ∪ N, and ∈ {<, ≤, =, ≥, >}; in case e ∈ P we call g parametric, and non-parametric otherwise. We denote by G(Ω, P ) the set of guards over the set of clocks Ω and the set of parameters P . The size g of a guard g = ω e is defined as A clock valuation is a function from Ω to N; we write ⃗ 0 to denote the clock valuation ω ↦ 0. For each clock valuation v and each t ∈ N we denote by v + t the clock valuation ω ↦ v(ω) + t. A parameter valuation is a function µ from P to N. For every guard g = ω p with p ∈ P (resp. g = ω k with k ∈ N) we write v ⊧ µ g if v(ω) µ(p) (resp. v(ω) k; in this case we may also simply write v ⊧ g). We define an empty guard g over a non-empty finite set of clocks Ω and a finite set of parameters P to be of the form ω ≥ 0 for some ω ∈ Ω. In particular, we defined g such that for all v ∈ N Ω and all µ ∈ N P we have v ⊧ µ g , hence g can be used as a guard that is always true. A parametric timed automaton as introduced in [3] is a finite automaton extended with a finite set of parameters P and a finite set of clocks Ω that all progress at the same rate and that can be individually reset to zero. Moreover, every transition is labeled by a guard over Ω and P and by a set of clocks to be reset. Formally, a parametric timed automaton (PTA for short) is a tuple A = (Q, Ω, P, R, q init , F ), where • Q is a non-empty finite set of control states, • Ω is a non-empty finite set of clocks, • P is a finite set of parameters, • R ⊆ Q × G(Ω, P ) × P(Ω) × Q is a finite set of rules, • q init ∈ Q is an initial control state, and • F ⊆ Q is a set of final control states.
A clock ω ∈ Ω is called parametric if there exists some (q, g, U, q ′ ) ∈ R such that the guard g is parametric. We also refer to A as a (m, n)-PTA if m = {ω ∈ Ω ω is parametric} is the number of parametric clocks and n = P is the number of parameters of A -sometimes we also just write (m, * )-PTA (resp. ( * , n)-PTA) when n (resp. m) is a priori not fixed.
The size of A is defined as A = Q + Ω + P + R + (q,g,U,q ′ )∈R g .
Let Consts(A) = {c ∈ N ∃(q, g, U, q ′ ) ∈ R, ∃ω ∈ Ω ∶ g = ω c} denote the set of constants that appear in the guards of the rules of A. By Conf(A) = Q × N Ω we denote the set of configurations of A. We prefer however to denote a configuration by q(v) instead of (q, v).

Definition 1.
For each parameter valuation µ ∶ P → N and each (δ, t) ∈ R × N with δ = (q, g, U, q ′ ) ∈ R, let δ,t,µ → denote the binary relation Conf(A), where q(v) A µ-run from q 0 (v 0 ) to q n (v n ) is a sequence q 0 (v 0 ) δ1,t1,µ → q 1 (v 1 )⋯ δn,tn,µ → q n (v n ); it is called reset-free if the set appearing in the third component is empty for all δ i . In case P = {p} is a singleton and µ(p) = N we prefer to say N -run instead of µ-run. We say reachability holds for A if there is a µ-run from q init ( ⃗ 0) to some configuration q(v) for some q ∈ F , some v ∈ N Ω , and some µ ∈ N P . We refer to Figure 1 for an instance of a PTA for which reachability holds.
In the particular case where P = {p} is a singleton for some parameter p and µ(p) = N we prefer to write q(v) N → q ′ (v ′ ) to denote q(v) µ → q ′ (v ′ ) and prefer to write ⊧ N to denote ⊧ µ . It is worth mentioning that there are further modes of time valuations and guards which exist in the literature, we refer to [4] for a recent overview.
We are interested in the following decision problem.
Alur et al. have already shown in their seminal paper that PTA-Reachability is in general undecidable, already in presence of only three parametric clocks [3], Beneš et al. strengthened this when only one parameter is present [8]. To the contrary, (1, * )-PTA-Reachability has recently been shown to be complete for NEXP, where a non-elementary upper bound was initially given by Alur et al. [3].
On the other end, decidability of (2, * )-PTA-Reachability is still open to the best of our knowledge. In presence of one parameter the following is known.
The following theorem states our main result.

Lower bounds
In this section we show an EXPSPACE lower bound for (2, 1)-PTA-Reachability. Section 3.1 introduces some auxiliary gadgets that show that on small (2, 1)-PTA with two parametric clocks x and y and one parameter p one can perform both (i) PSPACE computations and (ii) compute x − y mod p modulo numbers that are dynamically given in binary. Section 3.2 builds upon these auxiliary gadgets and shows how to implement serializability computations in a leaf language characterization of EXPSPACE [13], which is a simple padded variant of the leaf language characterization of PSPACE due to Hertrampf et al. [20].

PSPACE and modulo computations
For each i, n ∈ N let Bit i (n) denote the i-th least significant bit of the binary presentation of n, where the least significant bit is on the left, i.e. n = ∑ i∈N 2 i ⋅ Bit i (n). For each m ≥ 1, by Bin m (n) = Bit 0 (n)⋯Bit m−1 (n) we denote the sequence of the first m least significant bits of the binary representation of n. Conversely, given a binary string w = w 0 ⋯w m−1 ∈ {0, 1} m of length m we denote by Val(w) = ∑ m−1 i=0 2 i ⋅ w i ∈ [0, 2 m − 1] the value of w interpreted as a non-negative integer.
Let A be a parametric timed automaton over a set of clocks Ω with two parametric clocks x and y. We say a valuation v ∶ Ω → N is bit-compatible if v(ζ) ∈ {0, 1} for all non-parametric clocks ζ ∈ Ω of A. Assume moreover that Ω contains non-parametric clocks Θ + ∪ Θ − , where Θ is some set and Θ + = {ϑ + ϑ ∈ Θ} and Θ − = {ϑ − ϑ ∈ Θ} are two disjoint corresponding copies of Θ; in this case, for any valuation v ∶ Ω → N we define the mappingv ∶ Θ → {0, 1} aŝ In the following we call such non-parametric clocks {ϑ + , ϑ − ϑ ∈ Θ}, appearing as implicit pairs, bit clocks since they are used to encode bits. The following definition expresses when a parametric timed automaton over two parametric clocks and one parameter computes a function from N × {0, 1} n to {0, 1} m . Notably, both before execution it assumes, and after execution it guarantees, a bitcompatible valuation that assigns its two parametric clocks values in the interval [0, N − 1], where N denotes the assigned value of its only parameter.
Importantly, the execution of any N -run q init (v 0 ) N → q f in (v ′ ) does not have any side effects on the binary interpretation of the 'input" bit clocks, i.e. the string ∏ The following lemma essentially has its roots in the PSPACE-hardness proof for the emptiness problem for timed automata (without parameters) introduced by Alur and Dill [2], however constructed to satisfy the carefully chosen interface given by Definition 6.
Proof. Let us fix some PSPACE-computable function g ∶ {0, 1} n → {0, 1} m . Let us moreover fix some t(n)-space bounded deterministic Turing machine M computing g, where t is some fixed polynomial.
We explicitly store the value of our input by making use of our non-parametric "input" bit clocks {in 0 + , in 0 − , . . . , in + n−1 , in − n−1 }. Similarly, we explicitly store the value of our output with the non-parametric "output" bit clocks {out 0 + , out 0 − , . . . , out m−1 + , out m−1 − }. Since f (k, w) = g(w) we need to provide a computation that presents g(w) ∈ {0, 1} m using the "output" bit clocks. Let Ω denote the set of clocks of the (2, 1)-PTA A whose construction we discuss next.
For every non-parametric clock in A we reset it once it has value 2; this is achieved by suitable self-loops in every state of the construction except for the final control state q f in . Similarly, we establish that both of the parametric clocks x and y are being reset once they have reached value N . This way the difference between the values of x and y will stay unchanged modulo the valuation N of the only parameter p. Importantly, other than that neither x nor y will be modified during the following construction.
We will enforce that finally the values of all non-parametric clocks remain in {0, 1} and that the two parametric clocks have a value in [0, N − 1] as follows. A final control state q f in is preceded by a final gadget in which no time elapses that verifies via a sequence of suitable guards that the parametric and non-parametric clocks are as required.
For simulating M our (2, 1)-PTA A will also use suitable O(t(n)) bit clocks, to store in binary the working tape of M.
Given the current bit-compatible valuation v ∶ Ω → N, it is thus possible to inspect the input bit string ∏ n−1 i=0v (in i ), read and write the polynomially sized working tape, and to write the output ∏ m−1 j=0v (out j ). Let us discuss this in more detail.
For simulating M, we choose the control states of our (2, 1)-PTA A as where S is the set of states of M. We then simulate any step of M from a state q, current position i on the input tape, current position j on the output tape, current position h on the working tape, reading letter a on the input tape, reading letter b on the working tape, changing to a new state q ′ , new input head position i ′ , new output head position j ′ , and new working head position h ′ . To do that, we add to A sequences of suitable rules from control state (q, i, j, h, a, b) to control state , by using suitable guards and reset operations that serve two purposes: first, checking whether a ′ and b ′ are indeed the values of the i ′ -th (resp. h ′ -th) cell of the input (resp. working) tape and second, writing on the j-th (resp. h-th) cell of the output (resp. working) tape. Letting q init denote some suitable initial state one can thus achieve that for all bit-compatible all k ∈ N and all w = w 1 ⋯w n+ ∈ {0, 1} n+ : indeed, one can manipulate the additional input bit clocks by repeatedly resetting them once they have value 2, enforcing that the associatedv-values stay throughout unchanged and that their value is finally strictly smaller than 2.
The following lemma shows that (2, 1)-PTA can compute modulo dynamically given numbers in binary.
Lemma 9. One can compute in polynomial time in n + m a (2, 1)-PTA that computes the function Proof. We need to show that in time polynomial in n + m one can construct a (2, 1)-PTA A whose set of clocks Ω contains the "input" bit clocks {in 0 + , in 0 − , . . . , in + n−1 , in − n−1 } and "output" bit clocks {out 0 + , out 0 − , . . . , out m−1 + , out m−1 − } that computes f . Let us assume some parameter value N ∈ N and some bit- Again, we establish here also that the parametric clocks x and y are being reset once they have reached value N -however we sometimes explicitly disallow x to reach value N in certain gadgets mentioned below. This will be the only modification of x and y. In the following, reading and writing thev(ϑ)-value for every pair of bit clocks ϑ + , ϑ − , guaranteeing that v(ϑ + ), v(ϑ − ) ∈ {0, 1}, and guaranteeing that the parametric clocks finally have values in [0, N − 1] can be done as in the proof of Lemma 7.
We need the eventual output bit string ∏ m−1 j=0v Our automaton starts in some initial control state q init . From q init we introduce a gadget that nondeterministically writes some value u ∈ {0, 1} m in our "output" bit clocks that satisfies Val(u) < Val(w). From the end of the latter gadget we have a rule that checks if our parametric clock x has value 0 (just after being reset with value N ), leading to a control state q wait . Assume our current valuation then is v ∶ Ω → N. From q wait we have a rule to a state q sub letting no time elapse from which we claim there is a gadget that allows us to loop in q sub for precisely Val(w) = Val(∏ n−1 i=0v (in i ))) time units. One constructs the latter gadget as follows. Subsequently for every i ∈ [0, n − 1] one readsv(in i ) and in casev(in i ) = 1 lets precisely 2 i time units elapse via a suitable auxiliary clock and in casev(in i ) = 0 lets 0 time units elapse. The gadget ends with a sequence of rules leading back to q sub by letting 0 time units elapse that verify that the parametric clock x has a value strictly smaller than N . Importantly, the parametric clock x is exceptionally not reset inside this gadget.
Finally, we add a rule from q sub to a suitable gadget that lets precisely Val(∏ m−1 j=0v (out j )) time units elapse (analogously as done above), followed by a test that verifies that the value of y equals 0 (after just being reset at value N ). In addition, we append this latter gadget with a final sequence of rules (again letting no time elapse) to our final control state q f in that test if both x and y have a value strictly smaller than N and test if all non-parametric clocks have a value strictly smaller than 2. Thus, every valuation It is worth noting that by construction precisely v 0 (x) − v 0 (y) mod N time units have passed in any computation q wait to q f in . Since we have repeatedly waited Val(w) time units and finally verified that the remaining time is the guessed value initially nondeterministically written to our "output" bit clocks, we have

An EXPSPACE lower bound via serializability
This section is devoted to showing the following lower bound. For each language L ⊆ A * let χ L ∶ A * → {0, 1} denote its characteristic function. By ⪯ n we denote the lexicographic order on n-bit strings, thus w ⪯ n v if Val(w) ≤ Val(v), e.g. 0101 ⪯ 4 0011.
Our EXPSPACE lower bound proof makes use of the following leaf language view of EXPSPACE from [13], which is a padded adjustment of the leaf-language characterization of PSPACE from [20], which in turn has its roots in Barrington's Theorem [7].
Let us fix any language L in EXPSPACE and assume L ⊆ {0, 1} * without loss of generality. Applying Theorem 11, let us fix the regular language R ⊆ {0, 1} * along with some fixed deterministic finite automaton D = (Q D , {0, 1}, q 0 , δ D , F D ) with L(D) = R, the fixed polynomial s and the fixed language U ∈ LOGSPACE. Let us moreover fix an input w ∈ {0, 1} n of length n for L. Figure 2 rephrases characterization (1) in Theorem 11 in terms of an execution of a program that returns 1 if, and only if, w ∈ L.
Making use of D, s and U we will translate our input w ∈ {0, 1} n in polynomial time (in w = n) to some (2, 1)-PTA A = (Q, Ω, P, R, q init , F ) such that • Ω will contain precisely two parametric clocks x and y and further clocks that are nonparametric, • P = {p} is a singleton, and • w ∈ L if, and only, if reachability holds for A.
The following lemma gives us a gadget (2, 1)-PTA that allows us to enforce that the parameter p can only be evaluated to numbers that are larger than 2 2 s(n) .
Lemma 12. One can compute in polynomial time in n some parametric timed automaton A big = (Q big , Ω big , {p}, R big , q big,init , {q big,f in }) with two parametric clocks x, y ∈ Ω big and one parameter p such that Proof. Without loss of generality we may assume 2 s(n)+1 ≥ 10. Letting N denote the parameter value of its only parameter p, our (2, 1)-PTA A big will test whether N − 1 is divisible by all numbers in the interval [1, 2 s(n)+1 − 1]. This will be sufficient since LCM([1, k]) ≥ 2 k for all k ≥ 9 by [22], thus . Consider the following program which returns 1 if, and only if, all numbers in [1, 2 s(n)+1 − 1] divide N − 1.
if J = 0 s(n)+1 then return 0 (8) end loop (9) return 1 It remains to show that the program can be implemented by a (2, 1)-PTA A big with a suitable final control state q big,f in .
It is straightforward to initialize our two parametric clocks x and y in such a way that one can enforce valuations v that satisfy v(x) − v(y) = N − 1 mod N : indeed, starting from the valuation ⃗ 0, we can wait one unit of time after which we reset x but not y.
We will use O(s(n)) suitable bit clocks for storing the variables I and J respectively. Lines (3), (4) and (7) can easily directly be achieved by reading and writing the O(s(n)) many bits clocks reserved for storing I and J. Line (5) boils down to incrementing I when viewed as s(n)+1 bit integer and is thus obviously a polynomial space computable function from N×{0, 1} s(n) to {0, 1} s(n) and hence computable using a suitable PTA based on Lemma 7. Line (6) is a function from N × {0, 1} s(n)+1 to {0, 1} s(n)+1 that can be implemented using a suitable PTA based on Lemma 9. As in the proofs of Lemma 7 and Lemma 9 we reset the two parametric clocks x and y once they have reached value N but only in case we are outside any of the gadget PTA corresponding to line (5) and line (6), respectively. Similarly we realize the implementation of the bit clocks for I and J by resetting them once they have reached value 2.
Recall that we aim at implementing the program in Figure 2 by a (2, 1)-PTA A. The initial part of A will consist of the gadget PTA A big which will allow us to enforce an assignment of p to some value N > 2 2 s(n) . We first explain how to encode its variables and then discuss how to implement the different lines of the program.
Encoding the variables of the program in Figure 2. Our PTA A will store in its control states the current state q of D and the boolean variable b. We cannot easily "explicitly" store the value of our variable B in binary as in the proof of Lemma 7 via polynomially many bit clocks in such a way that, given the current valuation v ∶ Ω → N, it suffices to simply inspect theirv-value: indeed, there are only singly-exponentially many different combinations of suchv-values, yet B is a number in [0, 2 2 s(n) ] and thus of doubly-exponential magnitude. We will rather store the value B ∈ N as the difference v(x) − v(y) mod N between our only two parametric clocks x and y: this is possible since N > 2 2 s(n) by our initial gadget PTA A big . However, when inspecting line (7) of Figure 2 we need to access certain bits of the exponentially long bit string w ⋅ Bin 2 s(n) (B). For this, we access B in a different representation, namely in Chinese Remainder Representation that we introduce next. ] and for every k ∈ N we have ∏ In other words, one can present B as CRR m (B) = (b i,r ) i∈ [1,m],r∈[0,pi−1] for some m ∈ 2 poly(n) .
Since by the Prime Number Theorem the i-th prime p i is bounded by O(i log i) there exists some ∈ O(log(m log m)) = O(log(2 poly(s(n)) )) = poly(n) such that bits are sufficient to store in binary precisely one of the primes p i . Thus, similarly O( ) = poly(n) bits are sufficient to store in binary precisely one of the pairs of the form Observe that in line (7) of our program in Figure 2 we need to carry out LOGSPACE computations on our exponentially long string w ⋅Bin 2 s(n) (B). Yet, if at all, we only have an on-the-fly mechanism for accessing the Chinese Remainder Representation of B, notably still of exponential size in n.
To have a chance to access concrete bits of B, we apply the following theorem that states that, given a number in Chinese Remainder Representation, one can compute in LOGSPACE its binary representation.
Theorem 14 (Theorem 3.3. in [11]). The following problem is computable in DLOGTIME-uniform NC 1 (and thus in LOGSPACE): INPUT: CRR m (B) and j ∈ [1, m] OUTPUT: Bit j (B mod 2 m ) Realization of line (7) in the program in Figure 2. Let us assume that we have B < 2 2 s(n) and recall that we have stored B as the difference v(x) − v(y) mod N of our two parametric clocks x and y, assuming v to be our current clock valuation. Let us show how to compute χ U (w ⋅ Bin 2 s(n) (B)), where we recall that U is a language in LOGSPACE. Let us fix some logarithmically space bounded deterministic Turing machine M for U .
For simulating M our PTA A will use O(log(n + 2 s(n) )) = poly(n) auxiliary bit clocks J to store in binary the position of the input head of M and further O(log(n + 2 s(n) )) = poly(n) auxiliary bit clocks W in order to store the working tape M. Reading and writing on the working tape as well as updating the position of the input head can done analogously as in the proof of Lemma 7. It only remains to show how to access the cell content Bit j (w ⋅ Bin 2 s(n) (B)) of the input head of M, where we recall that j itself is stored inside the above-mentioned bit clocks J .
To compute Bit j (w ⋅ Bin 2 s(n) (B)) we apply Theorem 14 and simulate in turn a LOGSPACE machine M ′ whose input is assumed to be where we already have direct access to j via the bit clocks J but need a special treatment in order to access the b i,r of CRR(B). Importantly, during the to-be discussed simulation of M ′ we never modify thev-values associated with the bit clocks in J and W that are being used in the (outermost) simulation of M. Before discussing the access to the b i,r let us first discuss the simulation of the working tape of M ′ : this can be achieved by using O(log( CRR(B) + s(n))) = O(log(m 2 ⋅ log m + s(n))) = poly(n) many auxiliary bit clocks W ′ , say, where reading and writing the working tape is done again as in Lemma 7. It remains to discuss how to implement the input head in the simulation of M ′ . As mentioned repeatedly above, input j can directly be accessed by the bit clocks J . However, accessing CRR(B) = (b i,r ) i∈ [1,m],r∈[0,pi−1] cannot be done explicitly but on-the-fly: for this we reserve O( ) = O(s(n)) = poly(n) additional auxiliary bit clocks J ′ , say, to store in binary a pair of indices (i, r), where i ∈ [1, m] and r ∈ [0, p i − 1]. Given the binary access to (i, r) via the bit clocks J ′ , one can compute via further suitable poly( ) = O(s(n)) = poly(n) bit clocks H, say, the binary representation of the i-th prime number p i in space polynomial in (and thus in n) by Lemma 7: indeed, given i ∈ [1, m] in binary, i.e. using = poly(n) bits, it is straightforward to compute the i-th prime in space polynomial in . Having a binary resentation of p i via the bit clocks H one can finally compute (v(x) − v(y) mod N ) mod p i via a gadget by Lemma 9. Our (2, 1)-PTA A can thus indeed compute B mod p i and thus decide if r equals the latter, which in turn is nothing but computing the to-be-computed input bit b i,r of CRR(B) for the simulation of M ′ .
Concerning the implementation details of the simulation of M ′ it is important to remark (recalling Remark 8) that both during the sub-computation computing the i-th prime p i (using Lemma 7) as well as during the sub-computation computing B mod p i (using Lemma 9) one can guarantee that thev-values associated with the bit clocks in J , W, J ′ and W ′ are never being modified.
Realization of the remaining lines of the program in Figure 2. Lines (4), (8) and (11) can be done directly by the control states of A. Line (5) boils down to resetting both x and y simultaneously. Line (6) will be done by checking if for the second time ever (the first time was when v(x) = v(y) = 0) we have that Bin 2 s(n) (B) = 0 2 s(n) , which in turn can be done analogously (but in fact simpler) as our above-mentioned implementation of line (7). Line (9) is letting time elapse till the parametric clock y has value 1 (i.e. one time unit after it had value N and was reset), and then resetting it. The latter implementation indeed correctly implements incrementation modulo N .
4 From two-parametric timed automata with one parameter to parametric one-counter automata Being introduced by Bundala and Ouaknine in [10], we define parametric one-counter automata. These are automata that can manipulate a counter that can be incremented or decremented, parametrically or not, compared against constants or parameters, and with divisibility tests modulo constants. It is worth mentioning that the notion of parametric one-counter automata from [10] is slightly more expressive than ours, as we shall discuss further below. After introducing parametric one-counter automata we state a theorem (Theorem 16), proven essentially already in [10] -again, however for a slightly more expressive model of parametric one-counter automata -that states that (2, 1)-PTA-Reachability can be reduced in exponential time to the reachability problem of parametric one-counter automata over one parameter. Since the actual proof of Theorem 16 follows the approach of Bundala and Ouaknine from [10], it can be found in the Appendix.

Parametric one-counter automata
Given a set of parameters P we denote by Op(P ) the set of operations over the set of parameters P , being of the form The size op of an operation op is defined as We denote by updates those operations that lie in Op ± ∪ Op ±P and by tests those operations that lie in Op mod N ∪ Op N ∪ Op P . Previously, such as in [10] or [16], slightly different sets of operations have been used, such as operations to increment the counter by a constant represented in binary. Moreover, Bundala and Ouaknine [10] include for the purpose of their construction some operations of the form +[0, p] that allow to nondeterministically add to the counter a value that lies in [0, µ(p)], where µ(p) is the parameter valuation of parameter p. As we shall show in this section, when reducing the reachability problem for parametric timed automata with two parametric clocks and one parameter to parametric one-counter automata one does not require these +[0, p]-transitions.
A parametric one-counter automaton (POCA for short) is a tuple where • Q is a non-empty finite set of control states, • P is a non-empty finite set of parameters that can take non-negative integer values, • R ⊆ Q × Op(P ) × Q is a finite set of rules, • q init is an initial control state, and • F ⊆ Q is a set of final control states.
The size of C is defined as Let Consts(C) denote the constants that appear in the operations op ∈ Op mod N ∪ Op N for some operation (q, op, q ′ ) in R. By Conf(C) = Q × Z we denote the set of configurations of C. We prefer however to denote a configuration of Conf(C) by q(z) instead of (q, z).
Being slightly non-standard we define configurations to take counter values over Z rather than over N for notational convenience. This does not cause any loss of generality as we allow guards that enable us to test if the value of the counter is greater or equal to zero.
(3) op = mod c ∈ Op mod N , z = z ′ and z ′ ≡ 0 mod c, Let µ ∶ P → N be a parameter valuation. A µ-run in C (from q 0 (z 0 ) to q n (z n )) is a sequence, possibly empty (i.e. n = 0), of the form We say π is accepting if q 0 = q init , z 0 = 0, and q n ∈ F . We say reachability holds for the POCA C if there exists an accepting µ-run for some µ ∈ N P . We refer to Figure 3 for an instance of a POCA for which reachability holds. For any two c, d ∈ [0, n] we define the subrun π[c, d] from q c (z c ) to q d (z d ) as the µ-run q c (z c ) As expected, a prefix (resp. suffix) of π is a µ-run of the form π[0, c] (resp. π[d, n]).
We define the concatenation π 1 π 2 of two µ-runs π 1 and π 2 when the source configuration of π 2 is equal to the target configuration of π 1 as expcected.
We define ∆(π) = z n − z 0 as the counter effect of the run π and for each i ∈ [0, n − 1] let ∆(π, i) = ∆(π[i, i + 1]) to denote the counter effect of the i-th transition of π. Its length is defined as π = n.
In the particular case where P = {p} is a singleton for some parameter p and µ(p) = N , we prefer to write q(z) op,µ → q ′ (z ′ ) and prefer to call a µ-run an N -run. We define Values(π) = {z i i ∈ [0, n]} to denote the set of counter values of the configurations of π. We define a run π's maximum as max(π) = max(Values(π)) and the minimum as min(π) = min(Values(π)).
The following theorem states an exponential time reduction from (2, 1)-PTA-Reachability to the reachability problem of particular parametric one-counter automata over one parameter. The proof of Theorem 16 can be found in Appendix A.

Upper bounds
In this section we state the Small Parameter Theorem (Theorem 18) which tells us that for every POCA over one parameter and every sufficiently large parameter value N , accepting N -runs with counter values all in [0, 4N ] can be turned into accepting N ′ -runs for some smaller N ′ . After having stated the theorem we will show that together with Theorem 16 it implies an EXPSPACE upper bound for (2, 1)-PTA-Reachability.
We provide an overview of the proof of the Small Parameter Theorem in Section 5.1, whose actual proof will stretch over Sections 6, 7, 8, and 9.
For each POCA C = (Q, P, R, q init , F ) we define the following constants: Since for every non-empty finite set U ⊆ N ∖ {0} we have LCM(U ) ≤ max(U ) U , the following lemma is straightforward. The main result of this section is the following theorem. Let us first establish that this theorem is enough to prove the desired EXPSPACE upper bound. Proof. Given a (2, 1)-PTA A, we apply Theorem 16 and translate A in exponential time into a POCA C = (Q, P, R, q 0 , F ) with P = {p}, such that 1. all accepting N -runs π in C satisfy Values(π) ⊆ [0, 4 ⋅ max(N, C )], and 2. reachability holds for A if, and only if, reachability holds for C.
We first claim that if there exists an accepting N -run π for C, then there exists one satisfying N ∈ [0, max{M C , C }] and Val(π) ⊆ [0, 4 ⋅ max{M C , C }]. All accepting N -runs π of C satisfy Val(π) ⊆ [0, 4 ⋅ max{N, C }] by Point 1, so if N > max{M C , C }, then 4N = 4 ⋅ max{N, C } and hence there exists some accepting (N − Γ C )-run for C by Theorem 18. Remarking that in case N > max{M C , C } we have N − Γ C > M C − Γ C > 0, one can repeat the above argument for N − Γ C and possibly for N − 2Γ C and so on, thus implying the desired existence.
Thus by Point 2 it suffices to check in exponential space in A whether there exists some accepting N -run π for C satisfying Values(π) , the latter is simply a reachability question in a doubly-exponentially large finite graph all of whose vertices and edges can be represented using exponentially many bits, and thus decidable in exponential space.

Overview of the proof of the Small Parameter Theorem
For the proof of the Small Parameter Theorem (Theorem 18) we proceed as follows.
• In Section 6 we introduce the notion of N -semiruns. These generalize N -runs in that only modulo tests need to hold, not however comparison tests. We define some natural operations on them, like shifting them by some value or cutting out certain infixes. In Subsection 6.2 we prove two important lemmas on semiruns that will serve as base tools for subsequent steps in the proof: -The Depumping Lemma (Lemma 22) will be our main tool to depump certains semiruns, in the following sense: in case the difference between the number of +p-transitions and −p-transitions is bounded for all infixes and equal to 0 for the whole semirun and furthermore the absolute counter effect of the semirun is sufficiently large, then one can build -by applying the above-mentioned operations -a new semirun whose absolute counter effect is slightly smaller.
-The Bracket Lemma (Lemma 23) states that in case the counter effect is sufficiently large and the counter values are all in [0, 4N ], then one can find an infix where the counter effect is also large and moreover the difference between the number of +p-transitions and −p-transitions is bounded for all infixes and equal to 0 for the whole semirun.
• In Section 7 we introduce the notion of hills and valleys. Hills are N -semiruns that start and end in configurations with low counter values but where all intermediate configurations have counter values above the source and target configuration. We introduce the dual notion of valleys. The main contribution of the section is the following.
-The Hill and Valley Lemma (Lemma 28) allows to transform N -semiruns that are hills (resp. valleys) into (N − Γ C )-semiruns with the same source and target configuration.
• Making use of all of the above lemmas, we introduce in Section 8 the following lemma, which is a main technical ingredient in the proof of Theorem 18.
-The 5 6-Lemma (Lemma 39) states that N -semiruns with counter effect smaller than 5 6 ⋅ N can be turned in into (N − Γ C )-semiruns. • Finally, in Section 9 we prove the Small Parameter Theorem (Theorem 18) by carefully factorizing a potential N -run into subsemiruns that can be treated by the above lemmas.
In Figure 4 we give an overview of the dependencies of the above-mentioned lemmas.

Semiruns, their bracket projection, and embeddings
In this section we motivate and introduce the notion of semiruns by loosening the conditions on runs, and define basic operations on them. These basic operations possibly change their counter values, length, or counter effect. The formalism of an N -run is a little bit too restrictive to define operations on them. For instance, substracting Z C from all counter values of an N -run produces an object, where conditions (1),(2), and (3) of Definition 15 indeed hold -as Z C = LCM(Consts(C)) -but where conditions (4) and (5) might not hold anymore, as comparison guards may be violated. Rather than certifying each time that the application of an operation preserves the property of being an N -run we prefer to loosen the definition in order to avoid tedious case distinctions. This motivates the notion of semitransitions (resp. semiruns), which are a generalization of transitions (resp. runs), in which the comparison tests need not to hold.
We introduce semiruns and operations on them in Section 6.1. Section 6.2 introduces the bracket projection of semiruns, the Depumping Lemma (Lemma 22) and the Bracket Lemma (Lemma 23). Section 6.3 introduces the notion of embeddings, which provide a formal means to express when a semirun can structurally be found as a subsequence of another.

Semiruns and operations on them
Definition 20 (semitransition). Let C = (Q, P, R, q init , F ) be a POCA. For every operation op ∈ Op(P ), for every parameter valuation µ ∶ P → N, and for every two configurations q(z) and (2), and (3) of Definition 15 hold but where conditions (4) and (5) are loosened by the following conditions (4') and (5') respectively (2) op ∈ Op ±P and either Thus, in a nutshell, when writing q(z) op,µ q ′ (z ′ ) we do not require that the comparison tests against parameters or against constants hold; however the updates and the modulo tests against constants must be respected. This naturally gives rise to the definition of µ-semiruns as expected.
Note that in particular every µ-run is a µ-semirun. The abbreviation N -semirun, q(z) op,N q ′ (z ′ ), the counter effect ∆, Values, min, max, subsemirun, prefix, suffix are defined as for runs.
Note that in particular every N -run is an N -semirun. Importantly, note also that semitransitions involving comparison tests are still syntactically present in semiruns. By a careful analysis, one can therefore possibly perform operations on N -semiruns in order to show that they are in fact N -runs.

Shifting and gluing of semiruns
Let us fix a POCA C and some N -semirun We define the following operations, where we recall that Z C = LCM(Consts(C)): • For D ∈ Z C Z, we define the shifting of π by D as Since there are no effective comparison tests and D is an integer that is divisible by all constants appearing in modulo tests in C, it is clear that π + D is again an N -semirun.
• For two configurations q i (z i ) and q j (z j ) with 0 ≤ i < j ≤ n and where D = z j − z i ∈ Z C Z is a multiple of Z C and q i = q j , we define the gluing of the configurations as

When gluing the leftmost and rightmost configurations of pairwise non-intersecting intervals
for all 1 ≤ i < k, and q ai = q bi and z bi − z ai ∈ Z C Z for all 1 ≤ i ≤ k, we will use π − I 1 − I 2 ⋯ − I k to denote the result corresponding to gluing each interval successively while shifting the others accordingly, instead of writing the more tedious π (k) , where

The bracket projection of semiruns
In this section we define a projection φ of semitransitions τ = q(z) • The Depumping Lemma (Lemma 22) states that for each N -semirun whose φ-projection has bounded bracketing properties and that has a counter effect whose absolute value is sufficiently large there exists another N -semirun with a counter effect whose absolute value is slightly smaller. This latter resulting N -semirun has a particular form in that it can be obtained from the original N -semirun by applying the above-mentioned operations of shifting and gluing: notably, the subsemiruns that are being glued themselves have a φ-projection that has bounded bracketing properties.
• The Bracket Lemma (Lemma 23) states that if an N -semirun has all its counter values in [0, 4N ], has an absolute counter effect that is sufficiently large and has a φ-projection satisfies a suitable threshold condition on the number of occurrences of [ and ], that there is a subsemirun where the absolute counter effect is also large and whose φ-projection has bounded bracketing properties.
Formally, we define a mapping φ such that for every semitransition τ = q(z) Note that an N -semirun π can contain several +p-transitions and −p transitions. We introduce the notation φ(π, i) = φ(π[i, i + 1]) to denote the φ-projection of the i-th transition of π for all i ∈ [0, π − 1]. The mapping φ is naturally extended to a morphism on semiruns to words over the binary alphabet {[, ]} as expected: We are particularly interested in N -semiruns whose projection by φ contains as many opening as closing brackets and only a few pending ones (when read from left to right). To make this formal, for all k ∈ N we define the regular language We are interested in analyzing N -semiruns with counter values in [0, 4N ]. Bounding the counter values like this limits the number of +p (resp. −p) that can appear in a row. This will be the basis in the Bracket Lemma which amounts to showing the existence of subsemiruns whose φ-projection is in Λ 8 .
The now following Depumping Lemma will enable us to reduce the counter effect of N -semiruns whose φ-projection is in Λ 8 . It is worth remarking that Γ C ≪ Υ C , recalling the definition of our constants on page 15.
Lemma 22 (Depumping Lemma). For all N -semiruns π satisfying φ(π) ∈ Λ 8 and ∆(π) > Υ C there exists an N -semirun π ′ such that either We will assume without loss of generality that ∆(π) > Υ C . The dual case when ∆(π) < −Υ C can be proven analogously. For every position i ∈ [0, n] let us define and and moreover We note the following important properties of pot, The following claim states that if in a subsemirun the pot increases sufficiently large, then one can find a subsemirun therein that can potentially be glued.
• λ(s) = λ(t), and Proof of the Claim. Since by assumption pot(b) − pot(a) > 17 ⋅ Q ⋅ Z C , by the pigeonhole principle and Point 1 above, there exist two indices a ≤ s < (End of the proof of the Claim) Since pot(i) − pot(i − 1) ≤ 1 for all i ∈ [1, n] by Point 1 above and by the pigeonhole principle, there exist at least be an enumeration of these latter subsemiruns. We apply the above Claim to all of these π Let us now introduce the Bracket Lemma, which states that in case the absolute value of the counter effect of an N -semirun is sufficiently large, the counter values are all in [0, 4N ] and a majority condition holds on the number of occurrences of [ and ] in its φ-projection, that there is a subsemirun where the counter effect is also large and that moreover has good bracketing properties (in the sense of the Depumping Lemma). Roughly speaking, it based on the idea that if the values of a semirun are all in [0, 4N ], there cannot be five +p-transitions in a row. Technically speaking, the Bracket Lemma can be applied to (N − Γ C )-semiruns, where N is sufficiently large: the reason is that the Bracket Lemma will later be applied to N -semiruns in which some of the +p − p-transitions have already been modified ("by hand") to have an effect and where φ(π) contains at least as many occurrences of [ as occurrences of ] (resp. at least as many occurrences of ] as occurrences of Proof. We only prove the case where ∆(π) < −Υ C and φ(π) contains at least as many occurrences of [ as of ]. The dual case when ∆(π) > Υ C and φ(π) contains at least as many ] as of [ can be proven analogously.
As in the proof of Lemma 22, for any word For the rest of the proof assume by contradiction that there is no such subsemirun denote the set of all words over the alphabet {[, ]}, where for each prefix the absolute difference between the number of occurrences of [ and of ] is at most k. Note that Under the above assumptions on π, for the sake of contradiction, we have three claims on properties on the image of φ applied to π and subsemiruns thereof.
For the induction base, assume λ(φ([a, b])) = 1. Thus, there exists a position t ∈ [a, b] such that φ(π, t) = [ and λ(π[a, t]) = λ(φ(π[t + 1, b])) = 0. By Claim 2 and (5) where the last strict inequality follows from definition of M C on page 15. Assume We can thus apply induction hypothesis to π[t + 1, b] and obtain where the first strict inequality follows from induction hypothesis on π[t + 1, b] and the last strict inequality follows from definition of M C on page 15.
We will now contradict our initial assumption that there is no subsemirun π[c, d] satisfying φ(π[c, d]) ∈ Λ 8 and ∆(π[c, d]) < −Υ C by making use of the above claims.

Embeddings of semiruns
The Small Parameter Theorem (Theorem 18) turns N -runs with values in [0, 4N ] into (N −Γ C )-runs. In proving this, we prefer to view N -runs as N -semiruns. Indeed, we first view any N -run as an N -semirun and then apply certain of the above-mentioned operations on them to obtain some (N − Γ C )-semirun. However, we would then like to claim that the resulting (N − Γ C )-semirun is in fact an (N − Γ C )-run as desired, in particular the comparison tests need to hold. To do so, we introduce a notion when an N -semirun can be embedded into an M -semirun (possibly N = M ) in the sense that operations are being preserved, source and target control states are being preserved, and that with respect to some line ∈ Z the counter value of each configuration of the embedding has the same orientation with respect to as the counter value of the configuration it corresponds to.
is an -embedding of an M -semirun if s 0 = q 0 , s n = q m and there exists an order-preserving injective mapping ψ ∶ [0, n] → [0, m] such that Figure 5: Example of a semirun σ that could possibly be an embedding of the semirun π and a semirun τ that cannot.
Moreover we say σ is Example 25. Consider the semiruns π, σ and τ in Figure 5, where neither concrete counter values nor the control states of σ and τ are mentioned. The semirun σ can possibly be a 7-embedding of π (if its source control control is q 0 and its target control state is q 6 ). However, τ cannot be a 7-embedding of π. Indeed, for every possible ψ such that τ 2 = +p = π ψ(2) , the counter value of τ at position 2 is strictly larger than 7, whereas the counter value of π at position ψ(2) is strictly below 7.
The following remark is implictly being used in subsequent sections.
Remark 26. Embeddings possess some useful properties that all follow immediately from definition.
• Shifting distant embeddings. Let D ∈ Z C Z be a multiple of Z C , let π be a semirun and let ρ be an -embedding of π such that for all configurations q(z) in ρ we have z − > D . Then both ρ + D and ρ − D are -embeddings of π.

On hills and valleys
In this section we introduce the notions of hills and valleys. Hills are semiruns that start and end in configurations with low counter values but where all intermediate configurations have counter values above these source and target configurations, and where moreover +p-transitions (resp. −p-transitions) are followed (resp. preceded) by semiruns with absolute counter effect larger than Υ C (we refer to Figure 6 for an illustration of the concept). We also introduce the dual notion of valleys. We then prove that an N -semirun that is either a hill or a valley can be turned into a (N − Γ C )-semirun with the same source and target configuration that is an embedding. This lowering process serves as a building block in the proof of the 5 6-Lemma (Lemma 39).

Definition 27 (Hills and Valleys
). An N -semirun The Hill and Valley Lemma states that an N -semirun π that is either a B-hill or a B-valley can be turned into an (N − Γ C )-semirun with the same source and target configuration that is moreover both a min-rising and max-falling B ′ -embedding of π, where B ′ is close to B.
Lemma 28 (Hill and Valley Lemma). For all N, B ∈ N, all N -semiruns π from q 0 (z 0 ) to q n (z n ) with N > M C and Values(π) ⊆ [0, 4N ] such that moreover π is either a B-hill or a B-valley, there exists an (N − Γ C )-semirun from q 0 (z 0 ) to q n (z n ) that is both a min-rising and max-falling (B − Υ C − Γ C − 1)-embedding of π (in case π is a B-hill), or both a min-rising and max-falling We remark that the resulting (N − Γ C )-semirun satisfies further properties -these are being discussed in Section 7.2.
Before proving the Hill and Valley Lemma let us explain why the finding of the resulting embedding is delicate. Let us fix any N -semirun Let us moreover assume that π is a B-hill for some B ∈ N. We need to show the existence of some (N − Γ C )-semirun from q 0 (z 0 ) to q n (z n ) that is moreover both a min-rising and max-falling We are particularly interested in those transitions τ with absolute counter effect ∆(τ ) = N , i.e. transitions with operation +p or −p that we will denote as unlowered +p-transitions and −p-transitions respectively. Note that if there is no such transition in π, then π is already an (N − Γ C )-semirun. Let us therefore assume there is at least one transition with absolute counter effect N in π. For obtaining only an (N − Γ C )-semirun it would simply suffice to lower the absolute counter effect of these transitions by Γ C . Indeed, if the transition τ = q(z) Thus, applying such a lowering to all transitions of π whose absolute counter effect is N yields an (N − Γ C )-semirun with target configuration shifted by a multiple of Γ C , according to the operations seen in Subsection 6. However, the Hill and Valley Lemma not only requires the resulting semirun to be an (N − Γ C )-semirun but also to have same source and target configurations as the original semirun (and to be a min-rising and max-falling (B − Υ C − Γ C − 1)-embedding). Hence, simply lowering all transitions with a large counter effect as described above is not enough to prove the result as the following example illustrates. Let us assume an N -semirun π containing precisely one transition τ whose absolute counter effect is N , say π j = +p for some position j. That is, If we replace directly this j-th transition by a transition with ∆(τ ′ ) = N − Γ C , and, starting with the (j + 1)-th configuration, shift all following counter values by −Γ C , we indeed obtain an However, this (N − Γ C )-semirun does not have the same source and target configuration as the original semirun, as the target configuration's counter value has been shifted by −Γ C . Worse yet, if our initial N -semirun π were to possess several +p-transitions, then the accumuluated counter value shifts could potentially yield that the resulting (N −Γ C )-semirun is not a (B −Υ C −Γ C −1)-embedding of π: indeed, such a shifted semirun could contain intermediate configurations with counter values In order to account for those transitions whose absolute counter effect is N that have already been lowered or not we will introduce the notion of hybrid semiruns, which can be seen as sequences of N -semiruns and (N −Γ C )-semiruns whose source and target configurations are suitably connected.
• the target configuration of α (i−1) is the source configuration of β (i) for all i ∈ [1, k], and • the source configuration of α (i) is the target configuration of β (i) for all i ∈ [1, k].
We call k the breadth of η.
Remark 30. In case our initial N -semirun π contains k transitions of absolute counter effect N , we observe that π can naturally be viewed as an initial hybrid semirun of breadth k.
Several of the notions (such as counter effect, length and maximum) that we have defined for runs and semiruns can naturally be extended to hybrid semiruns. As expected, the projection φ(η) Moreover, we view the α (i) themselves as sequences (not as atomic objects) of length m i and the β (i) as sequences of length one. Using this convention, the notions of prefixes, infixes and suffixes are as expected. More importantly, we extend naturally the notion of (max-falling and min-rising) -embedding to hybrid semiruns as in Definition 24 when treating them as such sequences.
We prove the Hill and Valley Lemma (Lemma 28) in Section 7.1. We summarize important further consequences of the proof in Section 7.2.

Proof of the Hill and Valley Lemma
Let us fix any N -semirun Let us moreover assume that π is a B-hill for some B ∈ N. The case when π is a B-valley can be proven analogously.
For reasons of simplicity we separate the proof into two cases, namely if there is a +p-transition or −p-transition whose source and target configurations have counter values that are both at most B + Υ C + Γ C or not. Section 7.1.1 deals with the latter case, Section 7.1.2 with the former. It is worth mentioning that Section 7.1.2 depends on Section 7.1.1.
7.1.1 π does not contain any ±p-transition whose source and target configuration both have counter value at most B + Υ C + Γ C In the following let us denote by L the critical level, i.e. the constant Moreover, for a hybrid semirun η = α (0) β (1) α (1) ⋯β (k) α (k) , for every β (j) that is an unlowered +p-transition, we define the critical descending infix with respect to β (j) as the shortest prefix (when viewed as a sequence, as mentioned above) of α (j) β (j+1) α (j+1) ⋯β (k) α (k) that ends in a configuration with counter value at most L. In particular, this critical descending infix could possibly end in a configuration inside some (strict prefix of) α (i) , where i ∈ [j, k]. Dually, for every β (j) that is an unlowered −p-transition, we define the critical ascending infix with respect to β (j) as the shortest suffix of α (0) β (1) ⋯α (j−1) that starts in a configuration with counter value at most L. The following remark is central.
Viewing our initial semirun π as a hybrid semirun, we will now introduce two phases that successively lower unlowered +p-transitions and unlowered −p-transitions yielding hybrid semiruns that retain an approximation invariant (Definition 32).
In phase one, we are interested in unlowered +p-transitions. We want to progressively lower these, going from right to left. Moreover, we want to inspect the critical descending infix in order to obtain successive min-rising and max-falling embeddings with the same source and target configuration. In case the rightmost unlowered +p-transition has the property that its critical descending infix contains some unlowered −p-transition we lower the leftmost such directly, together with the +p-transition. Otherwise, we want to make use of the Bracket Lemma (Lemma 23) and the Depumping Lemma (Lemma 22) in order to retain some nice bracketing properties.
Having successively lowered all unlowered +p-transitions in phase one, we finally lower the remaining unlowered −p-transitions in phase two. For these we take their critical ascending infix and their ϕ ↾ -projection into account, again yielding some carefully chosen bracketing property.
The following definition formalizes the above-mentioned bracketing property.
Definition 32. A hybrid semirun η approximates π with respect to level ∈ Z if 3. η is a min-rising and max-falling -embedding of π, with the same source and target configuration as for which β (i) has operation +p, and 6. every suffix of φ ↾ (γ (i) ) contains at least as many By completing phase one and then phase two we will show the existence of a hybrid semirun that approximates π with respect to level B and does not contain any unlowered +p-transition nor any unlowered −p-transition (and is hence an (N − Γ C )-semirun). Observe first that by Point 4 any such hybrid semirun η has the same source and target configuration as π. Second, any such η is in particular a min-rising and max-falling (N − Υ C − Γ C − 1)-embedding of π since π is assumed to be a B-hill. Thus, the lemma follows. We will obtain the desired (N − Γ C )-semirun and variants thereof by first systematically lowering +p-transitions from the rightmost to the leftmost in phase one and secondly systematically lowering the possibly remaining −p-transitions from the leftmost to the rightmost in phase two. We denote such a process -whose details are given below -by the so-called (+p, −p)-lowering process. As mentioned in Remark 35 we will also define a dual variant, namely the (−p, +p)-lowering process: here phase one will consist of systematically lowering the −p-transitions from the leftmost to the rightmost, whereas phase two will systematically lower the possibly remaining +p-transitions from the rightmost to the leftmost.
Remark 35 finally discusses a variant of a (+p, −p)-lowering process (resp. (−p, +p)-process) which ends in a hybrid semirun that contains precisely one unlowered transition.
Let us discuss the (+p, −p)-lowering process in detail.
2. The critical descending infix with respect to the +p-transition β (i−1,j) does not contain any unlowered −p-transition. It follows that the critical descending infix with respect to β (i−1,j) is a non-empty prefix ξ of α (i−1,j) . We refer to Figure 8 for an illustration. Recall that η (i−1) approximates π with respect to level B. Hence, the latter must also hold for every prefix of φ(ξ). Thirdly, since by the case of this subsection the target configuration of every transition with operation +p in π has counter value strictly larger than B + Υ C + Γ C , it follows from Points 2 and 4 of Definition 32 that the target configuration of β (i−1,j) ends in a configuration with counter value strictly larger than B + Υ C + Γ C . Since ξ is the critical descending infix with respect to β (i−1,j) (in particular ending in a configuration with counter value at most B +Γ C ), it follows ∆(ξ) < −Υ C .
Recall that in phase one we have repeatedly lowered unlowered +p-transitions from right to left. In doing so we have hereby possibly lowered certain −p-transitions. The final hybrid semirun η (r) of phase one notably does not contain any unlowered +p-transition. However, η (r) may still contain unlowered −p-transitions. Lowering these will be subject of phase two. Yet, these unlowered −p-transitions will be lowered rather from leftmost to rightmost (instead of from rightmost to leftmost as in phase one).
Phase two of the (+p, −p)-lowering process: Lowering −p-transitions that remain after phase one Recall that L = B + Γ C denotes our critical level. Also recall that η (r) is the final hybrid semirun in the sequence η (0) , . . . , η (r) of phase one and approximates π with respect to level B. Note that by construction η (r) does not contain any unlowered +p-transition. That is, all unlowered transitions of η (r) have operation −p and there are as many of them as the breadth of η (r) . Setting η (0) ′ = η (r) , phase two consists in showing the existence of a sequence of hybrid semiruns η (1) ′ , . . . , η (t) ′ all of which do not contain any unlowered +p-transition and in which each where each η (i) ′ approximates π with respect to level B, and finally η (t) ′ is of breadth 0 (and is therefore already an (N − Γ C )-semirun).
Let us inductively assume that we have already defined the sequence η (0) ′ , . . . , η (i−1) ′ for some i ≥ 1 and that the breadth There is only one possible case for this phase since the critical ascending infix with respect to the leftmost unlowered −p-transition β (i−1,1) ′ does not contain any unlowered +p-transition since η (i−1) ′ does not. The construction of η (i) ′ , as well as the proof that η (i) ′ approximates π with respect to level B, is completely dual to the proof of the second case of phase one and therefore omitted.
Example 33. Figure 9 illustrates an example of an application of the (+p, −p)-lowering process. The topmost figure on the left is the starting hybrid semirun π. We begin the process by lowering the two unlowered +p-transitions each by compensating them with a −p-transition, then we enter phase two with one unlowered −p-transition remaining, which we lower and compensate by shifting and cutting out portions inside the critical ascending infix by applying the Depumping Lemma.
Remark 34. In case π is a B-valley instead of a B-hill there is a dual variant of the (+p, −p)lowering process. The critical level would be adjusted to L = B − Γ C , for unlowered +p-transitions one would define the critical descending infix to be the shortest suffix of α (0) β (1) ⋯α (j−1) that starts in a configuration with counter value at least L, whereas for unlowered −p-transitions one would define the critical ascending infix to be the shortest prefix of α (j) β (j+1) α (j+1) ⋯β (k) α (k) that ends in a configuration with counter value at least L. The definition when a hybrid semirun approximates π with respect to level B would be defined analogously as in Definition 32, but where in Point 4 α (i) is rather required to be a min-rising B-embedding of χ (i) with the same source and target configuration as χ (i) , Point 5 (resp. Point 6) of Definition 32 would rather require that every suffix (resp. every prefix) of φ ↾ (γ (i) ) contains at least as many occurrences of [ (resp. ]) as of ] (resp. [).
Remark 35. Consider the following variants of the (+p, −p)-lowering process for our B-hill π (dual variants can be formulated in the case when π is B-valley): 1. Consider the dual (−p, +p)-lowering process: In phase one we lower the −p-transitions from the leftmost to the rightmost and in phase two lower the +p-transitions from the rightmost to the leftmost. That is, such a (−p, +p)-lowering process produces a sequence of hybrid semiruns that all approximate π with respect to level B where η (0) = π, η (i) is obtained from η (i−1) by lowering the leftmost unlowered −p-transition of η (i) , by lowering the rightmost unlowered +p-transition, and finally η (t) ′ has breadth 0.
(b) If however t = 0, then we claim that every prefix (dually suffix) of φ(η (0) ′ ) = φ(η (s) ) contains at least as many occurrences of [ (dually occurrences of ]) as occurrences of ] (dually occurrences of [). Indeed, it follows immediately from the fact that each η (i) is obtained from η (i−1) by lowering a +p-transition (dually a −p-transition) either by shifting infixes and cutting out certain infixes ζ ′ for which φ(ζ ′ ) contains as many occurrences of [ as of ], or by lowering a +p-transition (dually −p-transition) together with an unlowered −p-transition (dually +p-transition) to the right (dually to the left). (c) If φ(π) a priori contains strictly more occurrences of ] than of [ one can -by applying the (+p, −p)-lowering process -obtain a sequence of hybrid semiruns where t > 0, all η (i) and η (j) ′ approximate π with respect to level B (and are therefore, as remarked above by bearing in mind that π is B-hill, in particular both min-rising and max-falling (B − Υ C − Γ C − 1)-embeddings of π with the same source and target configuration as π) and where the breadth of η (t−1) ′ is 1. Dually, if φ(π) contains strictly more occurrences of [ than of ] one can -by applying the (−p, +p)-lowering processobtain a sequence of hybrid semiruns where t > 0, all η (i) and η (j) ′ approximate π with respect to level B (and are therefore both min-rising and max-falling (B − Υ C − Γ C − 1)-embeddings of π with the same source and target configuration as π) and where the breadth of η (t−1) ′ is 1.
7.1.2 π contains a ±p-transition whose source and target configuration both have counter value at most , so the core problem is that in both cases it is not possible to apply the Bracket Lemma (Lemma 23) in the critical descending (resp. ascending) infix of such an unlowered transition. We thus have to find another way to compensate for lowering such transitions.
We next claim that firstly, any +p-transition whose configurations both have a counter value at most B + Υ C + Γ C must be the first transition of π and secondly, any −p-transition with the same property must be the last transition of π. Indeed, every +p-transition q i (z i ) πi,N q i+1 (z i+1 ) that is not the first transition (i.e. i > 0) satisfies z i ≥ B as π is a B-hill. As a consequence, we To finalize the proof it thus suffices to distinguish whether both the first transition of π is a +p-transition with counter values at most (B + Υ C + Γ C ) and the last transition of π is a −ptransition with counter values at most (B + Υ C + Γ C ), or this holds for precisely one of them. We thus distinguish these two cases, however in opposite order. We only treat the case when the first transition q 0 (z 0 ) π0,N q 1 (z 1 ) is a +p-transition with counter values at most (B + Υ C + Γ C ) and the last transition q n−1 (z n−1 ) πn−1,N q n−1 (z n−1 ) is not a −p-transition with counter values at most (B + Υ C + Γ C ), since the opposite case can be proven analogously.
Starting with η (0) = π we apply phase one of the (+p, −p)-lowering process to π yielding a sequence of hybrid semiruns that all approximate π with respect to level B (and thus in particular -bearing in mind that π is B-hill -approximates π with respect to level B − Γ C − 1) in which (as above) η (i) is obtained from η (i−1) by lowering the rightmost unlowered +p of η (i−1) however only until reaching the hybrid semirun η (s−1) that contains precisely one unlowered +ptransition, namely the first transition q 0 (z 0 ) π0,N q 1 (z 1 ) of π, which has counter values at most (B + Υ C + Γ C ) by assumption. It is important but straightforward to verify that despite the case we are in, it holds that η (i) approximates π with respect to level B (and also -bearing in mind that π is a B-hill -with respect to level B − Γ C − 1) for all i ∈ [1, s − 1].
• In case the critical descending infix of β (s−1,1) contains an unlowered −p-transition we define η (s) to be obtained from η (s−1) by lowering β (s−1,1) with the leftmost unlowered −p-transition inside the critical descending infix as above. Thus, η (s) no longer contains any unlowered +p-transition. It is again straightforward to verify that η (s) approximates π with respect to level B. Setting η (0) ′ = η (s) we then construct the sequence η (s) = η (0) ′ , η (1) ′ , . . . , η (t) ′ as usual, i.e. each η (i) ′ approximates π with respect to level B and is obtained from η (i−1) ′ by lowering the leftmost unlowered −p-transition and where eventually the breadth of η (t) ′ is 0. Thus, as desired, the final η (t) ′ is an (N − Γ C )-semirun that is a min-rising and max-falling B-embedding of π that has the same source and target configuration as π. Since η (t) ′ has the same source and target configuration as π it follows that η (t) ′ is also a min-rising and max-falling (B − Υ C − Γ C − 1)-embedding of π as required by the lemma.
-In case ζ contains an unlowered −p-transition, it must contain the leftmost unlowered −p-transition, namely β (s−1,2) . Similar as for the critical descending infix, we define η (s) to be obtained from η (s−1) by lowering β (s−1,1) together with β (s−1,2) . Here it is important to note that η (s) is not necessarily a (B − Γ C )-embedding of π since we cannot rule out the existence of configurations appearing in α (s−1,1) that have counter value B. Since η (s−1) was a B-embedding of the B-hill π with the same source and target configuration it follows however that η (s) is a (B − Γ C − 1)-embedding of π. Hence, η (s) approximates π with respect to level B − Γ C − 1. Thus, η (s) no longer contains any unlowered +p-transitions, however, possibly contains unlowered −p-transitions. Recalling that η (0) ′ = η (s) we define each of the remaining η (i) ′ to be obtained from η (i−1) ′ as usual but by retaining that each η (i) ′ approximates π with respect to level B − Γ C − 1 (instead of level B). By construction, η (0) ′ has breadth 0 and thus is an (N − Γ C )-semirun that is a min-rising and max-falling (B − Γ C − 1)-embedding and hence -bearing in mind that π is a B-hill -in particular a min-rising and max-falling (B − Υ C − Γ C − 1)-embedding of π with the same source and target configuration as π.
-In case ζ does not contain any unlowered −p-transition it follows that ζ is a prefix of α (s−1,1) , thus contains neither unlowered +p-transitions nor unlowered −p-transitions but possibly lowered ones. By an analogous reasoning as Point 2 of Remark 35 every occurrence of a lowered −p-transition in α (s−1,1) is preceded by a unique corresponding lowered +p-transition again in α (s−1,1) . Thus, every prefix of φ(ζ) contains at least as many occurrences of [ as of ]. Recalling that ∆(ζ) < −Υ C we can hence apply the Bracket Lemma (Lemma 23) and the Depumping Lemma (Lemma 22) to ζ as in phase one. The final η (s) is obtained from η (s−1) by suitably shifting subsemiruns and cutting out certain subsemiruns whose φ-projection contains the same number of occurrences of [ as of ]. Similar as argued in the previous point it follows that η (s) approximates π with respect to level B − Γ C − 1. Setting again η (0) ′ = η (s) we define the sequence of hybrid semiruns η (0) ′ , η (1) ′ , . . . , η (t) ′ that all approximate π with respect to level B − Γ C − 1 analogously as done in the previous point. Again η (t) ′ is an (N − Γ C )-semirun that is a min-rising and max-falling (B − Γ C − 1)-embedding (and hence in particular a min-rising and max-falling (B − Υ C − Γ C − 1)-embedding of π with the same source and target configuration as π.
Remark 36. Our case (where the first transition of our B-hill is a +p-transition with counter values at most B + Υ C + Γ C and the last transition is not a −p-transition with counter values at most (B + Υ C + Γ C )) allows the following "penultimate" process variants for our B-hill π (dual variants can be formulated in the case when π is B-valley): 1. The adjusted process here in Case 1 bears similar properties to those of the (+p, −p)-lowering process seen in Remark 35. Specifically, if φ(π) contains strictly more occurrences of ] than of [ one can obtain a sequence of hybrid semiruns where all η (i) and η (j) ′ approximate π with respect to level B − Γ C − 1 (and are thereforebearing in mind that π is a B-hill -in particular min-rising and max-falling (B −Υ C −Γ C −1)embeddings of π with the same source and target configuration as π) and where η (t−1) ′ has breadth 1 and contains precisely one unlowered −p-transition.
2. Dually, the (−p, +p)-lowering process mentioned in Remark 35, when applied to Case 1, is such that if φ(π) contains strictly more occurrences of [ than of ] one can obtain a sequence of hybrid semiruns where all η (i) and η (j) ′ approximate π with respect to level B − Γ C − 1 (and are thereforebearing in mind that π is a B-hill -in particular min-rising and max-falling (B −Υ C −Γ C −1)embeddings of π with the same source and target configuration as π) and where η (t−1) ′ has breadth 1 and contains precisely one unlowered +p-transition.
By our case we have that z 0 , z n ≤ B where the last inequality follows the definition of our constants on page 15.
Since π is a B-hill π is also a (B − Υ C − Γ C − 1)-hill. Moreover, obviously there are no +ptransitions nor −p-transitions in π whose source and target configuration both have counter value at most B − 1. Phrased differently, setting B ′ = B − Υ C − Γ C − 1, we view π as a B ′ -hill that does not contain any +p-transitions nor −p-transitions whose source and target configuration have a counter value at most (B ′ + Υ C + Γ C ). We can hence apply the (+p, −p)-lowering process to π as described in the case of in Section 7.1.1 for B ′ instead of B, thus yielding the sequence η (0) , η (1) , . . . , η (s) and η (0) ′ , η (1) ′ , . . . η (t) ′ of hybrid semiruns that approximate π with respect to level B ′ and are therefore min-rising and max-falling B ′ -embeddings of π: note that we use the fact that they are are indeed B ′ -embeddings as the construction in Section 7.1.1 guarantees rather than that they are (B ′ − Υ C − Γ C − 1)-embeddings. The final η (t) ′ is of breadth 0 and is hence a min-rising and max-falling (N − Γ C )-semirun that is a (B − Υ C − Γ C − 1)-embedding of π with the same source and target configuration as π, as required by the lemma.

The Hill and Valley Lemma, dependent on the number of occurrences +p-transitions as of −p-transitions
A closer look at the proof of Lemma 28 reveals that majority of occurrences of +p-transitions (resp. −p-transitions) implies the respective majority is preserved in the resulting (N − Γ C )-semirun.
The following final remark stresses the fact that when our B-hill (resp. B-valley) π contains a number of occurrences of +p-transitions different from the number of −p-transitions, the lowering processes described in the previous section yield a penultimate hybrid semirun all but one of whose +p-transitions and −p-transitions are lowered. It is an immediate consequence of Point 2.c in Remark 35 and Remark 36.
Remark 38. Let π be an N -semirun that is a B-hill (dually a B-valley).

The 5/6-Lemma
In this section, we introduce the 5 6-Lemma (Lemma 39), stating that any N -semirun with counter effect smaller than 5 6 ⋅ N can be turned into an (N − Γ C )-semirun that is moreover an -embedding for all that are in distance at most 5 6 ⋅ N from the counter values of the source and target configuration. It will be the main technical ingredient in the proof of the Small Parameter Theorem Let us first introduce the 5 6-Lemma.
For this, let us define following two constants B min = min(z 0 , z n , ) − Υ C − 2Γ C − 1 and B max = max(z 0 , z n , ) + Υ C + 2Γ C + 1 and observe that B max − B min = max(z 0 , z n , ) − min(z 0 , z n , ) + 2Υ C + 4Γ C + 2 where the penultimate inequality follows from the definitions of our constants on page 15.
We are particularly interested in subsemiruns of π that start and end in configurations with counter values in [B min + 1, B max − 1]. To categorize such subsemiruns into different types, we introduce the notion of crossing and doubly-crossing transitions.
If even moreover z i ≤ B min ≤ B max ≤ z i+1 or z i ≥ B max ≥ B min ≥ z i+1 we call π i doubly-crossing.
We already refer to Figure 10, where subsemiruns of a certain type (to be defined below) are depicted, some of whose transitions crossing transitions, some of whose are even doubly-crossing transitions.
Next, we introduce three particular types of subsemiruns of π starting and ending in configurations with counter values in [B min + 1, B max − 1].
Definition 41 (Type I, II and III subsemiruns of π). A subsemirun π[a, b] of π with source and target configuration in Q × [B min + 1, B max − 1] is Remark 42. All crossing transitions in a Type III semirun, except possibly the first or the last transition, are doubly-crossing. Figure 10 shows an example of a Type II and of a Type III subsemirun.
The following lemma factorizes π into Type I, Type II and Type III subsemiruns, bearing in mind that both the source and target configuration of π have a counter value in [B min + 1, B max − 1].
Lemma 43. The N -semirun π can be factorized into Type I, Type II, and Type III subsemiruns.
Proof. Let us first factorize π as  Figure 11: In this figure, we provide an example factorization of a semirun π. A semirun π is divided into five subsemiruns, separated by vertical lines. The third and fifth subsemiruns are of Type I, the first and fourth subsemiruns are of Type II, and the second one is of Type III.
By Remark 26 in order to prove the existence of the desired (N − Γ C )-semirun it suffices to show it for Type I, Type II and Type III subsemiruns of π.
Let us now discuss the situation for Type II subsemiruns of π. If a Type II subsemirun is already a Type I subsemirun we are done as above. In case a Type II subsemirun ρ is not of Type I we first claim that ρ is either a B min -valley or a B max -hill. Indeed, if ρ is of Type II but not of Type I one can factorize ρ as First assume that In this case any +p-transition (resp. −p-transition) ends (resp. starts) in a configuration with counter value strictly larger than B min + N . Due to the definition of our constants on page 15 we have hence ρ is a B max -hill. Secondly, in case x i ∈ [0, B min ] for all i ∈ [1, m − 1] it can analogously be shown that ρ is B min -valley.
The existence of the desired (N − Γ C )-semirun ρ ′ that is an -embedding of the Type II semirun ρ with the same source and target configuration as ρ follows immediately from the following claim, which itself (with a short justificaton below) is a consequence of the Hill and Valley Lemma (Lemma 28); thanks to the fact that the Hill and Valley Lemma guarantees the resulting (N − Γ C )semiruns to be min-rising and max-falling, we can even guarantee Values(ρ ′ ) ⊆ [min(ρ), max(ρ)].
Claim 2. For every N -semirun ρ that is either a B-hill with B ≥ + Υ C + Γ C + 1 or a B-valley with B ≤ − Υ C − Γ C − 1, there exists an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of ρ with same source and target configuration as ρ.
That the Hill and Valley Lemma produces an -embedding that has the same source and target configuration is important here. Indeed, generally speaking if ρ is any B-hill and ρ ′ is any k-embedding of ρ with the same source and target configuration as ρ and where k < B, then ρ ′ is also a k ′ -embedding of ρ for all k ′ < k. Dually, if ρ is any B-valley and ρ ′ is a k-embedding of ρ with with the same source and target configuration as ρ and where k > B, then ρ ′ is also an k ′ -embedding of ρ for all k ′ > k.
For the rest of this section it now suffices to prove that for every Type III subsemirun ρ of π there exists an (N − Γ C )-semirun ρ ′ that is an -embedding of ρ with the same source and target configuration as ρ and that moreover satisfies

Lowering Type III subsemiruns
For the rest of the section let us fix a Type III subsemirun ρ of π. Let us factorize ρ by its crossing semitransitions, i.e. as where β (1) , . . . , β (n) is an enumeration of the crossing semitransitions of ρ and each α (i) is a (possibly empty) N -subsemirun of ρ. It is worth mentioning that, indeed abusing notation, for the rest of this section we refer to n as the number of crossing semitransitions of ρ, rather than the number of transitions of our original N -run π.
An example factorization is shown in Figure 10, where the crossing transitions are depicted in bold. We remark that the only crossing transitions of ρ that are not doubly-crossing can possibly only be the first or the last one (or both).
We intend to now factorize ρ, if possible, into hills and valleys. In order to do this let us first introduce the notions of B-hill candidate and B-valley candidate.
Definition 44. Let Note that every B-hill is a B-hill candidate but not vice versa, since being a B-hill moreover requires +p-transitions to end at a configuration with counter value strictly larger than x n + Υ C and −p-transitions to start at a configuration with counter value strictly larger than x 0 + Υ C . A similar remark applies to B-valleys and B-valley candidates.
For the rest of this section we assume without loss of generality that the crossing transition β 1 is a +p-transition. The case when β 1 is −p-transition can be proven analogously.
It follows that if the number n of crossing transitions is even, then there is a unique factorization where σ (i) = β (2i−1) α (2i−1) β (2i) is a B max -hill candidate, β (2i−1) is a +p-transition and β (2i) is a −p-transition for all i ∈ [1, n 2]. Indeed, this immediately follows from the definition of crossing transitions and the fact that α (2i−1) does not contain any configuration with counter value strictly less than B max . Therefore our proof makes first a case distinction on the parity of the number n of crossing transitions.
Case A: The number of crossing transitions n is even.
Our proof next makes a case distinction on the number of B max -hill candidates σ (i) in the factorization (9) that are in fact B max -hills.
Case A.1: All of the B max -hill candidates σ (i) in (9) are in fact B max -hills. (9) is a B max -hill, to each σ (i) we can apply Claim 2 and obtain an (N − Γ C )-semirun σ (i) that is both a min-rising and max-falling -embedding of σ (i) with the same source and target configuration as σ (i) . Thus, it remains to show the same for α (2i) for each i ∈ [0, n 2]. We do this separately for α (0) , α (n) and finally for those Let us first show it for α (0) . The proof for α (n) is completely analogous. If α (0) is empty (which would imply that β (1) is crossing but not doubly-crossing), there is nothing to show. Let us therefore assume that α (0) is not empty. It follows that β (1) must be a doubly-crossing +p-transition by Remark 42. Since β (1) is the first crossing transition (even doubly-crossing) and a +p-transition and moreover ρ is of Type III one can factorize α (0) as [1, k]. It immediately follows that each α (0,j) does not contain any +p-transition nor any −p-transition, and is hence already an (N − Γ C )-semirun. Finally we claim that each σ (0,j) is in fact a (B max − N − 1)-valley. Indeed, firstly the target configuration of each +p-transition in σ (0,j) has a counter value at most B min and hence a source configuration with counter value at most B min − N < B max − N − 1 − Υ C , where the inequality follows from definition of B min and B max from page 37. Secondly and analogously, the source configuration of each −p-transition in σ (0,j) has a counter value of at most B min and hence a target configuration with counter value at most B min − N < B max − N − 1 − Υ C . Thus, to each σ (0,j) we can apply Claim 2 to obtain an (N − Γ C )-semirun σ (0,j) that is a min-rising and max-falling -embedding of σ (0,j) with the same source and target configuration as σ (0,j) . Hence, by appropriately concatenationg the α (0,j) with the σ (0,j) we obtain the desired (N − Γ C )-semirun that is an -embedding of α (0) . It now only remains and suffices to show that for each α (2i) with i ∈ [1, n 2 − 1], that there exists an (N − Γ C )-semirun that is a min-rising and max-falling -embedding of α (2i) with same source and target configuration as α (2i) . Again by Remark 42 any such α (2i) succeeds σ (i) = β (2i−1) α (2i−1) β (2i) and thus succeeds the doubly-crossing transition β (2i) and analogously preceeds σ (i+1) = β (2i+1) α (2i+1) β (2i+2) and thus precedes the doubly-crossing β (2i+1) . Therefore, analogously as done for α (0) , one can factorize α (2i) as

and is thus already an
Case A.2: All but one of the B max -hill candidates σ (i) in (9) are in fact B max -hills.
Let us assume without loss of generality that σ (1) = β (1) α (1) β (2) is the only B max -hill candidate that is not a B max -hill, the case when σ (n 2) is not a B max -hill can be treated analogously.
Clearly, by the above reasoning, either β (1) or β (2) must not be doubly-crossing. Without loss of generality let us assume that the first crossing transition β (1) is not doubly-crossing (for β (2) not doubly-crossing implies n = 2 by definition of Type III and Remark 42; this case is thus included in the dual case when σ (n 2) is not a B max -hill and the last crossing transition β (n) is not doubly-crossing).
Remarking that α (0) must be empty by our case, one can now factorize our N -semirun ρ as where β (2) is a −p-transition. For finishing this case we will proceed as follows.
2. Secondly, let us assume that β (2) is an N -semirun from q(x) to q ′ (y), say, and moreover that α (2) is doubly-crossing -obviously both a min-rising and max-falling -embedding of β (2) from q(x) to q ′ (y + Γ C ). Finally, we show the existence of an (N − Γ C )semirun that is an -embedding of α (2) Let us first show Point 1. Since β (1) is not doubly-crossing and σ (1) = β (1) α (1) β (2) is a B max -hill candidate that is not a B max -hill, the only reason for the latter is the existence of a −p-transition τ such that the counter values of the source configuration of τ and σ (1) have an absolute difference at most Υ C . Such a transition τ must have a source configuration with counter value in the interval [B max , B max + Υ C − 1] and σ (1) must then necessarily have a source configuration with a counter value in the interval [B max − Υ C , B max − 1]. Such a violation can only happen for τ = β (2) . As a consequence, the target configuration q(x) of α (1) has a counter value inside [B max , B max + Υ C − 1]. Recalling that β (1) is not doubly-crossing one can (analogously as has been done in Case A.1) factorize β (1) Again, analogously as has been done in Case A.1, to each of the χ (i) we can apply Claim 2 to turn them into a suitable min-rising and max-falling (N − Γ C )-semirun that is an -embedding of χ (i) with the same source and target configuration as χ (i) , whereas each of the ξ (i) are already (N − Γ C )-semiruns since they do not contain any +p-transitions nor −p-transitions.

Let us finally show Point 2. Consider the remaining factorization
from q ′ (y) to q ′′ (z). We need prove the existence of an (N − Γ C )-semirun from q ′ (y + Γ C ) to q ′′ (z) that is an -embedding of γ and whose counter values lie in [min(γ) − Γ C , max(γ) + Γ C ].
We first claim that ∆(γ) > Υ C . Since x ∈ [B max , B max + Υ C − 1] it follows that the counter value y of γ's source configuration q ′ (y) satisfies y ∈ [B max − N, B max + Υ C − 1 − N ]. Moreover, the target configuration q ′′ (z) of γ is the target configuration of our Type III N -semirun ρ, thus z ∈ [B min + 1, B max − 1]. Hence by the definition of our constants on page 15 we have Recall that each σ (i) is a B max -hill for all i ∈ [2, n 2] by our case. Analogously, as has been done in Case A.1, for each i ∈ [1, n 2] one can factorize α (2i) as It is important to remark that each α (2i,j) is already an (N − Γ C )-semirun since it does not contain any +p-transition nor any −p-transition. The following remark summarizes the factorization of γ.
Remark 45. Our N -semirun γ from q ′ (y) to q ′′ (z) can be written as We can now obtain suitable (N − Γ C )-semiruns with the same source and target configuration for any of the above hills and valleys by applying the Hill and Valley Lemma.
Remark 46. By applying the Hill and Valley Lemma (Lemma 28) we obtain the following.
1. For each of the B max -hills σ (i) there exists an (N − Γ C )-semirun σ (i) that is both a min-rising and max-falling (B max − Υ C − Γ C − 1)-embedding of σ (i) from the same source and target configuration as σ (i) . In particular, since σ (i) is a B max -hill and B max − Υ C − Γ C − 1 > + Γ C it follows that σ (i) is in fact an -embedding of σ (i) all of whose configurations have a counter value whose absolute difference with is strictly larger than Γ C (except for the exotic case when i = n 2 and γ in fact ends with σ (i) , and hence the last configuration of σ (i) happens to be the last configuration q ′′ (z) of γ; recalling that z ∈ [B min + 1, B max − 1]).
2. For each of the (B max − N − 1)-valleys σ (2i,j) there exists an (N − Γ C )-semirun σ (2i,j) that is both a min-rising and max-falling (B max −N −1+Υ C +Γ C +1)-embedding of σ (2i,j) with the same source and target configuration as σ (2i,j) . In particular, since σ (2i,j) is a (B max −N −1)-valley and (where the last inequality follows from the definition of B min on page 37), it follows that σ (2i,j) is in fact an -embedding of σ (2i,j) all of whose configurations have a counter value whose absolute difference with is is strictly larger than Γ C (except, similar as above, for the exotic case when i = n 2, j = k i and γ in fact ends with σ (2i,j) , and hence the last configuration σ (2i,j) happens to be the last configuration q ′′ (z) of γ).
It is worth pointing out that applying the remark immediately would only yield the existence of an (N − Γ C )-semirun γ ′ that is both a min-rising and max-falling -embedding of γ with the same source configuration q ′ (y) and the same target configuration q ′′ (z) as γ such that However we need to show the existence of such an -embedding rather from q ′ (y + Υ C ) to q ′′ (z). For this, we make a final case distinction on whether among the B max -hills σ (i) and the (B max − N − 1)-valleys σ (2i,j) there exists one whose φ-projection contains strictly more occurrences of [ as occurrences of ].
• Case A.2.i: Among the B max -hills σ (i) and the (B max − N − 1)-valleys σ (2i,j) there exists one whose φ-projection contains strictly more occurrences of [ as occurrences of ].
From the above and the fact that σ (s) is a B max -hill the following remark follows.
Remark 47. All configurations of η (except possibly the target configuration r 2 (x 2 ) in the exotic case when γ ends with σ (s) ) have a counter value whose absolute difference with is strictly larger than Γ C . Moreover on can write η as η = αβα ′ , where for some intermediate Letβ denote the lowering of β, i.e.β is the . By Remark 47 it follows that the (N − Γ C )-semirun is an -embedding of η. Bearing in mind our factorization of γ from Remark 11 and taking into account Remark 46 we obtain that that is an -embedding of γ's prefix N -semirun Moreover we have by Remark 46 that to q ′′ (z) that is both a min-rising and max-falling -embedding of γ's remaining suffix N -semirun • Case A.2.ii: Among the B max -hills σ (i) and the (B max − N − 1)-valleys σ (2i,j) all have a φ-projection that contains at least as many occurrences of ] as occurrences of [.
Observe that by Remark 46 the (N − Γ C )-semirun is both a min-rising and max-falling -embedding of γ all of whose configurations (except for possibly the target configuration q ′′ (z)) have a counter value whose absolute difference with is strictly larger than Γ C . Yet we need to show the existence of some (N − Γ C )-semirun γ ′ that is an -embedding of γ from q ′ (y + Γ C ) to q ′′ (z) that satisfies By Remark 37 all of the lowered (N − Γ C )-semiruns σ (i) and σ (2i,j) mentioned in Remark 46 contain at least as many occurrences of [ as of ] or, vice versa, at least as many occurrences of ] as of [, if σ (i) does, respectively if σ (2i,j) does.
Thus, by our case we obtain that every φ( σ (i) ) and φ( σ (2i,j) ) contains at least as many occurrences of ] as occurrences of [.
Recalling that neither α (2) nor any of the α (2i,j) contain any +p-transitions nor −p-transitions (and thus have all a φ-projection ε) it follows that φ(γ) contains at least as many occurrences of ] as occurrences of [. Note that from the definition of χ and the fact that all intermediate configurations ofγ have counter values whose absolute difference with is strictly larger than Γ C it follows that χ + Γ C is an -embedding ofγ[c, d] that has the same target configuration asγ[c, d] and that satisfies Values Finally it follows that is the desired (N − Γ C )-semirun from q ′ (y + Γ C ) to q ′′ (z) that is an -embedding ofγ and hence of γ that satisfies Case A.3: All but at least two of the B max -hill candidates σ (i) in (9) are in fact B max -hills.
Recall the factorization . By our case we must have n ≥ 4. By a similar reasoning as in Case A.2 one can show that the B max -hill candidate that are not B max -hills must be precisely the two subsemiruns σ (1) and σ (n 2) . In particular there cannot be strictly more than two B max -hill candidates in (9) that are not in fact B max -hills. Moreover, as already reasoned in Case A.2, neither β (1) nor β (n) is doubly-crossing. Thus α (0) and α (n) are empty. Hence, one can now factorize our N -semirun ρ as For finishing this case we will show the existence 1. of an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of the semirun β (1) α (1) with the same source and target configuration as β (1) α (1) , 2. of an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of the semirun α (n−1) β (n) with the same source and target configuration as α (n−1) β (n) , and 3. of an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of the semirun β (2) α (2) β (3) α (3) ⋯β (n−1) with same source and target configuration.
We can apply Claim 2 to each τ (i) and obtain an (N − Γ C )-semirun τ (i) that is both a min-rising and max-falling -embedding of τ (i) with the same source and target configuration. Thus, it only remains to show the same for α (2i+1) for each i ∈ [1, (n − 2) 2]. This is done analogously as in Case A.1 when proving the same for each α (2i) for each i ∈ [0, n 2].
Case B: The number of crossing transitions n is odd.
Recall that we had assumed without loss of generality that β (1) is a +p-transition. Since n is odd one can consider the following first factorization where ⌊n 2⌋] , and β (n) is a +p-transition; as well as the following second factorization where β 1 is a +p-transition, is a −p-transition and β (2i+1) is a +p-transition for all i ∈ [1, ⌊n 2⌋]. Indeed, this-as for the Case A factorization (9)-immediately follows from the definition of crossing transitions and the fact that neither α (2i−1) (resp. α (2i) ) contains any configuration with counter value strictly less than B max (resp. strictly larger than B min ) for all i ∈ [1, ⌊n 2⌋].
Our proof next will make a case distinction on the number of B max -hill candidates σ (i) in the factorization (12)  Let us assume without loss of generality that all of the B max -hill candidates in (12) are in fact B max -hills. The case when all B min -valley candidates in (13) are in fact B min -valleys can be proven analogously. Each N -semirun σ (i) can hence be turned into an (N − Γ C )-semirun σ (i) that is both a min-rising and max-falling -embedding of σ (i) with same source and target configuration as σ (i) according to Claim 2. Moreover, the same holds for α (2i) for all i ∈ [0, ⌊n 2⌋ − 1], as seen in Case A.1. Thus it remains to deal with the subsemiruns α (n−1) , β (n) and α (n) .
We make a final case distinction on the target configuration of the dangling +p-transition β (n) .
• Case B.1.i: β (n) has a target configuration with a counter value strictly larger than B max + Υ C .
Then clearly β (n) α (n) is a B max -hill as well since α (n) contains no configurations with counter value strictly less than B max besides its last one. The N -semirun β (n) α (n) can hence be turned into a (N − Γ C )-semirun that is both a min-rising and max-falling -embedding with the same source and target configuration according to Claim 2. Moreover, the same holds for α (n−1) , as analogously proven for α (2i) for all i ∈ [0, ⌊n 2⌋] in Case A.1. The concatenation of these two -embeddings yields an (N − Γ C )-semirun that is a min-rising and max-falling -embedding of α (n−1) β (n) α (n) with the same source and target configuration.
• Case B.1.ii: β (n) has a target configuration with a counter value strictly less than B max .
It immediately follows that β (n) is crossing but not doubly-crossing, thus α (n) is empty. The remaining α (n−1) β (n) can thus be factorized as where each χ (i) is a (B max − N − 1)-valley and each ξ (i) satisfies Values(ξ (i) ) ⊆ [B max − N, B min + 1], using a similar factorization as for proving Point 1 in Case A.2. The N -semirun α (n−1) β (n) can hence be turned into an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding with same source and target configuration. Recalling that α (n) is empty, the above embedding is an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of α (n−1) β (n) α (n) with same source and target configuration.
• Case B.1.iii: β (n) has a target configuration with counter value in [B max , B max + Υ C ].
Thus, the source configuration of β (n) has a counter value in [B max − N, B max + Υ C − N ].
One finishes this case analogously as Points 1 and 2 in Case A.2: 1. Firstly, one shows the existence of an (N − Γ C )-semirun that is both a min-rising and max-falling -embedding of α (n) with the same source and target configuration as α (n) as follows: one factorizes α (n) into (N − Γ C )-semiruns that have all counter values in [B max − 1, B min + N ] and into (B min + N + 1)-hills. 2. Secondly, let us assume that β (n) is an N -semirun from q ′ (y) to q ′′ (z) and that moreover α (0) σ (1) α (2) ⋯σ (⌊n 2⌋) α (n−1) is an N -semirun from q(x) to q ′ (y). Stipulating that β (n) = q ′ (y) +p,N q ′′ (z), we explicitly lower β (n) into the (N − Γ C )-semirun , which is -since β (n) is doubly-crossing -obviously both a min-rising and max-falling -embedding of β (n) from q ′ (y +Γ C ) to q ′′ (z). Then one shows the existence of an (N −Γ C )-semirun that is an -embedding of α (0) σ (1) α (2) ⋯σ (⌊n 2⌋) α (n) from q(x) to q ′ (y + Γ C ) with configurations all of whose counter values lie in the interval Since they all start and end with a doubly-crossing transition we remark that σ (i) is in fact a B max -hill for all i ∈ [2, ⌊n 2⌋] and τ (i) is in fact a B min -valley for all i ∈ [1, ⌊n 2⌋ − 1]. Hence our case implies that σ (1) is in fact not a B max -hill and that τ (⌊n 2⌋) is in fact not a B min -valley. As in Case A.2, β (1) and β (n) are hence not doubly-crossing, and hence α (0) and α (n) are empty.
By definition of a Type III semirun, ρ contains at least one doubly-crossing transition and thus n ≥ 3. Since the +p-transition β (1) is not doubly-crossing (and therefore ends at a counter value strictly larger than B min + N ) but β (2) is, it follows that the only reason for σ (1) = β (1) α (1) β (2) not to be a B max -hill is that the −p-transition β (2) has a source configuration with a counter value in [B max , B max +Υ C ] and hence a target configuration with counter value in [B max −N, B max +Υ C −N ], similarly as seen in Case A.2. Analogously, the only reason for τ (⌊n 2⌋) = β (n−1) α (n−1) β (n) not to be a B min -valley is that the doubly-crossing −p-transition β (n−1) has a target configuration with counter value in [B min − Υ C , B min ].

Proof of the Small Parameter Theorem
This section is devoted to proving the Small Parameter Theorem (Theorem 18).
For proving this let us fix some N > M C and some accepting N -run π in C with Values(π) ⊆ [0, 4N ] of the form with r n ∈ F . We will assume that accepting runs in C end with counter value 0 and hence, that . This is clear when one considers the construction C ′ obtained from C by adding two control states r − and r f such that every final control state of C has a ≥ 0 rule leading to r − , r − has a −1 rule that is a loop, and finally a = 0 rule to r f , the only final state of C ′ .
Starting from the accepting N -run π, we need to prove the existence of an accepting 3 by definition of the constants on page 15, the following claim is clear.
We can therefore uniquely factorize π as where each ρ (j) satisfies Values(ρ (j) ) ⊆ [0, N 3 [ and each σ (j) is some subrun π[c, d] with x c < N 3 , To finish the proof of the Small Parameter Theorem (Theorem 18), by Claim 3 it thus suffices to prove the following statement for the rest of this section.
For every N > M C and every N -run Let σ be such an N -run. Let us first assume that z i ≥ N for some i ∈ [1, m − 1] ; the case z i < N for all i ∈ [1, m − 1] will be treated later. By this asumption, one can uniquely factorize σ -as seen in Figure 12 -as is the remaining infix of σ (note that a + 1 = b is possible).
We will apply the 5/6-Lemma (Lemma 39) to one of the subruns hereby showing the existence of a suitable (N − Γ C )-semirun with same source and target configuration, respectively. We then shift this (N − Γ C )-semirun by −Γ C to obtain a suitable (N − Γ C )-run.
To which of the subruns we will choose to apply the 5/6-Lemma will depend on the counter values z a , z a+1 , z b and z b+1 . For deciding this, we make a case distinction on which of the five intervals iN 3 , (i+1)N 3 ∶ i ∈ [1,5] they lie in, respectively.
Before the above-mentioned distinction on z a , z a+1 , z b and z b+1 we first claim that one can turn the possible resulting prefixes α and ασ[a, a + 1] and possible suffixes σ[b, b + 1]γ and γ into (N − Γ C )-runs separately. The following claim tells us when these latter prefixes (resp. suffixes) can be turned into (N − Γ C )-runs whose target (resp. source) configuration has been shifted down by Γ C .
Claim 4 (Possible lowering of the prefixes and suffixes).
. We postpone the proof of Claim 4 to the end of this section but refer to Figure 16 for an illustration of Points 1 and 2.
We can use Point (1) or Point (2) of the claim to turn the possible resulting prefixes ασ[a, a + 1] or α respectively into (N − Γ C )-runs with target configuration shifted down by Γ C . Symmetrically, we can use Point (3) or Point (4) of the claim to turn the possible resulting suffixes σ[b, b + 1]γ or Assuming Claim 4 we conclude the proof by treating the following exhaustive cases on the positions of z a+1 and z b separately. 5N 3 [, cf. Figure 13.
Recall that β = σ[a + 1, b] as defined in (15) is an N -run from q a+1 (z a+1 ) to ]. We view β as an N -semirun. We consider = N and observe that Hence we can apply the 5/6-Lemma (Lemma 39) to β: there exists an Since moreover N 3 − 2Γ C > max(Consts(C)), from M C 's definition on page 15, and because min(β) ≥ N 3, it follows thatβ − Γ C , the shifting ofβ by −Γ C , is in fact an (N − Γ C )-run from p(z a+1 − Γ C ) to q b (z b − Γ C ). It thus remains to show the existence of an (N − Γ C )-run from q 0 (z 0 ) to q a+1 (z a+1 − Γ C ) and one from q b (z b − Γ C ) to q m (z m ): the former follows from Point (1) of Claim 4, and the latter follows from Point (3) of Claim 4. Figure 13.
It follows that z a , z b+1 ∈ [ 2N 3 , N [, and that σ a and σ b must be a +p and −p respectively. We apply the 5/6-Lemma (Lemma 39) to    We will however first treat the case t > 0, the case t = 0 will be treated later. It follows from z 0 < N 3 that χ 1 must be of type a); more generally, χ i is of type a) for all odd i ∈ [1, t] and of type b) for all even i ∈ [1, t]. Since z 0 < N 3 , observe that if for α's last counter value z a we have z a ∈ [N − Γ C , N [, then t must be odd, and, similarly (but not entirely dually), if for α's last counter value z a we have z a ∈ [ N 3 , N − Γ C − Υ C [, then t must be even. In the following we prefer to write α as α = α[0, a] rather than σ[0, a]. It is important to recall Note that j t+1 = j t+2 is possible if ζ is empty. In the following, we will first show how to turn any χ i of type a) (resp. b)) into a (N − Γ C )-run with target (resp. source) configuration shifted down by Γ C , and then we make a case distinction on how to end the proof based on the parity of t.
Proof of Subclaim 1. Indeed, φ(χ i ) = ε ∈ Λ 8 , as α contains neither +p-transitions nor −p-transitions. Since moreover ∆(χ i ) > Υ C we can now apply Lemma 22 to χ i (viewed as an N -semirun) and obtain an N -semirunχ i with ∆( where the inequalities follows from M C 's and Γ C 's definition on page 15. It follows thatχ i has all its counter values (except for the first one) in [ N 3 − Γ C , N − Γ C [. Moreover, the first transition's operation must be a +1 update and therefore cannot be a test, and henceχ i is an (N − Γ C )-run from q ji (z ji ) to q ji+1 (z ji+1 − Γ C ).
To finish the proof of the existence of an (N − Γ C )-run from q 0 (z 0 ) to q a+1 (z a+1 − Γ C ) we make a case distinction on the parity of t.
Assume first that the parity of t is odd. By applying Subclaims 1 and 2 to the runs χ 1 , . . . , χ t appropriately we obtain the (N − Γ C )-run following from M C 's, Γ C 's and Υ C 's definition on page 15, and φ(α) = ε, it follows that is an (N − Γ C )-run from q j1 (z j1 ) to q jt+2 (z jt+2 − Γ C ). Recall that z a+1 < 5N 3 by case assumption and also recall that where the penultimate inequality follows from the definition of M C on page 15. Hence, as σ a is not a test nor a +p-transition we have that Let us now treat the case when t is even.
. Since z a+1 ≥ N and z a < N − Γ C it follows that σ a is a +p-transition, in particular ∆(σ, a) > Γ C . Thus, It remains to discuss the case when t = 0. This case can be proven analogously. Indeed, from t = 0 it follows immediately that α = ζ and Values(ζ) ⊆ [0, N − Γ C [ and the proof is analogous as the case when t > 0 and when t is even.
Let us now sketch the proof of Point (2) of Claim 4. Let us assume z a ∈ [ N 3 + Υ C , N [. Similarly as in Point (1) we can factorize α as α = ∏ t i=1 χ i ζ and Subclaims 1 and 2 hold again. If t is odd, then by Subclaims 1 and 2 we have that the run ∏ t i=1χi (ζ − Γ C ), stipulating thatχ i is the of Subclaims 1 and 2 respectively (depending on the parity of i), is the desired If t is even, then again by Subclaims 1 and 2 we have that ξ = ∏ t i=1χi ζ is an (N − Γ C )-run from q 0 (z 0 ) to q a (z a ), where againχ i is defined as above. By definition the run ξ does not contain any +p-transitions nor −p-transitions, thus φ(ξ) = ε ∈ Λ 8 . By construction also the run ξ has all counter values, besides the first, above N 3 − Γ C > Γ C + max(Consts(C)). Moreover, as z a ≥ N 3 + Υ C and z 0 < N 3 , we have ∆(ξ) > Υ C . We can thus apply Lemma 22 to ξ, obtaining an (N − Γ C )-run ξ ′ from q 0 (z 0 ) to q a (z a − Γ C ), as required.
We now conclude the proof of our statement by treating the only remaining case, the case when σ is such that z i < N for all i ∈ [1, m − 1]. In this case we can factorize σ as σ = ∏ t i=1 χ i ζ similarly as done in the proof of Point (1) of Claim 4, where t is even, and analogously prove that ∏ t i=1χi ζ is an (N − Γ C )-run from q 0 (z 0 ) to q m (z m ), whereχ i is the output of Subclaim 1 and 2 respectively (depending on the parity of i).

Conclusion
In this paper we have shown that the reachability problem for parameteric timed automata with two parametric clocks and one parameter is complete for exponential space.
For the lower bound proof, inspired by [13,14], we made use of two results from complexity theory. First, we made use of a serializability characterization of EXPSPACE from [13] which is a padded version of the serializability characterization of PSPACE from [20], which in turn has its roots in Barrington's Theorem [7]. Second, we made use of a result of Chiu, Davida, Litow that states that numbers in chinese remainder representation can be translated into binary representation in NC 1 (and thus in logarithmic space). We are convinced that it is worthwhile to develop a suitable programming language that serves as a unifying framework in that it provides an interface for proving lower bounds for various problems involving automata. In a sense, we have developed the corresponding interface "by hand" when defining how parametric timed automata can compute functions (Definition 6).
For the EXPSPACE upper bound we first followed the approach of Bundala and Ouaknine [10] by providing an exponential time translation from reachability in parametric timed automata with two parametric clocks and one parameter (i.e. (2, 1)-PTA) to reachability in parametric one-counter automata (POCA) over one parameter, yet on a slightly less expressive POCA model as introduced in [10]. We then studied the reachability in POCA with one parameter p. Our main result, the Small Parameter Theorem (Theorem 18), states that such a parametric one-counter automaton (POCA) has an accepting run all of whose counter values lie in [0, 4 ⋅ p] if, and only if, there exists such an accepting run for some p that is at most exponential in the size of the POCA. Since the translation from (2, 1)-PTA to POCA is computable in exponential time, this gives a doubly exponential upper bound on the parameter value of the original (2, 1)-PTA and hence an EXPSPACE upper bound for reachability in (2, 1)-PTA (Corollary 19).
In proving the Small Parameter Theorem we introduced the notion of semiruns and gave several techniques for manipulating them. The Depumping Lemma 22 allowed us to construct from semiruns with large absolute counter effect new semiruns with a smaller absolute counter effect. The Bracket Lemma 23 allowed us to find in semiruns having a sufficiently large absolute counter effect and satisfying some majority condition on the number of occurrences of +p-transitions and −p-transitions some subsemirun that has again a large absolute counter effect and moreover some equal bracketing properties. Our Hill and Valley Lemma (Lemma 28) allowed to turn for sufficiently large N any N -semirun that is either a hill or a valley into an N ′ -semirun for some N ′ < N . Our 5 6-Lemma (Lemma 39) allowed to turn for sufficiently large N any N -semirun with an absolute counter effect of at most 5 6N into an N ′ -semirun for some N ′ < N .
We hope that extensions of our techniques provide a line of attack for finally showing decidability (and the precise complexity) of reachability in parametric timed automata with two parametric clocks over an arbitrary number of parameters (i.e. (2, * )-PTA). For these however, it seems that the reduction to POCA indeed requires the presence of the above-mentioned +[0, p]-transitions. When analyzing runs in the corresponding more general POCA model that in turn also involves an arbitrary number of parameters, it will become necessary to "de-scale" semiruns in the following sense. Already in the presence of two parameters one can see that it becomes necessary to decrease the value of both parameters simultaneously proportionally: for instance one can build a (2, 2)-PTA for which reachability holds only if the first parameter is a multiple of the second parameter.

A Proof of the reduction (Theorem 16)
In this appendix, we concern ourselves with proving the reduction from parametric timed automata with two parametric clocks and one parameter to parametric one-counter automata with one parameter, which was stated in the main theorem of Section 4, Theorem 16.

A.1 Overview of the proof of the reduction
In this section, we recall the main theorem of Section 4, and provide its proof overview.
Let us first recall Theorem 16. A more general (but strictly speaking incomparable) result involving two parametric clocks but an arbitrary number of parameters instead of only one has already been proven in [10], however with a different POCA formalism: Bundala and Ouaknine's model for POCA differs in that it contains operations that allow to nondeterministically add to the counter a value that lies in [0, p]. By restricting ourselves to the case of only one parameter p, we will prove in a thorough analysis that we no longer need such operations in the construction.
As in [10] we follow the following proof strategy: • In Subsection A.2, we reduce the reachability problem of a parametric timed automaton A = (Q A , Ω A , P, R A , q A , F A ) -in our setting later with two parametric clocks -to the reachability problem of a so-called parametric 0 1 timed automaton B = (Q B , Ω B , P, R B,0 , R B,1 , q B , F B ), where Ω B ⊆ Ω A contains only the non-parametric clocks of Ω A , and Consts(B) = {0}.
• In Subsection A.3 we present the region abstraction technique introduced by Alur and Dill in [2] to mimic region-restricted runs (runs inside a region) of parametric 0 1 timed automata with one parameter by arithmetic progressions.
• Finally, we present the final step of the reduction in Subsection A.4, where it is shown how to use the above-mentioned technique to mimic reset-free region-restricted runs in B, and furthermore how to provide a construction in order to mimic resets in B. The precise construction itself mainly deviates from [10] in the gadget construction for resets.

A.2 How to remove non-parametric clocks and non-parametric guards
In this subsection we show how non-parametric guards and non-parametric clocks can be eliminated from parametric timed automata. Initially introduced in [3] we define the notion of parametric 0 1 timed automata: these are essentially parametric timed automata in which each rule dictates whether a unit of time passes or not. Alur, Henzinger and Vardi have already shown in [3] how the reachability problem for parametric timed automata can be reduced to the reachability problem for parametric 0 1 timed automata that do not contain any non-parametric clocks. We will provide in Lemma 50 below an analogous reduction by not only eliminating all non-parametric clocks, but also all non-parametric guards (except for empty guards). A parametric 0 1 timed automaton (0 1-PTA for short) is a tuple B = (Q, Ω, P, R 0 , R 1 , q init , F ), where B i = (Q, Ω, P, R i , q init , F ) is a PTA for all i ∈ {0, 1}. For simplicity we define its size as B = B 0 + B 1 . Analogously, a clock ω ∈ Ω is parametric if it is parametric in B 0 or in B 1 . We analogously denote the constants of B by Consts(B) and its configurations by Conf(B).
Definition 49. For each i ∈ {0, 1}, each parameter valuation µ ∶ P → N and each (δ, t) ∈ R i × N with δ = (q, g, U, q ′ ) ∈ R i , we define the binary relation , 1}, and some δ ∈ R i . The notions of a (reset-free) µ-run (resp. N -run) and when reachability holds for B are also defined as expected.
The convention used in this and the following subsections is that parametric 0 1 timed automata are denoted by B. The main result of this subsection is the following lemma, stated slightly less general in [3] in that there is no requirement Consts(B) = {0}.
Lemma 50 ( [3]). The following is computable in exponential time: where Ω B ⊆ Ω A contains precisely the parametric clocks of Ω A , Consts(B) = {0}, and such that reachability holds for A, if, and only if, reachability holds for B.
We adjust the proof from [3]. While the idea of the construction remains the same, ours slightly deviates in that we explicitly have Consts(B) = {0}, i.e. we remove all non-parametric guards of the form ω c with c ≠ 0 as well as all non-parametric clocks.
Proof. Let us assume without loss of generality that A contains at least one parametric clock and let us fix one such clock x. We define the empty guard g as g = x ≥ 0 and observe that this guard is always satisfied. Let c max = max(Consts(A)) denote the largest constant appearing in A. Note that once the value assigned to a clock ω by a valuation v is strictly above c max , the precise value v(ω) is no longer of importance, merely the fact that v(ω) exceeds c max is relevant. Since we work with discrete time configurations, the value assigned to ω is always a non-negative integer. We will eliminate all non-parametric clocks of Ω A by storing in the state space of B the values of clocks up to c max + 1, where c max + 1 will stand for any value greater c max . Moreover we eliminate all non-empty non-parametric guards by also storing in the state space of B the values of parametric clocks in the same fashion. Formally, we define Ω B = {ω ∈ Ω A ω is parametric}, We ensure that the stored clocks progress simultaneously with the remaining parametric clocks by exploiting the fact that the rules dictate whether or not time elapses, and build the rules of B such that the +1 rules correspond to the progress of time in A whereas the +0 rules correspond to using a rule in A. Formally, • for every (q, g, U, q ′ ) ∈ R A with g ∈ G(Ω B , P ) a parametric guard, every v ∈ [0, c max + 1] Ω A we introduce a rule ((q, v), +0, g, U ′ , (q ′ , v ′ )) ∈ R B,0 , where v ′ is obtained from v except for assigning 0 to every clock in U and U ′ = U ∩ Ω B is the subset of parametric clocks of U , and • for every (q, g, U, q ′ ) ∈ R A with g ∈ G(Ω A , P ) a non-parametric guard, every v ∈ [0, c max +1] Ω A such that v ⊧ g, we introduce a rule ((q, v), +0, g , U ′ , (q ′ , v ′ )) ∈ R B,0 , where v ′ is obtained from v except for assigning 0 to every clock in U and U ′ = U ∩ Ω B is the subset of parametric clocks of U .
For the remaining subsections, let us fix a PTA A = (Q A , Ω A , P, R A , q A , F A ) with two parametric clocks x and y, and with P = {p}. Let us also fix the 0 1-PTA B = (Q B , Ω B , P, R B,0 , R B,1 , q B , F B ) produced by Theorem 50 applied to PTA A, and recall that B satisfies As expected, for every guard g of B and every region R we write R ⊧ N g if v ⊧ N g for all v ∈ R.
For each region R we say a run q 0 (v 0 ) We remark that, in any R-restricted run in B, the set of guards being satisfied or not are the same for all configurations appearing in it. Thus, the set of guards that are satisfied only depend on the region and not the particular configurations of the R-restricted run. We simply write R ⊧ g when a region R satisfies guard g.
We use this property to remove guards from the parametric 0 1 timed automaton B while still mimicking reset-free R-restricted runs.
For each region R we introduce the region automaton B R obtained from B instantiating all comparisons appropriately and by removing all rules that reset some clock. We fix g to be the empty guard x ≥ 0. Formally, the automaton B R is the 0 1-PTA obtained from B by • removing all rules (q, g, U, q ′ ) with U ≠ ∅, • removing all rules (q, g, ∅, q ′ ) for which R ⊭ g, and • replacing all rules (q, g, ∅, q ′ ) for which R ⊧ g by (q, g , ∅, q ′ ).
The following lemma is immediate. • There exists an R-restricted reset-free N -run from q(v) to q ′ (v ′ ) in B.
• There exists an N -run from q(v) to q ′ (v ′ ) in B R .

A.3.1 Capturing reset-free runs via arithmetic progressions
A one-counter automaton is a POCA C = (Q, P, R, q init , F ) with P = ∅, and with only > 0, ≥ 0, and = 0 tests. As P = ∅, we write q(z) → q ′ (z ′ ) instead of q(z) µ → q ′ (z ′ ) for one-counter automata. Given a one-counter automaton C and two of its control states q and q ′ we define the set Π(C, q, q ′ ) of counter values that configurations in control state q ′ can have from runs starting in q(0): For all a ≥ 0 and b ≥ 1 we define the arithmetic progression a + bN as a + bN = {a + b ⋅ n n ∈ N}. The following theorem in an immediate consequence of a result by To analyzing the succinctness between unary finite automata and arithmetic progressions [25].
Theorem 52 (Theorem 2 in [25]). Let C = (Q, ∅, R, q init , F ) be a one-counter automaton with +0, +1 updates only. Then for every two control states q, q ′ ∈ Q one can compute in polynomial time We remark that Theorem 52 also holds in the presence of transitions that decrement the counter, cf. Lemma 6 in [15].
Remark 53. Let R be a region and let 1 have as guard the empty guard g ε . Let only contains +0 and +1 updates and does not contain any = 0-tests, Then for all (k, ) ∈ N × N, all q, q ′ ∈ Q, and all n ∈ N the following are equivalent: • There is a run from q(k, ) to q ′ (k + n, + n) in B R .
• There is a run from q(0) to q ′ (n) in B R .
Notably, every run from q(k, ) to q ′ (k ′ , ′ ) in B R satisfies k ′ = k + n and ′ = + n for some n ∈ N.
We apply Theorem 52 to all one-counter automata B R from Remark 53. This yields the following characterization.
Lemma 54. From the 0 1-PTA B = (Q B , {x, y}, {p}, R B,0 , R B,1 , q B , F B ) for every two control states q, q ′ ∈ Q B , for all regions R one can compute in polynomial time (in B ) a set {(a j , b j ) ∈ N 2 j ∈ [1, r]} such that for all N, t ∈ N and all v, v + t ∈ R the following are equivalent: • There exists a reset-free R-restricted N -run from q(v) to q ′ (v + t) in B.
• t ∈ ⋃ 1≤j≤r a j + b j N. Recall also the set of regions of B defined in Section A.3. We want to construct some POCA C = (Q C , {p}, R C , q c , F C ) such that reachability holds for B if, and only if, reachability holds for C and moreover for all N ∈ N, every accepting N -run π in C satisfies Values(π) ⊆ [0, 4 ⋅ max (N, C )].
The to be constructed POCA C (again over one parameter that will be evaluated to the same value as the only parameter of B) will test whether an accepting N -run exists in B by using the definitions of regions and Lemma 54 from the last subsection, but also using additional gadgets to mimic the reset of a clock inside a particular region. In what follows we denote the current value of the counter of C by z. For the time being in our construction z can be negative: we will later show how to obtain non-negativity and the required restriction that all N -runs π of C satisfy Values(π) ⊆ [0, 4N ].
The idea of the reduction is to factorize any possible accepting N -run into maximal reset-free subruns. We will use the current counter value z of C to store the clock valuation difference v(x) − v(y), thus initially 0. We remark that between two consecutive resets, the difference v(x) − v(y) stays the same throughout, but after some clock of Ω B (either x or y) is reset, this particular reset clock will be equal to zero but not necessarily the other one. The counter of C therefore needs to be modified accordingly. As expected, we construct C in such a way that after a reset of y, the counter value z equals v(x), and after a reset of x the counter value z equals −v(y). See Figure 19 for an idea of the relationship between v(x), v(y) and z along the curve of the clock values.
Notice that once the value of a clock becomes strictly larger than N , its exact value is irrelevant to any future parametric comparison in B, hence one only needs to remember that its value is strictly larger than N . Thus, our counter z will only track the values v(x) and v(y) up to N and possibly remember which of the two clock values exceeds N . Therefore, when a reset occurs and we store the value of the other clock in the counter, if it exceeds this N we can and will replace it by N + 1, and if it is strictly below −N , we can and will replace it by −N − 1. Let us therefore assume for now that the value of the counter z following the last reset is in this interval [−N − 1, N + 1]. Initially this is surely true as initially the value of the counter is 0. We will show how to provide this invariant on the next reset assuming it holds on the last reset.
Recall the definition of regions from Subsection A.3. Let us assume a subrun q(v) starting and ending by a reset of at least one of the two clocks {x, y} and where q ′ (v ′ ) N → * q ′′ (v ′′ ) is reset-free. We want C to be able to check whether such a run can exist.
For rest of the proof let us assume without loss of generlity that y is reset along q(v) where the latter configuration can hence be written as q ′ (z, 0), as we want the counter z to store the value of x.

The POCA C guesses
• the regions R 0 , R 1 , . . ., R l visited and the order in which they are visited, where here by convention R k denotes the region assumed to be the k-th visited region, • the control states s 0 , . . ., s l when each region is visited for the first time, • the control states q 0 , . . ., q l when each region is visited for the last time, • the control state q ′′ in which the next reset of B occurs, and • which clock is going to be reset next (either x or y).
Note that there are only a finite number of regions. Our POCA C then checks that the sequence R 0 , R 1 , . . . R l is valid, retaining the counter value z.
First C checks that (z, 0) lies in R 0 i.e. that z is equal to 0 if R 0 = (0, 0), strictly between 0 and N if R 0 = (0, 0) ↔ (N, 0), equal to N if R 0 = (N, 0) and strictly above N if R 0 = (N, 0) ↔ (+∞, 0). and moreover checks that the guessed regions are adjacent, and that the regions can be visited in the guessed order.
Then C checks reachability within each individual region using Lemma 54 as follows. To each region R k one can associate a set {(a k,j , b k,j ) ∈ N 2 j ∈ [1, r k ]} obtained by Lemma 54. This allows C to check, for every k < l, for every v ∈ R k , v + t ∈ R k , reachability of q k (v + t) from s k (v) in the region R k by checking whether or not t ∈ ⋃ 1≤j≤r a j + b j N. In order to check reachability inside a region R k of the form (α, β) or (α, β) ↔ (γ, η) for α, β ∈ {0, N }, and γ, η ∈ {0, N, +∞}, it suffices to check that ⋃ 1≤j≤r a k,j + b k,j N contains 0, as the clock values cannot both increment and remain inside these regions, i.e. for any such R k , for all v ∈ R k , v + t ∈ R k implies that t = 0. Indeed, one can check easily check whether 0 ∈ ⋃ 1≤j≤r a k,j + b k,j N by computing {(a k,j , b k,j ) ∈ N 2 j ∈ [1, r k ]}, which can be done in polynomial time in B . Now, to check that an N -run exists in B in a given region R k of the form Lower-Left, Lower-Right, Upper-Left or Upper-Right, the automaton C furthermore distinguishes whether the computation in the region R k starts on the left side or on the bottom side, and whether the computation in the region R k ends on the right side or on the top side, and uses the semilinearity property to check that the value added to the clocks is indeed in ⋃ 1≤j≤r a k,j + b k,j N. Note that the first configuration of Lower-Left is necessarily of the form s k (z + 1, 1) as y has been assumed to be the last clock to be reset, the first configuration of Lower-Right is of the form s k (z + 1, 1) or s k (N + 1, N + 1 − z), depending on whether it has been reached from the bottom or from the left corner (or possibly both), and finally note that Upper-Left cannot be reached if y was the last clock to be reset.
Thus, to check reachability inside R k , our POCA C guesses an offset a = a k,j and a period b = b k,j among the generators of {(a k,j , b k,j ) ∈ N 2 j ∈ [1, r k ]} that it will use to reach q k . Secondly we define four gadgets in order to handle the three regions possibly traversed, namely Lower-Left,Lower-Right, and Upper-Right.

Case 1. Checking reachability in the Lower-Left region.
Here the region is necessarily reached from bottom side as y was the last clock to be reset. Moreover, as clocks progress at the same rate, the region is necessarily exited in the right corner (or both in the right and upper corner). Here C checks that q k (N − 1, N − 1 − z) is reachable from s k (z + 1, 1), i.e. C checks that (N − 1) − (z + 1) ∈ a + bN which in turn is equivalent to checking if z + 2 − N + a = −n ⋅ b for some n ∈ N. Figure 19 for an illustration of the trajectories of the counter values. In order to restore the value z the POCA C does this by a carefully chosen gadget shown in    Here the region is necessarily exited in the top side, and we will show how C can check that q k (N + z − 1, N − 1) is reachable from s k (z + 1, 1) and then restore z. Indeed, since y was the last clock that was reset, due our convention z ∈ [−(N + 1), N + 1] and by our case we must have z +1 ∈ {N +1, N +2}, and therefore z ∈ {N, N +1}. Our POCA distinguishes the two cases z = N and z = N + 1 explicitly as follows. To check that that q k (N + z − 1, N − 1) is reachable from s k (z + 1, 1) we need to test if N − 2 ∈ a + bN. Our POCA C first tests if z equals N or if z equals N + 1, then does the test by a carefully chosen sequence of operations that allow to restore the counter value z ∈ {N, N + 1} as can be seen in the gadget in Figure 21. Since (z + 1, 1) ∈ Lower-Right the counter value along the gadget stays inside the interval [−(a + 2), N + 1].
Case 3. Checking reachability in the Lower-Right region when reached from the left side.
Here the region is necessarily exited in the top side, and C checks that q k (N + z − 1, N − 1) is reachable from s k (N + 1, N + 1 − z) , i.e. C checks that (z + N − 1) − (N + 1) ∈ a + bN or equivalently if z − 2 ∈ a + bN. Since (N + 1, N + 1 − z) ∈ Lower-Right it follows z ∈ [0, N ]. Again by a carefully chosen sequence of operations that allow to restore the counter value z ∈ [0, N ] we can realize this test as seen in the gadget in Figure 22. Since (N + 1, N + 1 − z) ∈ Lower-Right the counter value along the gadget stays inside the interval [−(a + 2), N ].
No other region is reachable from Upper-Right. Moreover, if y was among the last clocks to be reset, as the clocks valuations increment at the same rate, region Upper-Left is not reachable. Thus the three treated above cases conclude the question of reachability inside a region. Next, in order to test whether or not it is possible to reach R k+1 in state s k+1 from R k and state q k , we check whether or not in B there exists some +1 rule of the form (q k , g, ∅, s k+1 ) such that R k ⊧ g (and there is hence a corresponding rule in B R k ).
To finish the construction our POCA C needs to be able to simulate clock resets in an N -run in B. The process will depend on the guessed region R l in which the reset is assumed to occur. For R l of the form (α, β) with α, β ∈ {0, N }, the precise value of each clock is known: if x is the next  clock to be reset, then the new counter value should be −v(y), i.e. −β, and if y is the next clock to be reset, then the new counter value should be v(x), i.e. α. For R l of the form (α, β) ↔ (γ, β), with α, β ∈ {0, N }, and with γ ∈ {0, N, +∞}, the precise value of each clock again is known: if x is the next clock to be reset, then the new counter value should be −v(y), i.e. −β. If y is the next clock to be reset, then the new counter value should be v(x), which, when z is the value of x when y was last reset, is equal to z plus the value of y, i.e. z + β. If z has has absolute value at most N , then z + N has absolute value at most 2 ⋅ N . We thus test whether or not the absolute value of z + β's exceeds N + 1 or not, and, if it is the case, we set it to N + 1 before performing any other operation.
The case when R l is of the form (α, β) ↔ (α, δ) with α, β ∈ {0, N }, and with δ ∈ {0, N, +∞} is only possible if α = δ = N (we refer to Figure 19) and is done as follows. The case when y is the next clock to be reset is again easy, we set the new counter value to N . If x is the next clock to be reset, then the new counter value should be −v(y). To do so, observe that v(y), when z was the value of x when y was last reset, is equal to N − z, thus the new counter value should be −(N − z) = z − N . If already z = −(N + 1), we do not add anything. Since z ∈ [0, N + 1] by our case the new counter value has absolute value at most N .
Observe that since we have assumed without loss of generality that y was the last clock to be reset, we cannot have a reset inside the region Upper-Left. Thus, it remains to simulate resets in the regions Lower-Left, Lower-Right, and Upper-Right. For this observe that the precise value of each clock is not known, but it is feasible to nondeterministically guess the value of the clocks when the reset occurs, based on the region and whether it was reached from the bottom side or the left side. This case distinction allows us to know the exact starting clock valuation v l of the R l -restricted run preceding the reset. From this, we guess an element t of ⋃ 1≤j≤r l a l,j + b l,j N to increment the clock valuation by t in such a way that v l + t ∈ R l . We will distinguish which of the two clocks x and y will be reset next.

Case 1. Simulating resets in the Lower-Left region.
Let us first discuss the case when y (and only y) is the next clock to be reset. In this case C nondeterministically guesses a configuration q(z + 1 + δ, 1 + δ) with z + 1 + δ ≤ N − 1 reachable from s l (z + 1, 1), i.e. δ ∈ ⋃ 1≤j≤r l a l,j + b l,j N. To do that C adds a number of the form 1 + a + b ⋅ n for some n ∈ N to the counter and checks that it is at most N − 1, as seen in Figure 23. We remark that counter values along this gadget stay inside [0, N − 1].
Let us now discuss the case when x (and only x) is the next clock to be reset. In this case C nondeterministically establishes a counter value of the form −δ − 1 such that −(δ + 1) ≥ z − N + 1, where δ = a + b ⋅ n for some n ∈ N, as seen in Figure 24 We remark that the counter values along this gadget stay inside [−(N − 1), N − 1].
The case when x and y are next to be reset simultaneously can be done analogously by setting the new counter to 0 and is not discussed in detail here.
Case 2. Simulating resets in the Lower-Right region when reached from the left side.
Let us first discuss the case when y (and only y) is the next clock to be reset. In this case our  POCA C nondeterministically guesses a configuration q(N +1+δ, N +1+δ−z) with N +1+δ−z ≤ N −1 reachable from s l (N + 1, N + 1 − z), i.e. where δ ∈ ⋃ 1≤j≤r l a l,j + b l,j N is of the form a + b ⋅ n with a, b, n ∈ N. Then C will have counter value N + 1 + δ > N , and thus C sets the counter value to N + 1. To do that, C works as seen in Figure 25. We remark that the counter values along this gadget stay inside [−1, 2N ].
Let us now discuss the case when x (and only x) is the next clock to be reset. In this case our POCA C establishes the new counter value z − δ − N − 1, realized by the gadget seen in Figure 26. We remark that the counter values along this gadget stay inside [−(N − 1), N + 1].
The case when x and y are next to be reset simultaneously can be done analogously by setting the new counter to 0 and is not discussed in detail here. Let us first discuss the case when y (and only y) is the next clock to be reset. In this case our POCA C nondeterministically guesses a configuration s l (z + 1 + δ, 1 + δ) with 1 + δ ≤ N − 1 reachable from s l (z + 1, 1). We need to check that there exists δ ∈ ⋃ 1≤j≤r l a l,j + b l,j N which moreover satisfies the inequality 1 + δ ≤ N − 1, or equivalently z + 1 + δ ≤ N − 1 + z . Moreover, as by assumption z ≤ N + 1, and moreover (z + 1, 1) ∈ Lower-Right, we must have z ∈ {N, N + 1}. Our POCA distinguishes the two cases z = N and z = N + 1 explicitly similarly as checking reachability in the Lower-Right region when reached from the bottom side. The gadget can be found in Figure 27. We remark that the counter values along this gadget stay inside [1, 2N ].
Let us now discuss the case when x (and only x) is the next clock to be reset. The gadget can be found in Figure 28. We remark that the counter values along this gadget stay inside [−(N −1), N +1].
The case when x and y are next to be reset simultaneously can be done analogously by setting the new counter to 0 and is not discussed in detail here.    Here by definition of the region the values of the clocks are above N + 1 and hence again their precise value is not relevant, only the existence of a way to reach the configuration when the reset occurs. Here we precompute in our reduction whether ⋃ 1≤j≤r l a l,j + b l,j N is not empty, and then set the counter to N + 1 (if y is to next to be reset) and to −(N + 1) (if x is next to be reset) and to 0 if both are to be reset.
We notice that for each gadget implementation for testing reachability inside a region and for implementing the resets of clock x, clock y or both simultaneously, the value of the counter stays inside the interval [−2 ⋅ max(a + 2, N ), 2 ⋅ max(a + 2, N )], where a is the value of the offset used in the gadget.
Checking reachability and simulating resets when x was the last clock to be reset, instead of y, works again in a symmetrical way and can be dually shown to be such that the value of the counter stays inside the same interval. Testing reachability of a guessed final state inside a region works the same way as the implementation of a reset in the region, with C guessing a final control state in which the computation ends instead of a control state in which the next reset occurs.
Finally we show how to achieve non-negativity. First, our final automaton checks whether or not the value N is greater than (2 + c max ), where c max is the maximal of all offsets a k,j and all periods b k,j used in any gadget. Then, fixing u = max(c max + 2, N ), we transition into a new POCA obtained from the POCA described above (the construction where we allowed the counter Figure 29: A gadget for adjusting a ≤ p-test when intially offsetting the counter by 2 ⋅ u. to take negative values) by first adding two +u gadgets before entering the initial state, as seen in Figure 29. Furthermore, any comparison operation ≤ p (resp. ≤ c) is replaced by a gadget as seen in Figure 29, using an appropriate adjusted gadget for ≤ (2 ⋅ u) comparison. Comparisons of the form > p, = p, < p, and ≤ p (resp. > c, = c, < c, and ≤ c) are performed in an analogous manner.
Finally, for any modulo test, to simulate a mod b rule, we have two parallel branches, • firstly a ≥ (2 ⋅ u) comparison followed by determining the residual modulo b of the current counter value, say r 1 , using the state space (by repeatedly substractiong at most b from the counter, performing mod b, then adding the same amount as substracted), then substracting u, then determining the new residual modulo b, say r 2 , keeping track of it using the state space too (by repeatedly substracting at most b to the counter, then performing mod b, and then adding the same amount as substracted), • secondly a ≤ (2 ⋅ u) comparison, followed by a similar gadget but where instead of using a −u operation, we use a +u operation and instead of substracting at most b, adding at most b.
We then compare the two residual r 1 and r 2 stored in the state space, and check whether or not r 1 − 2 ⋅ (r 1 − r 2 ), the residual the counter value would have had without the 2 ⋅ u offset, is equal to 0 (in the state space), before restoring the counter value to the value it had before entering the gadget.
Notice that this enforces that the value of the counters stays between 0 and 4 ⋅ (max(N, (2 + c max )), and by observing that C ≥ 2 + c max , this enforces that the counter value stays between 0 and 4 ⋅ (max (N, C )).