# Parametric Presburger Arithmetic: Complexity of Counting and Quantifier Elimination

We consider an expansion of Presburger arithmetic which allows multiplication by k parameters t_1,...,t_k. A formula in this language defines a parametric set S_t⊆Z^d as t varies in Z^k, and we examine the counting function |S_t| as a function of t. For a single parameter, it is known that |S_t| can be expressed as an eventual quasi-polynomial (there is a period m such that, for sufficiently large t, the function is polynomial on each of the residue classes mod m). We show that such a nice expression is impossible with 2 or more parameters. Indeed (assuming P ≠ NP) we construct a parametric set S_t_1,t_2 such that |S_t_1, t_2| is not even polynomial-time computable on input (t_1,t_2). In contrast, for parametric sets S_t⊆Z^d with arbitrarily many parameters, defined in a similar language without the ordering relation, we show that |S_t| is always polynomial-time computable in the size of t, and in fact can be represented using the gcd and similar functions.

## Authors

• 2 publications
• 1 publication
• 5 publications
• 1 publication
• ### Data-compression for Parametrized Counting Problems on Sparse graphs

We study the concept of compactor, which may be seen as a counting-analo...
09/21/2018 ∙ by Eun Jung Kim, et al. ∙ 0

• ### On lattice point counting in Δ-modular polyhedra

Let a polyhedron P be defined by one of the following ways: (i) P = {x...
10/12/2020 ∙ by D. V. Gribanov, et al. ∙ 0

• ### Presburger arithmetic with threshold counting quantifiers is easy

We give a quantifier elimination procedures for the extension of Presbur...
03/08/2021 ∙ by Dmitry Chistikov, et al. ∙ 0

• ### Closure of resource-bounded randomness notions under polynomial time permutations

An infinite bit sequence is called recursively random if no computable s...
09/26/2017 ∙ by Andre Nies, et al. ∙ 0

• ### Capturing Polynomial Time using Modular Decomposition

The question of whether there is a logic that captures polynomial time i...
03/29/2018 ∙ by Berit Grußien, et al. ∙ 0

• ### A Parameterized Strongly Polynomial Algorithm for Block Structured Integer Programs

The theory of n-fold integer programming has been recently emerging as a...
02/16/2018 ∙ by Martin Koutecký, et al. ∙ 0

• ### Extending Sticky-Datalog+/- via Finite-Position Selection Functions: Tractability, Algorithms, and Optimization

Weakly-Sticky(WS) Datalog+/- is an expressive member of the family of Da...
08/02/2021 ∙ by Leopoldo Bertossi, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1. Introduction

We study the difficulty of counting points in parametric sets of the form

 (1) St={x∈d:Q1y1Q2y2…QmymΘt(x,y)}.

Here are the parameters, are the free variables, and are the quantified variables, all ranging over ; are the quantifiers; and is a Boolean combination, in disjunctive normal form, of linear inequalities in with coefficients in . That is,

 (2) Θt(x,y)=[A1(t)⋅(x,y)T≤¯¯b1(t)]∨…∨[Aℓ(t)⋅(x,y)T≤¯¯bℓ(t)],

where each is a matrix, each is a length

column vector, all with entries in

, and the concatenation of the and variables is treated as a row vector.111By a simple trick, we do not need to worry about negations of basic inequalities, since these are equivalent to strict inequalities “,” which in turn are equivalent to non-strict inequalities “” since we are working over the integers. If there are parameters , we say that the family of sets is a -parametric Presburger family. A general expression of the type

 (3) Φt(x)=Q1y1Q2y2…QmymΘt(x,y)

with as in (1) is called a formula in -parametric Presburger Arithmetic (often abbreviated as -parametric PA). Classic Presburger arithmetic corresponds to .

###### Question 1.1.

Given a -parametric Presburger family defined by , under what conditions on the formula is the counting function a “nice” function of ?

Of course, “nice” is a vague qualifier, so let’s start with some nice examples. We will assume that the parameters are nonnegative in the following examples, which simplifies the number of cases:

###### Example 1.2.

If we define then

 |St1,t2|=⌊t2/t1⌋+1.
###### Example 1.3.

The set consists of the integer points on a line segment with endpoints and , and so

 |St1,t2|=gcd(t1,t2)+1.
###### Example 1.4.

If , then the equality forces (which is only valid if ) and substituting into the inequality shows that

 |St1,t2| =|{x1∈\Z: 0≤x1≤min(t1,t2−t1)}| =⎧⎨⎩t1+1if 2t1≤t2,t2−t1+1if t1≤t2<2t1,0if t2
###### Example 1.5.

If then

 |St|={t/2if t even, t≥2,0if t odd.

We’re seeing many types of “nice” functions in these examples, and the question is now how to generalize. In fact, Example 1.5 generalizes to any family in 1-parametic Presburger arithmetic [3], as described in the next section.

### 1.1. 1-parametric Presburger arithmetic

In the case of a single parameter , our perspective means studying families of subsets of of the form

 (4) St={x∈d:Q1y1Q2y2…QmymΘt(x,y)},

where is exactly as in (2) except that the entries of the ’s and the ’s come from the univariate polynomial ring . The study of such 1-parametric PA families was proposed by Woods in [14]. These families were further analyzed in [3], in which the main result is that they exhibit quasi-polynomial behavior:

###### Definition 1.6.

A function is a quasi-polynomial if there exists a period and polynomials such that

 g(t)=fi(t), for t≡imodm.

A function is an eventual quasi-polynomial, abbreviated EQP, if it agrees with a quasi-polynomial for sufficiently large .

Example 1.5 is a family where is an EQP.

###### Theorem 1.7.

[3] Let be a 1-parametric PA family. There exists an EQP such that, if has finite cardinality, then . The set of such that has finite cardinality is eventually periodic.

###### Remark 1.8.

In [3], the parameter takes values in instead of . However, one can see that the same proofs and conclusions also hold when ranges over .

There are several other forms of quasi-polynomial behavior that 1-parametric PA families exhibit (such as possessing EQP Skolem functions; see [3]). Here we focus on the cardinality, . We hope the reader agrees that EQPs are relatively “nice” functions.

### 1.2. k-parametric Presburger arithmetic

Let us restate our main definition:

###### Definition 1.9.

A -parametric PA family is a collection of subsets of of the form

 (5) St={x∈d:Q1y1Q2y2…QmymΘt(x,y)},

where now is a Boolean combination of linear inequalities with coefficients in .

A -parametric PA formula is an expression “” as above, or any logically equivalent first-order formula in the language with a function symbols for , unary function symbols for multiplication by each polynomial , constant symbols for and , and a relation symbol for .

###### Remark 1.10.

Abusing the notation, we also denote the parametric family just by when the dimension is clear.

Examples 1.2, 1.3, and 1.4 show that -parametric PA families, with , can have nice counting functions, . Will they always? We despair of defining “nice” precisely, but we can at least provide a necessary condition: for a fixed family , if is to qualify as a nice function, there must at least be a polynomial-time algorithm that takes as input and outputs .

###### Question 1.11.

Given a -parametric Presburger family defined by , under what conditions on the (fixed) formula is the counting function polynomial-time computable, taking as input the values of the parameters ?

Note that we define polynomial-time computation in the usual computer-science sense: the number of steps of the algorithm must be polynomial in the input size of (that is, the number of bits to encode into binary), which is . For example, the Euclidean algorithm is polynomial-time: it computes in number of arithmetic operations bounded by a degree 1 polynomial in .

The functions from Examples 1.2 through 1.5 are all polynomial-time computable. From Theorem 1.7 and the observation that EQPs are polynomial-time computable, we immediately obtain an answer to Question 1.11 in the case of a single parameter :

###### Corollary 1.12.

Let be any fixed 1-parametric PA family. Then there are polynomial time algorithms to: i) check if ,   ii) compute if .

The main goal of this paper is to construct a fixed 2-parametric PA family for which there is no polynomial-time algorithm computing (assuming ). Therefore, while we cannot say with precision what a nice function should be like, we can say that this particular counting function is not nice. Furthermore, this implies that certain classes of functions (polynomials, gcds, floor functions, modular reductions,…) are not expressive enough to capture , even for a very simple-looking . This contrasts with the 1-parameter case, where is always an EQP and hence polynomial-time computable.

Definition 1.9 is a generalization of classical Presburger arithmetic (PA), in which a formula is given only with explicit integer coefficients and constants ( and ) without any parameters . PA is decidable, meaning there is an algorithm to decide the truth of any given well-formed sentence in it. Moreover, PA has full quantifier elimination in an expanded language with predicates for divisibility by each fixed integer. This important logical fact permits an algorithm to actually count the cardinality of any set definable by a PA formula with an arbitrary number of quantifiers and inequalities, although with an unpractical triply exponential complexity in the length of (see [11]). The complexity of PA is itself a fundamental topic in the study of decidable logical theories and their complexities (see [6, 8]).

Returning to -parametric PA, for a fixed formula , given any value for , we can substitute it into to get a formula in PA. By the above paragraph, the parametric counting problem for (1) is always computable. Moreover, the form of the resulting formula , especially its number of quantifiers and inequalities, stays the same for different values a of . So we can hope that the complexity of computing (for a fixed family ) is much lower than that of counting solutions to a general PA formula (when the formula is not fixed, but instead given as input to the algorithm). To reiterate, it is critical in our analysis that the formula be fixed throughout, and we look for an efficient algorithm with as the only input.

### 1.3. Summary of results

Our main result is that if (technically, we only need the weaker assumption that ), then there exists a -parametric PA family such that is not polynomial-time computable; in fact, such a family exists with limited alternation of quantifiers. First we recall the and hierarchies of first-order formulas based on the number of quantifier alternations.

###### Definition 1.13.

A -parametric PA formula is in (respectively, ) if it is logically equivalent to one of the form

 Q1y1Q2y2…QmymΘt(x,y)

in which every quantifier is (respectively, every is ), and is a Boolean combination of linear inequalities with coefficients in .

Inductively, a -parametric PA formula is in (respectively, ) if it is equivalent to one of the form

in which every is (respectively, ) and is a formula in (respectively, ).

###### Theorem 1.14.

Assume . There exists a -parametric PA family for which is always finite but cannot be expressed as a polynomial time evaluable function in and .

Two corollaries are:

###### Corollary 1.15.

There is a -parametric family such that the set of for which is positive cannot be described using polynomial-time relations in .

###### Corollary 1.16.

Any extension of -parametric PA with only polynomial-time computable predicates cannot have full quantifier elimination.

### 1.4. Structure of the rest of the paper

We will present what amount to two different proofs of Theorem 1.14 in the following two sections. In each case, we leverage the main result of Nguyen and Pak [10] which yields a -parametric PA formula, and then show how this can be reduced to a -parametric PA formula whose points are equally “hard” to count (modulo polynomial-time reductions). The first reduction we present, in Section 2, uses a trick due to Glivický and Pudlák [7] to encode multiplication by three different integers using multiplication by only two integers, and this reduction has the advantage of not increasing the number of free variables in the formula. Next, in Section 3 we present a more general counting-reduction technique which is less ad hoc and reduces any -parametric PA formula to a -parametric PA formula with the same number of quantifier alternations; the idea here is a little more transparent than in Section 2, but it has the disadvantage of introducing many more new free and quantified variables to the formula, so we consider that it is interesting to present both reductions.

In Section 4 we consider a variant of Question 1.11 in which there is no order relation in our language; that is, we can only express linear equations but not linear inequalities. Quantifier-free formulas in this language define finite unions of lattice translates. This setting was studied in detail from a model-theoretic perspective by van den Dries and Holly [13], and we apply their results to show that, in contrast to Theorem 1.14, the counting functions in the unordered setting can be computed in polynomial time, regardless of the number of parameters and of quantifier alternations. Indeed, these functions can be expressed using gcd and related functions.

Finally, in Section 5 we discuss the optimality of Theorem 1.14 by explaining what happens when we weaken or modify some of the hypotheses.

## 2. Proof of Theorem 1.14 and its corollaries

In what follows, it will be convenient to allow -parametric PA formulas in which the quantifiers are not necessarily outside the scope of all Boolean operations, but these are always logically equivalent to expressions as in (5); for instance,

is equivalent to

 ∃y1∃y2[Θt(x,y1)∧Θ′t(x,y2)].

In [10], certain subclasses of classical PA formulas, called short PA formulas

, were investigated. The PA formulas in each such subclass are allowed to have only a bounded number of variables, quantifiers and inequalities (atomic formulas). The main problem was to classify the complexity (of counting and decision) for those short PA subclasses. It was proved that a simple subclass with only

variables, quantifier alternations and inequalities is NP-complete to decide, and also -complete to count. Combined with the positive results in [1, 2], this settled the last open subcase of classical PA complexity problems. The main reduction in [10] started with the following NP-complete problem:

###### Problem 2.1.

AP-COVER: Given an interval222All intervals in the paper are over , so with should be understood as . and arithmetic progressions

 APi=AP(gi,hi,ei)\coloneqq{gi,gi+ei,…,gi+hiei},

with , , , decide if there exists some .

In other words, the problem asks whether there is some element in the interval not covered by the given arithmetic progressions. The problem is clearly invariant under a translation of both and the ’s, so we can assume . Also without affecting the complexity, we can assume that , i.e., . The main argument in [10] uses continued fractions to construct an integer and a rational number such that the best approximations of , in the terminology of continued fractions, encode modulo . The main point is that should satisfy , so that , and the formula

 (6) Φp,q,M(z)=1≤z≤p/q∧∃yy2≡z(modM)∧⌊p/q⌋≤y2x2>0}

satisfies the property

 (7) {z∈\Z:Φp,q,M(z)}=[μ,ν]∩(n⋃i=1APi).

Thus, the original AP-COVER instance is not satisfied if and only if . We emphasize that can be computed in polynomial time from . The meaning behind this formula can be explained as follows.

In Figure 1, the line divides the positive orthant into two parts. The integer hull of the points strictly below this line and above the horizontal axis form a polyhedron, whose boundary is the (bold) convex polygonal curve , starting at and ending at . Denote by the -th edge of above the (dotted) horizontal line . Then for every we have , and thus

 n⋃i=1APi={y2modM:(y1,y2)∈C,y2≥g1}.

In (6), we express as for some with and .333The curve includes in [10], but not here. This small difference is not very significant as one can easily check. By a basic property of continued fractions (see e.g. [9]), the condition is equivalent to saying that , and there is no other integer point with such that approximates better than . This last condition is expressed by the clause in .

A hardness result for 3-parameter PA immediately follows.

###### Proposition 2.2.

Assume . There exists a -parametric PA family such that is always finite but cannot be expressed as a polynomial-time evaluable function in , , and .

###### Proof.

We can clear the integer denominators in (6) by cross multiplications. The condition

 y2≡z(modM)

can be expressed with existential quantifiers. Thus we obtain a 3-parametric PA formula , which defines a family . The set of satisfying values is finite by . Now assume is a polynomial-time evaluable function . Then given any AP-COVER instance, we can compute in polynomial time from the ’s, and then evaluate in polynomial time to check whether . This contradicts . ∎

It remains to reduce the three parameters to two. To do this, we will adapt a trick of Glivický and Pudlák [7]. Their context is slightly different from ours in that they use nonstandard integers rather than parameters that range over , and that their results involve computability rather than complexity. However their key idea and its proof apply in our context. The two parameters that will be involved are

 (8) t1=pM,t2=pqM2+M.

For convenience, we will assume for the rest of Section that all the parameters in our formulas ( and ) only take nonnegative integer values. Although in other parts of this paper the parameters are assumed to range over , this restriction does not affect the hardness results we are proving here.

###### Proposition 2.3.

[7, §3.2] For , the three multiplications can be defined by using just two multiplications and .

###### Proof.

By definition, we have for all , so it remains to define the multiplications by and for . By the division algorithm, for every we can uniquely write

 (pqM2+M)j=(pM)r+s,where0≤rand0≤s

If , then and we can then solve to obtain . Thus for , the formula

 (Divt1,t2(j,r,s)) t2j=t1r+s∧0≤r∧0≤s

is satisfied by the triple . Furthermore, for such this formula cannot be satisfied by any other values of the second and third arguments. ∎

We now prove some additional capabilities of the parameters , that will be required in order to transform the entire formula (6) into a formula in and alone.

###### Lemma 2.4.

The congruence relation modulo is definable using just the multiplications by and .

###### Proof.

Let be the formula

 b−c−t1w1−t2w2=0.

Since , the condition is expressed as:

 ∃w1,w2Cong-Mt1,t2(b,c,w1,w2).

###### Lemma 2.5.

The constant is definable using just the multiplications by and .

###### Proof.

Since , is the smallest positive integer such that . Since , we can express that a pair of variables satisfy by the formula

 u>0∧t2v=t1u∧∀v′,u′0

which we denote by .

###### Lemma 2.6.

Suppose , , and are positive integers such that . If and then .

###### Proof.

First, we have

 t21/t2=p2M2/(pqM2+M)=p/(q+1/pM)

so . On the other hand, since we have:

 p≥⌊p/q⌋q+1>⌊p/q⌋q+⌊p/q⌋/pM=⌊p/q⌋(q+1/pM).

This means , and thus . ∎

• In order to apply Proposition 2.3, we must first multiply by every inequality in (6) that involves multiplication by or . This works because multiplications by , , and appear separately in (6). After doing so and clearing some denominators, we obtain the equivalent formula

 Φ′p,q,M(z)= ∃y1,y2: (9) 0x2>0}.

Here (11) is equivalent to in (6) because . Now consider the formula

 Ψt1,t2(z)= ∃y1,y2,w1,w2,u,v,r,s: (9’) 0

It only remains to show that and are equivalent. We have:

This follows by rounding down both equations to the nearest integer and applying Lemma 2.6.

This is Lemma 2.4.

We can again apply Lemma 2.6 to replace in (11) by , since every other quantity in 11 is an integer. By Lemma 2.5, the formula fixes the value of to be , so we can now replace by to obtain 11.

By (11), we have , so by Proposition 2.3, the condition fixes the value of to be . Here we modify (12) by replacing by and by to obtain (12).

Using (12) which we have already shown to be equivalent to (12), we can replace by . Using the definition of , we can also replace by and by . So is equivalent to

 ∀x1,x2¬{ty1−r≥t1x1−qMx2≥0y2>x2>0},

or in another form

 ∀x1,x20

Since the hypothesis along with from (11) implies , we can (by Proposition 2.3) insert the condition into the hypothesis to fix equal to . Accordingly substituting in for , we obtain (13).

So and are all equivalent. This finishes the proof of Theorem 1.14. ∎

• The formula is satisfied only by those (see (7)). This formula defines a 2-parametric family . So the condition , which is equivalent to AP-COVER, cannot be expressed using polynomial-time relations in and . Similarly, any expansion of parametric PA with polynomial-time predicates cannot have full quantifier elimination. For otherwise we can apply it to the sentence and get an equivalent Boolean combination of polynomial-time relations in . ∎

## 3. Counting-universality of 2-parametric Presburger formulas

Consider a -parametric PA formula:

 (14) Φu(x)=Q1y1Q2y2…QmymΘu(x,y).

Here are the scalar parameters, are the free variables, are the quantified variables, are the quantifiers, and is a Boolean combination of linear inequalities in with coefficients and constants from . This formula defines a parametric family .

###### Definition 3.1.

We say that a -parametric family counting-reduces to an -parametric family if there exists with such that for every we have:

 |Su|=∞⇒|S′f(u)|=∞and|Su|<∞⇒|Su|=|S′f(u)|.
###### Theorem 3.2.

Every -parametric PA family counting-reduces to another -parametric PA family with the same number of alternations. In other words, -parametric PA families are counting-universal.

First we prove the following lemma.

###### Lemma 3.3.

For every formula of the form (14), there exist such that for every value we have:

• if and only if:

 ∃x[μ(u)≤∥x∥∞≤μ′(u)∧Q1(|y1|≤ν1(u))…Qm(|ym|≤νm(u))Θu(x,y)]
• If then for every :

 Su(x)=true⟺∥x∥∞≤μ(u)∧Q1(|y1|≤ν1(u))…Qm(|ym|≤νm(u))Θu(x,y).

Here is the – norm. So stands for and stands for . Each restricted quantifier means exits/for all in the interval .444Here we understand that have positive values for all .

###### Proof.

Consider a usual, non-parametric PA formula:

 Φ(x)=Q1y1Q2y2…QmymΘ(x,y),x∈n,

which defines some set . Recall Cooper’s quantifier elimination procedure for Presburger arithmetic (see [11]). Applying it to , we obtain an equivalent quantifier free formula , which may contain some extra divisibility predicates. By Theorem 2 of [11], after eliminating all quantifiers from , we obtain the following bounds:

 c′≤c4m,s′≤s(4c)4m,a′≤a4ms(4c)4m,

where:

• is the number of distinct integers that appeared as coefficients or divisors in ,

• is the largest absolute value of all integers that appeared in (coefficients + divisors + constants),

• is the total number of atomic formulas in (inequalities + divisibilities),

and are the corresponding quantities for . Now assume and are fixed. Then we have:

 c′≤const,s′≤sconst,a′≤aconstsconst,

where is fixed. So in this case has at most a fixed number of coefficients and divisors.

Denote by the common multiple of all divisors in . We have . Let be the lattice of consisting of whose coordinates are all divisible by . Fix some particular coset of and restrict to . Then in , all divisor predicates have fixed values (either true or false) as varies over . So over , the formula is just a Boolean combination of linear inequalities in , which represents a disjoint union of some rational polyhedra in . Each such polyhedron can be described by a system of fixed length, because there are only at most different coefficients for the variables. The integers in the system are also bounded by . We consider . By the fundamental theorem of Integer Programming555We are rescaling to before applying this bound. (see [12, Th. 16.4 and Th. 7.1]), we have:

 P∩C=conv(¯¯¯v1,…,¯¯¯vp)++⟨¯¯¯¯w1,…,¯¯¯¯wq⟩

for some