Parametric Presburger arithmetic: logic, combinatorics, and quasi-polynomial behavior

Parametric Presburger arithmetic concerns families of sets S_t in Z^d, for t in N, that are defined using addition, inequalities, constants in Z, Boolean operations, multiplication by t, and quantifiers on variables ranging over Z. That is, such families are defined using quantifiers and Boolean combinations of formulas of the form a(t) x<= b(t), where a(t) is in Z[t]^d, b(t) in Z[t]. A function g: N ->Z is a quasi-polynomial if there exists a period m and polynomials f_0, ..., f_{m-1} in Q[t] such that g(t)=f_i(t) for t congruent to i (mod m.) Recent results of Chen, Li, Sam; Calegari, Walker; Roune, Woods; and Shen concern specific families in parametric Presburger arithmetic that exhibit quasi-polynomial behavior. For example, S_t might be an a quasi-polynomial function of t or an element x(t) in S_t might be specifiable as a function with quasi-polynomial coordinates, for sufficiently large t. Woods conjectured that all parametric Presburger sets exhibit this quasi-polynomial behavior. Here, we prove this conjecture, using various tools from logic and combinatorics.


Introduction
We examine a broad class of problems that exhibit quasi-polynomial behavior.
is a quasi-polynomial with period 2.
In [19], Woods noticed that several recent results concern different kinds of EQP behavior in combinatorially defined families. For example, given a family of sets S t ⊆ Z d for t ∈ N, |S t | might be an EQP function of t or an element x(t) ∈ S t might be specifiable as a function with EQP coordinates. These results are all concerned with the following types of sets [19]: Definition 1.3. Given d ∈ N, a parametric Presburger family is a collection {S t : t ∈ N} of subsets of Z d which can be defined by a formula using addition, inequalities, multiplication and addition by constants from Z, Boolean operations (and, or, not), multiplication by t, and quantifiers (∀, ∃) on variables ranging over Z. That is, such families are defined using quantifiers and Boolean combinations of formulas of the form In Section 1.1, we give a number of examples of parametric Presburger families, and discuss their previously known EQP behavior. Note that, for fixed t, a formula a(t) · x ≤ b(t) is simply a linear inequality; as t changes, the half-space that this linear inequality defines both shifts (as b(t) changes) and rotates (as a(t) changes). It is important to emphasize that we do not allow quantifiers ∃t or ∀t applied to the parameter t.
In [19], Woods conjectured that these parametric Presburger families always have EQP behavior. In this paper, we prove this conjecture. After seeing several examples in Section 1.1, we state this theorem precisely in Section 1.2.

Examples
Example 1.4. Let S t be the set of integer points, x ∈ Z d , in a parametric polyhedron defined by a conjunction of linear inequalities of the form a · x ≤ tb, where a ∈ Z d and b ∈ Z. That is, S t = tP ∩ Z d for some rational polyhedron P ⊆ R d .
Calegari and Walker were similarly concerned [2] with the integer points in a polyhedron, P t , defined by linear inequalities of the form a(t) · x ≤ b(t). Rather than counting |P t ∩ Z d |, they wanted to find the vertices of the integer hull of P t , that is, the vertices of the convex hull of P t ∩ Z d .
Example 1.7. Consider the twisting square, P t , from Example 1.6. When t is even, the vertices of P t are integers, so the vertices of the integer hull are simply the vertices of P t : When t is odd, the integer hull of P t is an octagon (pictured in Figure 1b for t = 5) with vertices Abstracting from the last example, the following turns out to be true (first proved by Calegari and Walker [2] under an additional hypothesis on P t , later proved in general by Shen [17]): Theorem 1.8. Suppose that P t ⊆ R d is a family of polyhedra defined by a finite conjunction of linear inequalities a(t) · x ≤ b(t) where a ∈ Z[t] d , b ∈ Z[t], and that every P t is bounded. Then there exists a modulus m and functions p i j : N → Z d with polynomial coordinates such that, for 0 ≤ i < m and for sufficiently large t ≡ i mod m, the set of vertices of the integer hull of P t ∩ Z d is {p i1 (t), p i2 (t), . . . , p ik i (t)}.
Note the heavy use of quantifiers in this definition, demonstrating that parametric Presburger arithmetic is a natural setting. If the a i are relatively prime, then S contains all sufficiently large integers, and the Frobenius number is defined to be the largest integer not in S. This is easily encoded in Presburger arithmetic as the (unique) element x ∈ N satisfying x / ∈ S ∧ ∀y ∈ Z (y / ∈ S → y ≤ x) .
Now we let a i = a i (t) vary with t. Roune and Woods proved [14], in a few special cases, that the Frobenius number is an EQP. More recently, Shen [16] proved that this is always true for any eventually positive a i ∈ Z[t].
One more example (from [19]) concisely shows the sort of EQP behavior that may appear: Example 1.11. Given t ∈ N, let S t = x ∈ N : ∃y ∈ N, 2x + 2y + 3 = 5t and t < x ≤ y .
We can compute that This set has several properties, which we will formalize in Section 1.2: 1. The set of t such that S t is nonempty is {3, 5, 7, . . .}. This set is eventually periodic. 3. When S t is nonempty, we can obtain an element of (indeed, the maximum element of) S t with the function x(t) = (5t − 3)/4 , and x(t) is eventually a quasi-polynomial. 4. We can compute the generating function

The cardinality of S t is
We see that, for fixed t, this generating function is a rational function. Considering each residue class of t mod 4 separately, the exponents in the rational function can eventually be written as polynomials in t.
Here are two examples that show that our precise definition of parametric Presburger families is important in order to get EQP behavior: is not a parametric Presburger family, because two variables (neither of which are the parameter, t) are multiplied together. Indeed, |S t | is the number of nonnegative divisors of t, which is not an EQP function in t.
Example 1.13. The family has two parameters, s,t ∈ N. S s,t is an interval in Z 2 with endpoints (t, 0) and (0, s), and |S s,t | = gcd(s,t) + 1.
For a fixed s, this is an EQP function of t (and vice versa), but it is not jointly an EQP function in s and t.

Statement of result
In general, let S t , for t ∈ N, be a family of subsets of Z d and consider the following properties that S t might have, cf. Example 1.11.

Property 1
The set of t such that S t is nonempty is eventually periodic.
Property 2 There exists an EQP g : N → N such that, if S t has finite cardinality, then g(t) = |S t |. The set of t such that S t has finite cardinality is eventually periodic.
Property 3 There exists a function x : N → Z d , whose coordinate functions are EQPs, such that, if S t is nonempty, then x(t) ∈ S t . The set of t such that S t is nonempty is eventually periodic.
Property 4 (Assuming S t ⊆ N d ) There exists a period m such that, for sufficiently large t ≡ i mod m, where α i j ∈ Q, and the coordinate functions of q ij , b ij : N → Z d are polynomials with the b ij (t) eventually lexicographically positive. (That is, for sufficiently large t, the vector b ij (t) is nonzero and its first nonzero coordinate is positive.) Property 2 is about counting all solutions and Property 3 is about obtaining specific solutions, and so they seem somewhat different. Generating functions and Property 4 turn out to be the appropriate common generalization. Woods proves [19, Theorem 3.3] a web of implications among these properties; in particular: Theorem 1.14. Let S t be any family of subsets of N d . If S t satisfies Property 4, then it also satisfies Properties 1, 2, and 3.
Woods conjectures [19] that these properties all hold for parametric Presburger families. The contribution of this paper is to prove this conjecture, namely: In general, quantifiers and Boolean operations allow us to perform many useful operations on sets. For example, if S t is any parametric Presburger set and c ∈ Z d is constant, then the set of x ∈ S t maximizing c · x can be defined using the parametric Presburger formula Likewise, if we know that Property 3 holds for all parametric Presburger families, and if x : N → Z d is a function with EQP coordinates picking out an element of S t whenever this set is nonempty, then we can apply Property 3 again to the new parametric Presburger family S t \ {x(t)} to obtain a function x 2 : N → Z d such that whenever |S t | ≥ 2, the pair (x(t), x 2 (t)) selects two distinct elements of S t .
Arguing as in the previous paragraph, Woods proved [19,Theorem 3.4] that the following would be an immediate corollary to Theorem 1.15: Corollary 1.16. Suppose S t ⊆ Z d is a parametric Presburger family. Then S t has the following properties: it is attained at x(t) ∈ S t , and the coordinate functions of x are EQPs. The set of t such that the maximum exists is eventually periodic.
Property 3b Fix k ∈ N. There exist functions x 1 , . . . , are distinct elements of S t , and the coordinate functions of x i are EQPs. The set of t such that |S t | ≥ k is eventually periodic.
As a further illustration of the power of parametric Presburger arithmetic, note that the ability to maximize a linear functional allows us to run the beyond-and-beneath algorithm (see Grünbaum [8,Section 5.2]) on the integer points in a parametric polyhedron, P t , defined by linear inequalities of the form a(t) · x ≤ b(t). This will iteratively compute vertices of the integer hull, and they will have EQP coordinates. Given the uniform (across t) bound on the number of vertices, as proved in [2], this suffices to re-prove Theorem 1.8. All other theorems discussed in Section 1.1 are immediate consequences of Theorem 1.15.
First, in Section 2 we give an outline of the proof of Theorem 1.15, which combines ideas from logic and combinatorics. We set up the logical foundations carefully in Section 3, and then we prove Properties 1, 2, and 3 for Theorem 1.15 in Section 4. This allows us to prove them in the full generality of Z d , but more importantly it shows that the generating function tools are not necessary: we have enough combinatorial information about the sets S t to prove Properties 1, 2 and 3 directly. In Section 5, we discuss generating functions in more detail and prove Property 4.

Outline of Proof
We are given a set S t defined in parametric Presburger arithmetic, whose language we will denote L EQP . This language allows (repeated) multiplication by t, so that the atomic formulas (the basic building blocks) are of the form More complicated formulas may be built up using Boolean operations and quantifiers.
By contrast, the language of standard Presburger arithmetic, which we denote L Pres , does not allow multiplication by t, so that its atomic formulas are of the form a · x ≤ b or a · x = b, where a ∈ Z d , b ∈ Z. A standard technique to analyze formulas in L Pres is quantifier elimination: obtain a logically equivalent formula (one defining the same set) that has no quantifiers. Example 2.1. The statements ∃y [x + y ≤ z ∧ y ≥ 3] and x ≤ z − 3 are logically equivalent modulo the theory of Presburger arithmetic; in the second statement, the quantified variable y has been eliminated.
Presburger originally analyzed [12] (see [13] for a translation) these formulas; Cooper [4] uses the following strategy for quantifier elimination: Eliminate quantified variables one at a time (innermost to outermost). Since ∀y ϕ(x, y) is equivalent to ¬∃y ¬ϕ(x, y), we may assume we are eliminating an existential quantifier from a formula of the form ∃y ϕ(x, y). Cooper's strategy is to find a finite set of candidate y's (each written in terms of x) such that: there exists y making ϕ(x, y) true if and only if one of the candidate y's makes ϕ(x, y) true. Example 2.2. If there exists a y ∈ Z such that x + 1 ≤ y ≤ z ∧ 2y ≤ 3z − x then y = x + 1 must be such a y (this is the smallest integer y satisfying the only lower bound on y, and therefore it is the most likely y to also satisfy the upper bounds). Substituting in y = x + 1 eliminates the quantifier, and we are left with In general, unfortunately, this does not quite work to guarantee that we may eliminate a quantifier. Instead, we may need to introduce some divisibility conditions: Example 2.3. If there exists a y ∈ Z such that x + 1 ≤ 2y ≤ z ∧ 2y ≤ 3z − x then our candidate for y depends on the parity of x: if x is odd, then y = (x + 1)/2 is our candidate, and if x is even, then y = (x + 2)/2 is our candidate. Allowing ourselves to use divisibility by 2 in the formula, we eliminate y to get: To completely eliminate all quantifies in L Pres , we must extend our language to L + Pres , where testing divisibility by a constant, c, is allowed. Formally, we introduce divisibility predicates, D c , for constants c, into our language. For example, we write 2 (x − 1) as D 2 (x − 1).
Our proof begins by trying to apply these techniques in L EQP , where multiplication by t is allowed.
Step 1: Goodrick does exactly this in [7] (and Lasaruk and Sturm [11] independently arrived at essentially the same result using a different technique). Not surprisingly, we need to extend our language to L + EQP , where we are also allowed to test divisibility by polynomials in t (that is, we allow divisibility predicates D f (t) , where f (t) is a polynomial in t). Even this is not quite enough to eliminate quantifiers: Example 2.4. If there exists a y ∈ Z such that x + 1 ≤ ty ≤ z ∧ ty ≤ 3z − x then our candidate for y depends on x mod t: if x ≡ i mod t, for 0 ≤ i ≤ t − 1, then y = (x + t − i)/t is our candidate. Unfortunately, we now have t different candidates for y, and we cannot simply list them in a formula. Instead, we must write something like: We have replaced the old quantified y with a new quantified i, but we have gained something: i is bounded by a polynomial in t.
Goodrick proves [7] that any parametric Presburger family {S t : t ∈ N} is definable by an L + EQPformula with polynomially-bounded quantifiers. Using this result, we now have that every quantified variable y is associated with a condition of the form 0 ≤ y ≤ f (t), where f : N → Z is a polynomial function of t.
Step 2: Next, we eliminate all occurrences of the divisibility predicates D f (t) . We do this by replacing each variable x i by an expression g(t) · u i + v i where u i and v i are new variables, g is a nonnegative common multiple of all the functions f 1 , . . . , f n which occur in divisibility predicates D f i in the formula, and with the restriction that 0 ≤ v i < g(t). That is, u i and v i represent the quotient and remainder when x i is divided by g(t).
Let g(t) = t(t + 1) and . Furthermore, 0 ≤ v i < t(t + 1) implies that v 1 + 2v 2 < 3t(t + 1), and so D t+1 (v 1 + 2v 2 ) could be replaced by the formula Replacing both predicates, we define S t as the set Notice that we have eliminated the divisibility predicates, at the expense of introducing some additional polynomially-bounded quantifiers. The result of Step 2 is a new parametric Presburger family S t whose points are in bijection with those of S t and such that S t is defined by an L EQP -formula with polynomially-bounded quantifiers. Furthermore, the bijection from S t to S t is an affine reduction; that is, it is given by an affine linear function whose coordinates are eventually quasi-polynomial in t. We will see that this preserves all the properties of S t that we care about.
Step 3: We now apply a version of Chen-Li-Sam's "base t" method [3], in order to finally eliminate the (polynomially-bounded) quantified variables, y 1 , . . . , y d . After reducing to the case that all variables are nonnegative, suppose that we have some k such that, for all i, 0 ≤ y i < t k are bounds on the quantified variables.
We write each y i "base t," using new variables b i j : Suppose that is the largest degree of any polynomial f (t) appearing as a coefficient of some y i . Write each free (unquantified) variable, x i , in base t using new variables a i j and z i : Note that we have no bound on the x i , so we must allow an unbounded t k+ coefficient. The resulting S t will be in bijection with the original S t , with the above formulas for x i and y i yielding the bijection. As in Step 2, the bijection is an affine reduction. We now follow the Chen-Li-Sam method [3], and iteratively look at the t 0 coefficients of each term, the t 1 coefficients, etc.
Example 2.6. Suppose we have the formula 1 Replace y i by b i1 t + b i0 and x i by z i t 3 + a i2 t 2 + · · · + a i0 , with 0 ≤ b i j < t and with 0 ≤ a i j < t. That is, z 1 and z 2 are the only variables not bounded by t. The main inequality is now equivalent to Write this inequality as where f 0 := a 10 − b 10 − 2b 20 . Since the aand b-variables are all bounded between 0 and t − 1, we see This implies that we are in one of four exclusive cases: Let's look at the case where −3t + 3 ≤ f 0 ≤ −2t (we will handle each of the finite number of other cases separately.) Dividing inequality (1) by t and taking integer parts, we obtain the equivalent inequality By the hypothesis on f 0 , f 0 t = −2, so we have reduced to the inequality u − 2 ≤ 0, that is, Consider the new constant term The relevant seven cases are now and we can again look at them separately. For example, if −4t + 1 ≤ f 1 ≤ −3t, then by again dividing by t, the original inequality becomes Once again we break into a finite list of cases for the constant term f 2 . For example, in the case the original inequality becomes equivalent to Since z 1 is unbounded, we cannot continue with this method. But notice that the case-defining This strategy works in general. Our new formula has two types of atomic subformulas: those that involve quantified variables, which are in classical Presburger arithmetic (do not involve multiplication by t), and those that use only unquantified variables.
Step 4: We may now apply the classical quantifier elimination procedure to get a logically equivalent quantifier-free formula. Theorem 1.5 from [7] says that this works, because the parameter t does not occur in any of the atomic subformulas involving quantified variables. As discussed before Step 1, we must extend our language to allow D c , divisibility predicates for constants c. To summarize, we now have a quantifier-free formula in parametric Presburger arithmetic, with the addition of D c predicates.
Step 5: Now that we have a quantifier-free formula, we are ready to understand the geometry of these sets S t ⊆ Z d . Our formula consists of atomic formulas of the form and If our formula were simply a conjunction of such atomic formulas, then we would have that where P t ⊆ R d is a polyhedron (which changes as t changes) defined by the linear inequalities, Λ t ⊆ Z d a lattice, and λ t ∈ Z d a translation vector, with the latter two defined by the divisibility conditions.
Of course our S t may not be simply a conjunction of these atomic formulas, so we first show that S t can be written as a disjoint union of such sets, using a variant of Disjunctive Normal Form. Then we may concentrate on each piece individually; |S t |, for example, will simply be the sum of the cardinalities of each piece.
So we may assume that S t is a conjunction of these atomic formulas. Note that a conjunction of formulas of the form D c f(t) · x − g(t) is an "external" representation of a translation of a lattice, i.e., defined via constraints, using the language of [15]. We'd like an "internal" representation, i.e., defined parametrically; in this case, this would be a collection of basis vectors for the lattice, together with a translation vector.
Example 2.8. In Example 2.7, we converted the external representation D 2 (x + t) into the internal representation: lattice Λ t ⊆ Z with basis {2} and translate λ t = (t mod 2).
By examining Hermite Normal Forms, we prove that this can be accomplished while preserving EQP properties, and then this basis allows us to apply an affine reduction to eliminate any D c terms.
Example 2.9. Continuing Example 2.7, our internal representation of Λ t + λ t implies the following: for odd t, any x satisfying D 2 (x + t) is of the form x = 2u + 1, for some u ∈ Z. Applying the affine reduction given by x = 2u + 1 yields (for odd t) That is, we have eliminated all divisibility terms from the formula.
In other words, we now simply have that S t is the set of integer points in a parametric polyhedron, defined with linear inequalities of the form f(t) · x ≤ g(t). This is again an "external" representation. We show that we can convert to an "internal" representation and preserve EQP properties, using row reduction over Q(t). In this case, an internal representation is a list of vertices (given as ratios of EQPs), of extreme rays of the recession cone (encoding directions, y, in which the polyhedron is infinite in the y direction but not in the −y direction), and of a basis for the lineality space (encoding directions z in which it is infinite in both the z and −z directions).
Step 6: We are now ready to prove Properties 1, 2, and 3. Property 1 will follow from Property 3 trivially. Property 2 follows directly from the Chen, Li, Sam result [3], as long as our polyhedron is bounded. Since we know whether our polyhedron has non-trivial recession cone and lineality space, we know whether it is bounded. If it is unbounded, then |S t | is either 0 or infinite, and we will show how to figure out which is correct. Property 3 similarly follows from Shen [17]. We delay discussion of generating functions until Section 5, but Property 4 follows from Woods [19].

Summary of Outline of Proof.
Suppose that we are given any parametric Presburger family S t ⊆ Z d defined by an L EQP -formula ϕ. Then we will apply a series of logical equivalences and affine reductions as follows: where: 1. ϕ 1 is an L + EQP -formula with polynomially-bounded quantifiers, 2. ϕ 2 is an L EQP -formula with polynomially-bounded quantifiers, 3. ϕ 3 is an L EQP -formula in which no variable within the scope of a quantifier is multiplied by the parameter t, 4. ϕ 4 is a quantifier-free L + EQP -formula whose only divisibility predicates are D c for constant functions c, and 5. ϕ 5 is a disjoint union of conjunctions of atomic L EQP -formulas (and hence quantifier-free).
At each stage, the reductions preserve all the properties we are interested in, until we finally reduce to the case of the parametric polyhedra defined by ϕ 5 . In Step 6, we deal with these polyhedra by applying previously-established combinatorial techniques from Chen-Li-Sam [3], Woods [19], and Shen [17].
The sequence of reductions is a little complicated, so one might well wonder whether there is a more direct proof. For instance, one might try to show that any L EQP -formula is logically equivalent to a quantifier-free formula in a slightly larger language with additional "well-behaved" function and relation symbols (the method of quantifier elimination from logic), then prove a generalization of the main theorem from [19] that quantifier-free parametric Presburger formulas have the EQP behavior we seek. But we already know that quantifier elimination in the original language L EQP is impossible (see [7]), and finding a reasonable language for quantifier elimination seems difficult. For example, Krajíček [10] gave the name "two-sorted Presburger arithmetic" to the complete first-order theory of Z as an ordered Z-module in a language with two sorts of variables (one for the ring, one for the module). Two-sorted Presburger arithmetic is very similar to the logical system studied in this paper, and Krajíček noted "it is an interesting open question whether a form of quantifier elimination holds." Two-sorted Presburger arithmetic without a relation symbol for ≤ was studied by van den Dries and Holly [18], who gave a quantifier elimination theorem for this weaker system in a language including a relation symbol for divisibility and function symbols for gcd and a few other closely related arithmetic functions.

Parametric Presburger families and polynomially-bounded quantifiers
In this section, we set notation and definitions and review the result on bounding quantifiers in parametric Presburger families proved in [7]. We also define affine reductions and note that they preserve Properties 1 through 3.

Parametric Presburger arithmetic
We will use standard notation and terminology from first-order logic, for which any modern textbook on the subject could serve as a reference (for instance, [6] or [9]). In particular, a language is a set of finitary relational, functional, and constant symbols, usually denoted by L with decorations. Given a language L, an L-formula means a first-order formula in L: we allow basic symbols in L plus equality, symbols for variables, Boolean operations, and quantifiers.
We let L Pres be the first-order language with symbols for 0 and 1 (constants), < (binary relation for the ordering), − (a unary operation symbol for negation), and + (binary function symbol for addition).
We will always work in the standard model of Presburger arithmetic with universe Z, so whenever we write "|= ϕ" or "ϕ holds" we are referring to the standard interpretation of the language.
L + Pres ⊇ L Pres is the expansion which includes unary predicates D c for each c ∈ Z, to be interpreted as divisibility by c. By convention, if c = 0, then "D 0 (x)" is false for every x ∈ Z, even if x = 0. Now we come to the main definition: The intended interpretation of λ t (x) is that we are multiplying x by the parameter t which takes some value from N. Given t ∈ N and an L EQP -formula ϕ, we define the L Pres -formula ϕ t to be the translation of ϕ defined recursively so that each term of the form λ t (s) occurring in ϕ (where s is a term) is replaced by one of the following: Here and below, we will adopt the notational convention of writing " f (t) · s" for the L EQPterm formed from the term s and f (t) ∈ Z[t] by repeated applications of the function λ t . For instance, the expression (t 2 + 2) · x 1 stands for the term λ t (λ t (x 1 )) + x 1 + x 1 .
When we write ϕ(x), we mean that all of the free variables occurring in ϕ are listed in the tuple x = (x 1 , . . . , x d ). (Throughout, boldface letters such as a and x will always denote finite tuples.) The definition of ϕ t above allows us to talk about the truth of L EQP -formulas relative to a parameter t ∈ N: given an L EQP -formula ϕ(x 1 , . . . , x d ) whose free variables are contained in {x 1 , . . . , just in case the L Pres -formula ϕ t is true with the variable x i evaluated as k i .
From a logical standpoint, the idea behind parametric Presburger definability is that we are essentially expanding classical Presburger arithmetic by a restricted multiplication function: we allow multiplication of any variable or term by the special parameter variable t, but we do not allow multiplication between any of the other variables, and we do not allow quantification over t, thus avoiding the complications of sets definable in the full first-order theory of (Z; <, +, ·).
is a unary relation symbol denoting divisibility by the value of f (t).
Given an L + EQP -formula ϕ(x 1 , . . . , x d ), for any t ∈ N and a 1 , . . . , a d ∈ Z, we can define the truth value of ϕ t (a 1 , . . . , a d ) as before, recalling the convention that D 0 (x) is always false. Definition 3.5. Two L + EQP -formulas ϕ(x 1 , . . . , x d ) and ψ(x 1 , . . . , x d ) are logically equivalent just in case for every t ∈ N, the L + Pres -formulas ϕ t and ψ t are logically equivalent; in other words, for every t ∈ N and every (k 1 , . . . , It is clear that every L + EQP -formula is logically equivalent to some L EQP -formula. Definition 3.6. Given an L + EQP -formula ϕ(x 1 , . . . , x d , y) whose free variables are among {x 1 , . . . , x d , y} and f ∈ Z[t], a polynomially-bounded universal quantifier applied to ϕ yields Similarly, a polynomially-bounded existential quantifier applied to ϕ yields An L + EQP -formula with polynomially-bounded quantifiers is a member of the smallest class of L + EQPformulas containing all atomic formulas and closed under Boolean combinations and the formation of polynomially-bounded quantifiers.
We recall the following theorem, which was proved in [7]: Theorem 3.7. Every L + EQP -formula is logically equivalent to an L + EQP -formula with polynomiallybounded quantifiers.
Also see [7] for a discussion on how this relates to similar previously-known results of Weispfenning and Lasaruk-Sturm [11].
Assumption 3.8. In any first-order formula ϕ, we always assume that no variable occurs in ϕ both as a free variable and as a quantified variable: that is, formulas such as are not allowed (we have to rename the quantified variable and replace the last conjunct by "∃z [z + z = y]").

Eventual quasi-polynomials and affine reductions
Recall that EQPs were defined in Definition 1.1. Definition 3.9. Given any d ×d matrix A(t) = ( f i, j (t)) of EQP functions and any d -tuple (g 1 (t), . . . , g d (t)) of EQP functions, we call the function F : Z d × N → Z d given by the rule an EQP-affine function. Definition 3.10. Suppose that S t ⊆ Z d and S t ⊆ Z d are parametric Presburger families, defined by L + EQPformulas ϕ(x) and ϕ (z) respectively. We say that S t is affine reducible to S t if there is an EQP-affine function F : Z d × N → Z d such that for every t ∈ Z, if F t is the function obtained from F by fixing the value of t for the (d + 1)-th coordinate, then F t S t is a bijection from S t onto S t .
Abusing notation, we will not always distinguish carefully between an L + EQP -definable family and the parametric Presburger set that it defines, and we may say "ϕ is affine reducible to ϕ" with the obvious meaning.
The key property of affine reductions for our approach is that they preserve Properties 1, 2, and 3: Remark 3.11. If S t ⊆ Z d and S t ⊆ Z d are families parametrized by t ∈ N and S t is affine reducible to S t , then if S t has any of the Properties 1, 2, or 3, then S t has the same Properties.
Proof. The preservation of Properties 1 and 2 is trivial, since F induces bijections from the sets S t onto the S t . For Property 3, if F : Z d × N → Z d gives an affine reduction from S t to S t and x : N → Z d is an EQP-affine function such that x(t) ∈ S t (whenever S t = / 0), then the composition F • x : N → Z d is an EQP function yielding points in S t whenever this is nonempty.

A sequence of reductions
In this section we give the details of the six steps of our procedure as outlined in Section 2. This will prove Properties 1, 2, and 3 in Theorem 1.15.

Step 1
This is the content of Theorem 3.7, proved in [7].

Step 2
Next we describe an affine reduction which eliminates the divisibility predicates D f (t) from an L + EQP formula, but at the cost of adding additional bounded quantifiers and new variables, cf. Example 2.5: Lemma 4.1. Let S t ⊆ Z d be a parametric Presburger family defined by an L + EQP -formula with polynomiallybounded quantifiers. Then there is a parametric Presburger family S t ⊆ Z d which is definable by an L EQP -formula with polynomially-bounded quantifiers and such that S t is affine reducible to S t .
Proof. Fix some L + EQP formula ϕ(x) with polynomially-bounded quantification which defines the family S t . Let f 1 , . . . , f r be all the functions in Z[t] which occur in divisibility predicates D f i (t) in ϕ. Without loss of generality, none of the f i 's is the zero polynomial (since formulas D 0 (s) are trivially false), so f i (t) is nonzero for sufficiently large t. Since D f and D − f are logically equivalent, we may assume that f i (t) is eventually positive. Let g ∈ Z[t] be the product f 1 f 2 · · · f r . Then for sufficiently large t ∈ N, the value g(t) is a positive common multiple of f 1 (t), . . . , f r (t); there are only finitely many values of t at which one of f 1 (t), . . . , f r (t) is nonpositive, and an EQP-affine reduction can handle these cases separately.
Let z 1 , . . . , z m list all variables occurring in ϕ, both free and quantified. Let u 1 , . . . , u m and v 1 , . . . , v m be a set of new variables. Let F : Z 2m × N → Z m be the EQP-affine function We will now define a formula ϕ whose free variables are among u 1 , . . . , u m , v 1 , . . . , v m and show that this is affine reducible to ϕ "via F": this means that the restriction of F to the set defined by ϕ , ignoring any u i or v i which does not occur free, yields a bijection onto the set S t defined by ϕ.
In fact, we will recursively construct L EQP -formulas ψ for every subformula ψ of ϕ, starting with the atomic subformulas, such that every ψ has polynomially-bounded quantification and the parametric Presburger family defined by ψ is affine reducible to that defined by ψ via the map F, and the family S t that we seek will be that defined by ϕ .
The formula ψ will be defined as θ ∧ ψ where θ is the conjunction and the formula ψ is defined by recursion. As we define the formula ψ , we will also show inductively that the following holds:  (F(a, b,t)).
Note that ( * ) immediately implies that ψ is affine reducible to ψ via F.
• For any term s in the variables z 1 , . . . , z m , let s(g · u + v/z) be the result of replacing each instance of the variable z i by g · u i + v i . Then if ψ is an atomic formula of the form s 1 = s 2 , we let ψ be the atomic formula s 1 (g · u + v/z) = s 2 (g · u + v/z).
If ψ is an atomic formula of the form s 1 ≤ s 2 , then ψ is It is clear that in this case that ( * ) holds.
• For any atomic formula ψ of the form D f j (t) (s) (where s is a term), let h s (t) ∈ Z[t] be such that |s t (a 1 , . . . , a m )| ≤ h s (t), for all t ∈ N and all a 1 , . . . , a m with 0 ≤ a i < g(t) (since, for fixed t, s is linear in a 1 , . . . , a m , we only need check the bound on the finite set of 2 d EQPs obtained by setting each a i to 0 or to g(t), in the term s(a 1 , . . . , a m )). Let s(v/z) be the result of replacing each instance of each variable z i by v i . Now let ψ be the formula where y is a new variable. Note that ψ has polynomially-bounded quantification. The hypothesis ( * ) asserts that checking that the term s applied to the g(t) · u i + v i is divisible by f j (t) is equivalent to checking the divisibility of s applied to the v i : this is true because g(t) is divisible by f j (t).
• If ψ is a formula of the form ∃z i [0 ≤ z i ≤ h(t) ∧ θ ] (with polynomially-bounded quantification on the outside), then we define ψ as where "θ (g · u i + v i /z i )" means the result of substituting each instance of the free variable z i in the formula θ with the term g · u i + v i . Again, the new formula ψ has polynomially-bounded quantification under the inductive hypothesis that θ does, and ( * ) is also immediate by induction.
Remark 4.2. We note in passing that the same argument can be applied to L R -definable families (in the language of [7]) for any ring R of Z-valued functions, with only minor modifications. This gives us the following: for any R-parametric Presburger family S t ⊆ Z d , there is an R-parametric Presburger family S t ⊆ Z d which is definable by an L R -formula with R-bounded quantifiers and such that S t is R-affine reducible to S t .

Step 3
This next step involves writing the variables of our formula in "base t," cf. Example 2.6. To do this, it is most convenient to show that we can reduce to the case where the free variables are nonnegative (by Definition 3.6 for polynomially-bounded quantifiers, the quantified variables are already nonnegative). Indeed, if our free variables are among (x 1 , . . . , x d ), we partition Z d into 2 d pairwise disjoint regions X 1 , . . . , X 2 d according whether each free variable x i is negative or nonnegative. Now let S k t := X k ∩ S t for each k ∈ {1, . . . , 2 d }, and note that S k t is a parametric Presburger family which is EQP-affine reducible to a parametric Presburger family living in N d (by inverting the values of negative coordinates). Then S t is the disjoint union of these S k t , and the following remark shows that we may examine each S k t separately. Remark 4.3. If we can write S t as a union S 1 t ∪ · · · ∪ S k t of pairwise disjoint parametric Presburger families, then to prove that S t satisfies Properties 1, 2, and 3 (as in Theorem 1.15), it is sufficient to prove these for each S i t separately. In particular, Property 1 follows because the union of eventually periodic sets is eventually periodic, Property 2 follows because the sum of EQP's is an EQP, and Property 3 follows because we may specify an x(t) from any of the (nonempty) sets in the disjoint union.
The following is the main Proposition encompassing Step 3: Proposition 4.4. Let S t ⊆ N d be a parametric Presburger family which is definable by an L EQP -formula with polynomially-bounded variables y 1 , . . . , y m . Then there is an EQP-parametric Presburger family S t that is EQP-affine reducible to S t and such that S t is definable by a L EQP -formula ϕ(a, z) whose free variables are among the variables a and z and whose quantified variables are listed in the finite tuple b (which is assumed to be disjoint from a and z), and satisfying the following conditions: 1. The atomic subformulas of ϕ are all of one of two types: (a) Type 1, which are inequalities involving only variables in a, b, and t, and which do not involve any multiplication by t; (b) Type 2, which are inequalities involving only t and the free variables (from a or from z); 2. Any free variable from a is explicitly bounded between 0 and t − 1 (inclusive) by an atomic subformula of ϕ which is outside the scope of any quantifier or disjunction; and 3. Any quantified variable from b is bounded between 0 and t − 1 (inclusive).
In order to prove Proposition 4.4, we adapt the approach of Chen, Li, and Sam in [3] of writing each variable "base t." We cannot directly apply their results because of the interaction between the potential unboundedness of the free variables and the existence of (bounded) quantified variables. Specifically, their key Lemma 3.2 uses sets defined only by equalities and nonnegativity constraints. We need to work with general linear inequalities and cannot apply the usual procedure of introducing slack variables to convert them into equalities because of the presence of quantifiers.
For example, consider the set S given by Since x and y are nonnegative, we could introduce a slack variable w to obtain the set S ⊂ Z 2 given by  Proof. Let {x 1 , . . . , x d } be the free variables and {y 1 , . . . , y m } the quantified variables in ϕ . Let k ∈ N be such that 0 ≤ y i ≤ t k − 1 for every i and sufficiently large t (such a k is obtainable, because each y i is polynomially-bounded; the finite set of t for which the bound doesn't hold may be handled individually).
Also let be the highest power of t that is multiplied by any y i in ϕ . Define a Z[t]-affine (hence EQP-affine) function G : That is, we write each x i base t (in the sense of [3]) up to the power t k+ −1 and write the remaining part of x i as t k+ z i . So there is a unique inverse image of any point (x 1 , . . . x d ) that satisfies the inequalities 0 ≤ a i, j ≤ t − 1, 0 ≤ z i for i = 1, . . . , d. We define S t to be the set of these preimages, so that G is an affine reduction of S t to S t .
Next, in the formula defining S t , replace each y i by ∑ k−1 j=0 b i, j t j and the bounded quantifier ∃y i : 0 ≤ y i ≤ t k − 1 by the series of bounded quantifiers ∃b i,0 , . . . , b i,k−1 : 0 ≤ b i,0 , . . . , b i,k−1 ≤ t − 1. Let ϕ be the resulting formula.
Since each unbounded free variable z i is multiplied by t k+ each time it is introduced, the condition on terms of t-degree lower than k + is immediate. Also each bounded variable b i, j appears by replacing y i by b i, j t j ; thus the powers of t that are multiplied by b i, j in ϕ are j more than the powers of t that are multiplied by y i in ϕ . By the choice of k and , if we let M = k + then the final condition is also satisfied. Proof. Since f 0 does not contain any of the variables z 1 , . . . z d , write where all of the coefficients c 0 , c i j and c i j are in Z. Let c be the maximum among the absolute values of all of these coefficients and let Q be the total number of terms in f 0 . Since each variable in f 0 is bounded between 0 and t − 1, we have for t 0 that We can loosen (5) to obtain −Qct < f 0 ≤ Qct (6) which is equivalent to the finite disjunction Now fix a particular value of h. With (h − 1)t < f 0 ≤ ht, the inequality ∑ s≥0 f s t s ≤ 0 is equivalent to ∑ s≥1 f s t s ≤ −ht. Adding ht to both sides and dividing by t, we obtain ∑ s≥0 f s t s ≤ 0, where indeed f s = f s+1 for s ≥ 1 and f 0 = f 1 + h.
Proof of Proposition 4.4. Given a parametric Presburger family S t , consider the affine equivalent family S t and its defining formula ϕ that are obtained from Lemma 4.5. Let ∑ s≥0 f s t s ≤ 0 be one of the inequalities occurring in ϕ , and k and be defined as in the proof of Lemma 4.5. If k = 0, then there are no quantified variables and we do not need to modify the inequality.
If k ≥ 1, then in particular k + ≥ 1, so f 0 does not contain any of the unbounded free variables. Thus we can apply Lemma 4.6. Consider one of the resulting inequalities ∑ s≥0 f s t s ≤ 0 that is not in Presburger arithmetic. If k + = 1, then by Lemma 4.5, f s does not contain any quantified variables for s ≥ 1, and then by Lemma 4.6, f s does not contain quantified variables for any value of s whatsoever. That is, the inequality ∑ s≥0 f s t s ≤ 0 is free of quantified variables. On the other hand, if k + > 1, then f 0 = f 1 + h does not contain any unbounded free variables and so we can apply Lemma 4.5 again. In fact we can repeat this process k + times. For the same reason as in the case of k + = 1, the resulting inequalities are of two types: those that contain only Presburger arithmetic and those that are free of quantified variables.

Step 4
Now we apply a quantifier elimination algorithm for "classical" Presburger arithmetic to the output of Step 3. The algorithm we will use is that described in [4].
Say that an L + EQP -formula has no division by t if it involves only divisibility relations D c where c is a constant (with no dependence on t).
A term or formula in L + EQP has no multiplication by t if it contains no terms involving multiplication by any f (t) ∈ EQP of degree ≥ 1.
Proposition 4.7. Suppose that ϕ(a, z) is an L + EQP -formula with no division by t whose free variables are among the variables a and z and whose quantified variables are listed in the finite tuple b (which is assumed to be disjoint from a and z). We further assume: 1. The atomic subformulas of ϕ are all of one of three types: (a) Type 1, which are inequalities involving only variables in a, b, and t, and which do not involve any multiplication by t; (b) Type 2, which are inequalities involving only t and the free variables (from a or from z); and (c) Type 3, which are divisibility conditions D c (s) where c is a constant and s is a term which does not involve any multiplication by t; 2. Any free variable from a is explicitly bounded between 0 and t − 1 (inclusive) by an atomic subformula of ϕ which is outside the scope of any quantifier or disjunction; and 3. Any quantified variable from b is bounded between 0 and t − 1 (inclusive).
THEN ϕ is logically equivalent to a quantifier-free formula in L + EQP which has no division by t.
Example 4.8. A typically complex formula satisfying the hypotheses of Proposition 4.7 is This contains no atomic subformulas of Type 2 involving z i variables, but adding such a subformula would not make the quantifier elimination process any more difficult. Also, the bounds on a 0 and a 1 outside the quantifiers will have no effect on the procedure. We work outwards starting from the inner quantifier ∃b 1 . Using the notation of the procedure, the least common multiple M of the b 1 coefficients is 14, so we first multiply substitute b 1 for 14b 1 and get that the subformula of ϕ bounded by the scope of ∃b 1 . . . is equivalent to Now as in the proof, within the quantifier ∃b 1 we have atomic subformulas of the three types: The procedure replaces the entire quantified subformula bounded by the scope of ∃b 1 by a disjunction ψ of 42 quantifier-free formulas, one for each choice of a constant j ∈ {1, . . . , 14} and one of the three expressions B listed above. For example, fixing the second subformula of type B yields the following disjunction, which forms a part of ψ : (Note that for any fixed values of t, a 0 , and b 0 , exactly one of the 14 values of j will make the last conjunct with D 14 true, so in practice one does not need to evaluate all of the inequalities for every possible value of j.) Now if we were to continue the quantifier elimination procedure for ϕ (which we will not), the next step would be to eliminate the quantifier ∃b 0 . We only note that this time we have a subformula of Type 3, D 14 (2t − 4a 0 − 6b 0 + j), in the input formula, even though the original input formula ϕ contained no such divisibility predicates. The important thing is that it has the correct form for a Type 3 subformula: we are dividing only by the constant 14 and there is no multiplication of t with another variable.

4.5
Step 5 Lemma 4.9. Let S t ⊆ Z d be defined by an L + EQP formula, ϕ(x), which is quantifier-free and has no division by t (the only divisibility relations are of the form D c , where c is a constant). Then S t can be written as a finite disjoint union, where S i,t is defined by an L + EQP formula, ϕ i (x), that is a conjunction of atomic formulas, each of the form: where f : N → Z d has EQP coordinates, g : N → Z is in EQP, and c ∈ Z is constant.
Proof. Using that we may assume that every atomic formula in ϕ(x) is of the form f(t) · x ≤ g(t) or D c f(t) · x − g(t) .
Enumerate the atomic formulas in ϕ(x) by r 1 , . . . , r m . For 1 ≤ j ≤ m, define R j , a set of atomic formulas, as follows: • If r j is of the form f(t) · x ≤ g(t), then For a given j, every element of Z d satisfies exactly one s j ∈ R j . Also, for a given s j ∈ R j , either every element of Z d satisfying s j also satisfies r j , or every element of Z d satisfying s j fails to satisfy r j . For any choice (s 1 , . . . , s m ) ∈ R 1 × · · · × R m , define S (s 1 ,...,s m ),t ⊆ Z d with the formula s 1 ∧ · · · ∧ s m . These S (s 1 ,...,s m ),t partition Z d . Furthermore, for a given S (s 1 ,...,s m ),t either every x ∈ S (s 1 ,...,s m ),t satisfies ϕ(x) or every x ∈ S (s 1 ,...,s m ),t fails to satisfy ϕ(x). Therefore S t is the disjoint union of those S (s 1 ,...,s m ),t that do satisfy ϕ(x). Using that <, >, and = may be rewritten with ≤, these sets are of the required form.
Since S t has now been written as a disjoint union, we may examine each piece separately; see Remark 4.3 above.
Our next task is to eliminate the D c (·) atomic formulas with an affine reduction. To do this, let's look at a conjunction of formulas, each of the form D c f(t) · x − g(t) . For each t, this will be a translate of a lattice. Using the language of [15], this could be called an "external" representation of this lattice translate, i.e., defined via constraints. We'd like an "internal" representation, i.e., defined parametrically; in this case, this would be a collection of basis vectors for the lattice, together with a translation vector. The content of the following proposition is that we can achieve this in an EQP way, cf. Example 2.8. Note that the proposition even applies when the divisibility relations are of the form D h(t) , where h(t) ∈ EQP.
where f j : N → Z d has EQP coordinates, g j , h j : N → Z in EQP, and h j (t) is eventually nonzero. Then there exist N and a period m, such that, for fixed i with 0 ≤ i ≤ m − 1, either • S t is empty for all t ∈ N with t ≥ N and t ≡ i mod m, or • there exist u 0 , u 1 , . . . , u r : N → Z d whose coordinate functions are polynomials in Z[t], such that, for all t ∈ N with t ≥ N and t ≡ i mod m, we have that S t = u 0 (t) + Zu 1 (t) + · · · + Zu r (t), where u 1 (t), . . . , u r (t) are linearly independent.
Proof. Note that S t is the set of x ∈ Z d such that there exist y ∈ Z n , such that for all 1 ≤ j ≤ n. We create an n × (d + n) matrix A, with entries in EQP, as follows: let A = [F D], where F is the n × d matrix whose j th row is the coordinates of f j (t), and D is the diagonal matrix whose ( j, j) entry is h j (t). Let g be the n × 1 column vector whose j th entry is g j (t). Regarding x and y as column vectors, we have that S t is the set of x ∈ Z d such that there exists y ∈ Z n , such that Using Corollary 2.8 of [2], A may be put into Hermite normal form. That is, letting r be the rank of A (we actually have r = n here, because the matrix D ensures that A is full row rank), there exist an n × r matrix B and a (d + n) × (d + n) matrix U such that • all entries above the main diagonal of B are 0, • all entries along the main diagonal of B are positive, • all entries below the main diagonal of B are nonnegative, and each row achieves its maximum uniquely on the main diagonal, • U is unimodular, i.e., determinant ±1 (U encodes the elementary column operations transforming A into B), and • all entries are in EQP.
Corollary 5.3b of [15] shows that the set of integer solutions to A x y = g is nonempty if and only if B −1 g is an integer. The entries of B −1 may be ratios of EQPs; the set of t for which B −1 g is integral will be eventually periodic. Therefore we may assume we are looking at a residue class i mod m such that B −1 g is integral. Then Corollary 5.3c of [15] shows that the set of integer solutions to A x y = g can be where v 1 (t), . . . , v d (t) are linearly independent; in particular, v 0 = U B −1 g 0 and v j = (n + j) th column of U, for 1 ≤ j ≤ d, and so the entries of v j : N → Z d+n are in EQP. For 0 ≤ j ≤ d, let w j be the first d coordinates of v j . Then S t = w 0 (t) + Zw 1 (t) + · · · + Zw d (t).
We are almost finished; the only problem is that the w 1 , . . . , w d may not be linearly independent. Let A be the d × d matrix whose columns are w 1 , . . . , w d , and let r be the rank of A . Putting A in Hermite normal form, we have a d × d unimodular matrix U and a d × r matrix B , such that A U = [B 0] with restrictions on the entries of B as above. Let u 1 . . . , u r be the columns of B , which are linearly independent. Since elementary column operations don't affect the Z-span of the columns, Zw 1 (t) + · · · + Zw d (t) = Zu 1 (t) + · · · + Zu r (t).
To recall, we have written the set we are interested in as a disjoint union of sets, each defined by a conjunction of atomic formulas of the form f(t) · x ≤ g(t) and D c f(t) · x − g(t) . We now show that we can eliminate the D c (·) formulas, with an affine reduction, cf. Example 2.9. In fact, this would work even for divisibility by non-constant h(t): Lemma 4.11. Let S t ⊆ Z d be defined by an L + EQP formula, ϕ(x), that is a conjunction of atomic formulas, each of the form where f : N → Z d has EQP coordinates, g, h : N → Z ∈ EQP, and h is eventually nonzero.
Then there is some S t ⊆ Z d , affine reducible to S t , such that S t ⊆ Z d is defined by an L EQP formula that is a conjunction of atomic formulas of the form f(t) · x ≤ g(t), where f : N → Z d has EQP coordinates and g(t) : N → Z is in EQP.
Proof. Let R t ⊆ Z d be the set satisfying the conjunction of the D h(t) terms. R t can be represented by: where u 1 (t), . . . , u r (t) are linearly independent, by Proposition 4.10. We take as our affine reduction F : Z r → Z d , given by F(λ ) = u 0 (t) + λ 1 u 1 (t) + · · · + λ r u r (t). Since the u j are linearly independent, this defines a bijection Z r → R t . An element x ∈ S t satisfying a linear inequality which simplifies to a linear inequality of the desired form. Now we have S t written as the set of integer points in a "parametric polyhedron", that is, defined by linear inequalities that depend on t, as above. If this polyhedron is bounded, then it immediately follows from [3] that |S t | ∈ EQP. We must detect when S t is unbounded. To do this, it is helpful to switch to an "internal" representation of the parametric polyhedron, as opposed to this "external" representation as a solution set to linear inequalities, cf. Example 2.10. That is, we want to write the polyhedron as conv{x 1 , . . . , x q } + cone{y 1 , . . . , y r } + span{z 1 , . . . , z s }, conv{x 1 , . . . , x q } = {λ 1 x 1 + · · · + λ q x q : λ i ∈ R, λ i ≥ 0, λ 1 + · · · + λ r = 1}, cone{y 1 , . . . , y r } = {λ 1 y 1 + · · · + λ r y r : λ i ∈ R, λ i ≥ 0}, span{z 1 , . . . , z s } = {λ 1 z 1 + · · · + λ s z s : λ i ∈ R}, and cone{y 1 , . . . , y r } contains no lines. We follow the convention that conv{ / 0} = / 0, cone{ / 0} = {0}, and span{ / 0} = {0}, so that this representation may include the empty polyhedron. Also note that the polyhedron is bounded exactly when r = s = 0. We have the following proposition: where f j : N → Z d has EQP coordinates and g j : N → Z in EQP. Then there exists N and a period m such that, for fixed i with 0 ≤ i ≤ m, there exist x 1 , . . . , x q : N → Q d and y 1 , . . . , y r , z 1 . . . , z s : N → Z d , with x j rational functions in Q(t) and y j , z k nonzero polynomials in Z[t], such that, for all t ∈ N with t ≥ N and t ≡ i mod m, we have that S t is the set of integer points in conv{x 1 (t), . . . , x q (t)} + cone{y 1 (t), . . . , y r (t)} + span{z 1 (t), . . . , z s (t)}, where cone{y 1 (t), . . . , y r (t)} contains no lines.
Proof. We may assume we are looking at a residue class i mod m such that g j and the coordinates of f j are in Q[t]. Let F be the n × d matrix whose j th row is f j , and let g be the n × 1 column vector whose j th entry is g j . Regarding x ∈ Z d as a column vector, S t is the set integer solutions to F · x ≤ g. Note that we may perform standard row reduction on F, in the field of rational functions Q(t). This suffices to compute the desired representation, using Theorem 8.5 of [15], as follows: • For the convex hull, take any maximally linear independent subset of rows, F , of F and their corresponding g . (Note that any given subset of rows of F is either eventually always linearly dependent or eventually always linearly independent, since this can be tested by computing determinants of minors of F, which are polynomial functions in t.) Take any solution x(t) to F · x = g ; x may be computed using row reduction and will have entries in Q(t). If x(t) eventually satisfies F · x ≤ g, then include it as one of the x j (t). Doing this for all maximally linearly independent set of rows of F yields conv{x 1 (t), . . . , x q (t)}.
• For the cone, take any subset of rows, F , and a distinct row, f, such that F and f together are a maximally linear independent subset of rows of F. Take any solution y(t) to This may again be computed using row reduction and will have entries in Q(t). If y(t) eventually satisfies F · y ≤ 0, then include p(t)y(t) as one of the y j (t), where p ∈ Z[t] is eventually positive and makes py ∈ Z[t]. Doing this for all such F and f yields cone{y 1 (t), . . . , y r (t)}.
• Use row reduction to find a basis for F · z = 0. Clearing fractions to make each z j (t) ∈ Z[t], this yields span{z 1 (t), . . . , z s (t)}.

Step 6
In the output of Proposition 4.12, any polyhedron P with r = s = 0 is bounded, and we may apply the results from [3] and from [17]. The following lemma helps us deal with unbounded polyhedra.
Furthermore, Q is a bounded polyhedron, given by the convex hull of the following points: for each W ⊆ {y 1 , . . . , y s , z 1 , . . . , z t } and i with 1 ≤ i ≤ q, take the point Proof. Without loss of generality, r ≥ 1. If Q contains an integer point, x, then certainly x ∈ P, since Q ⊆ P. But also x + ky 1 ∈ P, for all k ∈ N, so P contains an infinite number of integer points.
We prove the contrapositive of the second bullet point. Suppose P contains an integer point where [η] is the unique real number in [0, 1) such that η − [η] is an integer. The representation of Q as a convex hull follows from the fact that Q is the Minkowski sum of conv{x 1 , . . . , x q }, the line segments [0, y i ], and the line segments [0, z i ], and the standard observation that each vertex of a Minkowski sum can be written as the sum of vertices of the summand polytopes.
We now have all the ingredients necessary to prove Properties 1, 2, and 3. Using all of the results of this section up to Proposition 4.12, and noting that all of the properties only need to be shown for all sufficiently large t congruent to some i modulo a fixed number m, it suffices to show the following.
2. The set of t such that S t has finite cardinality is eventually periodic.
3. There exists an EQP g : N → N such that, if S t has finite cardinality, then g(t) = |S t |.
4. There exists a function x : N → Z d , whose coordinate functions are EQPs, such that, if S t is nonempty, then x(t) ∈ S t .
Proof. Note that Woods [19] shows that these follow from the EQP behavior of the generating function, which we discuss and prove in Section 5 (at least for S ⊆ N d , a case we could reduce to). We therefore only present a brief proof here, to demonstrate that generating functions are unnecessary. First consider the case that r = s = 0; i.e. S t is the set of integer points in the parametric polytope Then S t is finite for all t so (2)  , which proves that, for any c ∈ Z d , the maximum value of c · x is EQP (in fact, it proves a slightly more general statement). To prove (4), we might demonstrate that an argmax (an x maximizing this linear function c · x) has EQP coordinates. While [17] demonstrates only that the max value of c · x is an EQP, it is clear that the proof also works for the argmax. The key idea is that, after performing the "base t" reduction, such an x must be within a fixed distance to one of the facets of the parametric polytope [17, Proposition 4.1]; therefore, by searching all parallel hyperplanes within that fixed distance of a facet, we reduce the dimension of the problem inductively.
To instead derive (4) directly from the statement of Shen [17, Corollary 3.2.2], we may do the following: First take, c = e 1 to get a maximum value for the x 1 coordinate, say a 1 . Then, substitute the value a 1 in for x 1 into the definition of our polyhedron, reducing the dimension by one; we now have the cross-section of the original polyhedron at x 1 = a 1 . Then take c = e 2 to get the maximum in the x 2 coordinate, and repeat.
Finally, (1) follows from the other properties as proved in [19]. For example, (3) yields that |S t | is an EQP, and the only way to have an infinite number of zeros in this EQP is for a constituent polynomial to be identically zero. Alternatively, (1) also follows from the proofs in [17]. Now suppose that either r ≥ 1 or s ≥ 1. Again let Q = conv{x 1 , . . . , x q } + zono{y 1 , . . . , y r , z 1 , . . . , z s }.
By Lemma 4.13, Q is a parametric polytope so we can apply the previous case to the set S t := Q ∩ Z d . In particular, the set of t for which S t is nonempty is eventually periodic. But since (again by Lemma 4.13) S t is finite iff S t is empty iff S t is empty, (1), (2), and (3) immediately follow. Also, (4) holds for S t by the previous case. Since Q ⊆ P and S t is empty iff S t is empty, we see that (4) also holds for S t by simply choosing a point in S t .

Generating Functions
Given a set S ⊆ N d , we define its generating function to be ∑ s∈S x s = ∑ s∈S x s 1 1 x s 2 2 · · · x s d d .
These generating functions can often be simplified to a rational function.
Now let S t be a parametric Presburger family. For a fixed t ∈ N, S t has a generating function, and Property 4 examines what happens to this generating function as t changes.
Note that the above example satisfies Property 4. Generating functions are powerful tools for understanding the structure of S t . For example, given the generating function, we can count the number of integer points in S t (if finite) by substituting in x = (1, . . . , 1). Example 5.3. Substituting x 1 = x 2 = 1 into the generating function for Example 5.2, we see that (1, 1) is a zero of the numerator and denominator of this rational function. Fortunately, applying L'Hôpital's rule to find the limit as x 1 and x 2 approach 1 will work, and it is evident that the differentiation involved in L'Hôpital's rule will yield a quasi-polynomial in t as the result; careful calculation will show that it matches Example 1.5.
Remark 5.4. To prove Property 4 for parametric Presburger families, we will assume from now on that S t ⊆ N d . We must check that the EQP-affine reductions in Steps 2, 3, and 5 above result in a family S t which is still a subset of N d for some d (rather than simply a subset of Z d ), but this is immediate upon inspection. Steps 1 and 4 do not cause any problems either since they give logically equivalent formulas which define the same parametric Presburger family.
While one may instead define generating functions for subsets of Z d , this may lose information about the sets: Example 5.5. If S = Z, then the generating function for S is · · · + x −2 + x −1 + 1 + x 1 + x 2 + · · · .
If you regard this as an infinite series, then it doesn't converge on any open neighborhood. If you regard it as a formal power series, then it simplifies to (· · · + x −2 + x −1 ) + (1 + x 1 + x 2 + · · · ) = x −1 1 − x −1 + which is also the generating function for the empty set.
In the statement of Property 4, we need b i j (t) to be lexicographically positive rather than simply in N d \ {0} for examples like the following: Example 5.6. Let S t = (x, y) ∈ N 2 : x + y = t . Then the generating function for S t is y t + xy t−1 + · · · + x t = y t − x t+1 y −1 1 − xy −1 .
Remark 5.7. If b is lexicographically negative, then we may instead write with −b lexicographically positive.
For sufficiently small ε, the −ε i b i term dominates, and ln(a b ) < 0. This implies that |a b | < 1, and indeed 1 + x b + x 2b + · · · does converge on a neighborhood of a. Now we prove Property 4, for parametric Presburger families. The hardest work has already been done: • At the end of Step 4, we had that S t was affine reducible to a set S t , described by a quantifier free formula in parametric Presburger arithmetic.
The only remaining step is to check that Property 4 is preserved by affine reductions. First a short lemma: Lemma 5.9. Let S ⊆ N d and S ⊆ N e be sets such that there is a Z-affine linear function F : Z e → Z d that restricts to a bijection from S to S. Let F(x) = Ax + c, where A = (a i j ). Define monomials m i = w a 1i 1 · · · w a di d for i = 1, . . . , e. Let g(z 1 , . . . , z e ) = g(z) be the generating function for S . Then the generating function for S is w c g(m 1 , . . . , m e ), where w := (w 1 , . . . , w d ). so the exponents of w 1 , . . . , w d in the numerator are polynomial functions of t, and remain so after multiplying in the factor of w c (t) outside the sum. Similarly, the exponents of w 1 , . . . , w d in each factor in the denominator are polynomials in t. If any of these exponents are (eventually) lexicographically negative, apply Remark 5.7 to make them eventually lexicographically positive.
In the general case, let t 0 be chosen sufficiently large so that the affine reduction is defined by quasi-polynomials for all t > t 0 and also the function g has the desired form as a rational function for all t > t 0 . Let D be the least common multiple of all periods occurring in either the affine reduction or the generating function g. Then the generating function h has the desired form with period D for all t > t 0 .