 # Presburger Arithmetic with algebraic scalar multiplications

We study complexity of integer sentences in S_α = (R, <, +,Z, x α x), which is known to be decidable for quadratic α, and undecidable for non-quadratic irrationals. When α is quadratic and the sentence has r alternating quantifier blocks, we prove both lower and upper bounds as towers of height (r-3) and r, respectively. We also show that for α non-quadratic, already r=4 alternating quantifier blocks suffice for undecidability.

## Authors

##### 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

### 1.1. Foreword

It is generally well known that the areas of mathematics sometimes meet at unexpected places, leading to problems where tools from different areas can be used. Yet it is always exciting to witness this happening, as it both validates the common goals and justifies diverse techniques in their pursuit.

This paper arose at the meeting of two areas: mathematical logic (specifically, decidability of theories) and discrete geometry (integer points in polytopes). In recent years, there has been much effort by the authors, pursuing somewhat different but related goals, to understand when variations on  Presburger Arithmetic (PA)  become intractable. The meaning of “intractable” is traditionally different in the two ares, of course. In logic it is qualitative and stands for decidable, while in computational geometry and integer optimization it is quantitative and stands for computationally hard (as in NP-hard, PSPACE-hard, etc.)

In this paper we bridge the gap between the areas by asking questions of common interest. In fact, we get very close to completely filling the gap (see 8.1). As the reader shall see, we use similar number theoretic tools (Ostrowski representation of integers), as well as computational ideas.

Part of the problem in presenting the results is addressing both audiences, so we structure the paper a little differently. We first state the results and then give concise yet lengthy backgrounds in both area separately, emphasizing advances from both directions.

### 1.2. Main results

Let be a fixed irrational number. The reader can always assume that is algebraic, although some results in the paper hold in full generality.

Let . This is a first order theory over the reals, with a predicate for the integers, which allows addition and scalar multiplication by . This is an extension of Presburger Arithmetic. It is still decidable when is quadratic [H2], but undecidable otherwise [HTy] (see below).

An integer sentence in , is a sentence whose quantified variables are constrained to integer values. Such sentences have the form:

 (1.1) S=Q1x1∈Zn1…Qrxr∈ZnrΦ(x1,…,xr),

where are alternating quantifiers, and is a Boolean combination of linear inequalities in with coefficients and constant terms in . As the number  of alternating quantifier blocks and the dimensions increase, such sentences become harder to decide, and determining exactly how hard is an important problem in computational complexity.

Sentences in (1.1) have a nice geometric interpretation in many special cases. When the Boolean formula is a conjunction of linear equations and inequalities, it gives a convex polyhedron  defined over . For and , the sentence  asks for existence of an integer point in :

 (1.2) ∃x∈P∩Zn.

In a special case of , and , the sentence  asks whether projections of integer points in a convex polyhedron cover all integer points in another polyhedron :

 (1.3)

Here both and are defined over . Further variations on the theme and increasing number of quantifiers allow most general formulas with integer valuations of the polytope algebra (see e.g. [Bar]).

We think of as being given by its defining polynomial of degree , with a rational interval to single out a unique root. We say that is quadratic if . Similarly, the elements are represented in the form  , where  . For example, is quadratic, is given by  , so that  .

For , the encoding length is the total bit length of ’s defined above. Similarly, the encoding length is defined to be the total bit length of all symbols in , with integer coefficients and constants represented in binary. In the following results, the constants vary from one context to another.

###### Theorem 1.1.

Let be a quadratic irrational number, and let . An integer sentence in with  alternating quantifier blocks can be decided in time at most

where the constants    depend only on .

In the opposite direction, we have the following lower bound:

###### Theorem 1.2.

Let be a quadratic irrational number, and let . Then, deciding integer sentences in with alternating quantifier blocks and at most    variables and inequalities requires space at least:

 K22\iddots2Cℓ(S)\rm(tower of height r−3),

where the constants    only depend on .

These results should be compared with the triply exponential upper bound and doubly exponential lower bounds for PA (discussed below). The borderline case of , the problem is especially interesting. We give the following lower bound, which only need a few variables:

###### Theorem 1.3.

Let be a quadratic irrational number. Then, deciding    integer sentences in with at most inequalities is PSPACE-hard, where the constant depends only on . Furthermore, for , one can take .

This should be compared with Grädel’s theorem on -completeness for integer sentences in PA [Grä] (also discussed below).

On the other hand, for non-quadratic irrational numbers, we have:

###### Theorem 1.4.

Let be a non-quadratic irrational number. Then   integer sentences in are undecidable, where .

### 1.3. Complexity background

Presburger Arithmetic PA is the decidable first order theory of , first introduced by Presburger in [Pre] and extensively studied by Skolem and others. A quantifier elimination algorithm for PA was given by Cooper [Coo] to effectively solve the decision problem of PA. General PA sentences have no bounds on the numbers of quantifiers, variables and Boolean operations. Oppen [Opp] showed that such sentences can be decided in at most triply exponential time (see also [RL]). In the opposite direction, a nondeterministic doubly exponential lower bound was obtained by Fischer and Rabin [FR] (see also [W1]) for deciding general PA sentences. As one restricts the number of alternations, the complexity of PA drops down by roughly one exponent (see [Für, Sca, RL]), but still remains exponential.

For a bounded number of variables, two important cases are known to be polynomial time decidable, namely the analogues of (1.2) and (1.3) with rational polyhedra and . These are classical results by Lenstra [Len] and Kannan [Kan], respectively. Scarpellini [Sca] showed that all -sentences are still polynomial time decidable for every fixed. However, for two alternating quantifiers, Schöning proved in [Sch] that deciding is NP-complete. Here any Boolean combination of linear inequalities in two variables, instead of those in the particular form (1.3). This improved on an earlier result by Grädel in [Grä], who also showed that PA sentences with alternating quantifier blocks and variables are complete for the -th level in the Polynomial Hierarchy PH. In these results, the number of inequalities (atoms) in is still part of the input, i.e., allowed to vary.

Much of the recent work concerns the most restricted PA sentences:

 (1.4) Q1z1…Qr+1zr+1Qr+2zr+2:Φ(z1,…,zm+2)

for which the number of alternations (), number of variables and number of inequalities in are all fixed. Thus, the input of (1.4) is essentially a bounded list of integer coefficients and constants in , encoded in binary. For , such sentences are polynomial time decidable by [Woo]. For , Nguyen and Pak [NP] showed that deciding    PA-sentences with at most inequalities is NP-complete. More generally, they showed that such sentences with alternations, variables and inequalities are complete for the -th level in PH. Thus, limiting the “format” of a PA formula does not reduce the complexity by a lot. This is our main motivation for the lower bounds in theorems 1.3 and 1.2 for .

We emphasize that the sudden jump from polynomial hierarchy in PA to super-exponential complexity in is due to the power of irrational quadratics. Specifically, any irrational quadratic has an infinite periodic continued fraction. From here, we can work with Ostrowski representations of integers in base

, and code string relations such as shifts, suffix/prefix and subset, which were not all possible in PA. Such operations are rich enough to encode arbitrary automata computation, and in fact Turing Machine computation in bounded space.

Finally, in [KP], Khachiyan and Porkolab prove that for a bounded number of variables, one can decide in polynomial time if a convex semialgebraic set contains an integer point (see Theorem 8.3). In particular, for linear equations and inequalities, this implies the Integer Programming with algebraic coefficients:

###### Theorem 1.5 ([Kp]).

Let be the field of algebraic numbers. For every fixed , sentences of the form with can be decided in polynomial time.

Note that the system    in the theorem can involve arbitrary algebraic irrationals. This is a rare positive result on irrational polyhedra. In fact, for a non-quadratic , this gives the only positive result on that we know of (cf. 8.2).

### 1.4. Decidability background

It has long been known that the theory of , equivalently the theory of for rational , is decidable (arguably due to Skolem [Sko] and later rediscovered independently by Weispfenning [W2] and Miller [Mil]). However, the decidability of the theory of for irrational was determined only recently.

Hieronymi and Tychonievich showed in [HTy] that if an expansion of can define a discrete set and also satisfies a certain reasonable denseness condition, then it can actually define every subset of for every . As an application, they proved the following result:

###### Theorem 1.6 ([HTy]).

For any that are -linearly independent, the structure defines multiplication, and thus its theory is undecidable.

Since are -linearly independent for a non-quadratic , the theory of is undecidable for such . Indeed, a careful analysis of their work shows that this result can be further specialized to give undecidability of integer sentences in :

###### Corollary 1.7 ([HTy]).

For any non-quadratic , integer sentences (1.1) of are undecidable.

The main contrast between Theorem 1.5 and 1.7 is that the former only considers -sentences. Neither Corollary 1.7 nor an upper bound on in (1.1) needed for undecidability was stated explicitly in [HTy], but both can be obtained by careful analysis of the proof. In Theorem 1.4, we not only give a proof of Corollary 1.7, but also explicitly quantify this result by showing that alternating quantifier blocks are enough for undecidability. While our argument is based on the ideas in [HTy], substantial extra work is necessary to reduce the number of alternations to from the upper bound implicit in the proof of Theorem 1.6.

When is quadratic, Hieronymi proved the following surprising result:

###### Theorem 1.8 ([H1, H2]).

For quadratic, integer sentences (1.1) of are decidable. More generally, the structure defines a model of Monadic Second Order Logic (MSO), and vice versa.

By this result for quadratic, to decide integer sentences (1.1), one can translate them into corresponding sentences in MSO and then decide the latter. Thus, upper and lower complexity bounds for decision in MSO can theoretically be transferred to . However, an efficient direct translation between and MSO was not described in [H1, H2]. Ideally, one would like to translate a sentence from to MSO, and vice versa, with as few extra alternations as possible. In theorems 1.1 and 1.2, we explicitly quantify this translation.

### 1.5. Proofs outline

The most powerful feature of is that we can talk about Ostrowski representation of integers, which will be used as the main encoding tool. We first obtain the upper bound in Theorem 1.1 by directly translating (1.1) into the language of automata using Ostrowski encoding. Next, we show the lower bound for alternating quantifiers (Theorem 1.3) by a general argument on the Halting Problem with polynomial space constraint, again using Ostrowski encoding.

We generalize the above argument to get lower bound for any alternating quantifier blocks (Theorem 1.2). This is done by first translating sentences from the weak Second Order Monadic logic (WMSO) to sentences with only one extra alternation, and then invoke a known tower lower bound for WMSO. Overall, the paper make transitions between , finite automata and WMSO, all of which are different incarnations of the same logic theory.

Finally in the proof of Theorem 1.4, we can again use the expressibility of Ostrowski representation to reduce the upper bound of the number of alternating quantifier blocks needed for undecidability in for non-quadratic . The use of Ostrowski representations allows us to replace more general arguments from [HTy] by explicit computations, and thereby reduce the quantifier-complexity of certain integer sentences in .

## 2. Notations

Ostrowski representation and continued fractions play a crucial role throughout the paper, and are first introduced in Section 3. We use the following notation:

• [leftmargin=1cm]

• denotes the set of convergents with non-zero coefficients in the Ostrowski representation of .

• We write if is a convergent with a non-zero coefficient in the Ostrowski representation of .

## 3. Preliminaries

### 3.1. Continued fractions and Ostrowski representation

Let be any irrational, with . The convergents of follow the recurrence relation:

 (3.1) (p−1,q−1)=(1,0);(p0,q0)=(a0,1);pn=anpn−1+pn−2,qn=anqn−1+qn−2for n≥1.

This can be written as:

 (3.2) (pnpn−1qnqn−1)=Γ0…Γn

where . Let . They have the properties:

 (3.3) βn>0if2|n,βn<0if2∤n.
 (3.4) β0>−β1>β2>−β3>…
 (3.5) −βn=an+2βn+1+an+4βn+3+an+6βn+5+…∀n∈N.

These can be easily proved using (3.1). We refer to [RS] for the basics of continued fractions.

###### Fact 3.1.

Each has a unique -Ostrowski representation:

 (3.6) X=N∑n=0bn+1qn.

where , and whenever .

###### Proof.

See [RS, Ch. II-§4]. ∎

From now on, when and are clear from the context, we refer to (3.6) simply as the Ostrowski representation of . We also denote the coefficient by . Denote by the set of with .

We set , so that . Let . Define to be the function that maps to , where is the unique natural number such that . In other words:

 (3.7) fα(X)=αX−U⟺−1ζα≤αX−U<1−1ζα.

Define , so that .

###### Fact 3.2.

Let . We have:

 (3.8) fα(X)=∑n=0bn+1βnandgα(X)=∑n=0bn+1pn,

where the coefficients are from (3.6). Also is a dense subset of the interval .

###### Proof.

See  [RS, Th. 1 on p. 25] and [RS, Th. 1 on p. 33]. ∎

### 3.2. Periodic continued fractions

An irrational is a quadratic if and only if it has a periodic continued fraction . Let . It is clear that for some . Therefore, sentences in the theory can be expressed in and vice versa. Thus, for our complexity purposes, we can always assume that our quadratic irrational is purely periodic, i.e.,

 (3.9) α=[¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯a0;a1,…,ak−1]

with the minimum period .

###### Fact 3.3.

Let . There exist such that for every with , we have:

 (pn+i,qn+i)=ci(pn,qn)+di(pn+1,qn+1).

The coefficients can be computed in time .

###### Proof.

By (3.2), we have:

 (pn+i+1pn+iqn+i+1qn+i)=Γ0…Γn+1Γn+2…Γn+i+1=(pn+1pnqn+1qn)Γn+2…Γn+i+1

Since for every and , we have . Let

 (3.10) Γ2…Γi+1=(d′idic′ici)

we have

 (pn+i+1pn+iqn+i+1qn+i)=(pn+1pnqn+1qn)(d′idic′ici)

So and only depend on . Note that can be computed in time by (3.10). ∎

###### Remark 3.4.

For , we have . For , we have . By (3.10), if we let then they follow the recurrence:

 (3.11) γ0(v,v′)=v,γ1(v,v′)=v′,γi(v,v′)=aiγi−1(v,v′)+γi−2(v,v′),

as similar to (3.1).

###### Fact 3.5.

There are fixed such that

 pn=μqn+μ′qn+k,qn=νpn+ν′pn+k

for every .

###### Proof.

Again from (3.2), for every :

Since , we have:

 (pn+kqn+k) =(Γ0…Γk−1)(Γk…Γn+k)(10)=(Γ0…Γk−1)(Γ0…Γn)(10) =(Γ0…Γk−1)(pnqn)=(pk−2pk−1qk−2qk−1)(pnqn).

Note that are constants. From here we easily get and . ∎

### 3.3. Logical formulas for working with Ostrowski representation

Let be any irrational, not just quadratic. The convergents can be characterized by the best approximation property. Namely, with is a convergent if and only if

 (3.12) ∀w,z(0|u−αv|.

From this, we have and if and only if they satisfy

 (3.13)

Note that is a -formula. More generally, consider the formula:

 (3.14) C∀(u0,v0,…,uk,vk)\coloneqq1|ui+1−αvi+1|).

Then is true if and only if for some with , i.e., consecutive convergents of .

###### Remark 3.6.

Hereafter, we assume , i.e., and for some .

Define the following quantifier free relations:

 (3.15) After(u,v,u′,v′,Z,Z′)\coloneqq (−αv+u<αZ−Z′<−αv′+u′) ∨(−αv′+u′<αZ−Z′<−αv+u).
 (3.16) ˜After(u,v,u′,v′,Z,Z′)\coloneqq (−αv+u−αv′+u′<αZ−Z′<−αv′+u′) ∨(−αv′+u′<αZ−Z′<−αv+u−αv′+u′).
###### Fact 3.7.

We have:

• [leftmargin=1em]

• if and only if holds for some .

• and if and only if holds for some .

Also is uniquely determined by if After or holds.

###### Proof.

(Similar to lemmas 4.6, 4.7 and 4.8 in  [H2])

i) Assume

is odd. If

, then its Ostrowski representation is for some . From Fact 3.2, we have . By (3.3), we have have if is odd and if is even. Combined with , we have:

 an+3βn+2+an+5βn+4+…

By (3.5), this can be written as . By (3.7), we have , where is unique such that . Also note that and . So the above inequalities can be written as . When is even, the inequalities reverse to . Thus implies . The converse direction can be proved similarly, using (3.4) and (3.5).

ii) The only difference here is that can be at most . Details are left to the reader. ∎

The relation , meaning that appears in , is -definable:

 (3.17) ∃Z1,Z2,Z3(v≤Z1

and also -definable:

 (3.18) ∀Z1,Z2,Z3[(Z1

To see this, note that if and only if for some with and .

We will need one more quantifier-free formula:

 (3.19) Compatible(u,v,u′,v′,X,Z,Z′)\coloneqqX< v′∧After(u,v,u′,v′,Z,Z′) ∧(X≥v→˜After(u,v,u′,v′,Z,Z′)).

This is satisfied if and only if

• (by ),

• (by After),

• If , then in is strictly less than (by ).

In other words, Compatible is satisfied if and only if and can be directly concatenated at the point to form (see (3.6)).

## 4. Quadratic irrationals: Upper bound

In this section we prove Theorem 1.1. It should be emphasized that the tower height in Theorem 1.1 only depends on the number of alternating quantifiers, but not on the number of variables in the sentence . First, we consider the case of a quantifier free formula.

###### Proposition 4.1.

Let be a quantifier free (integer) formula in , i.e., a Boolean combination of linear inequalities in with coefficients/constants in . Then there is an automaton of size recognizing the set of solutions of . The constant only depends on .

###### Proof.

Each variable in takes value over , but can be replaced by for two variables . So we can assume that all variables take values over . Recall that coefficients/constants in are given in the form with . So now each inequality in can be reorganized into the form:

 ¯¯¯ay+α¯¯bz≤¯¯ct+α¯¯¯dw.

Here are tuples coefficients in , and are subtuples of . Now, for each homogeneous term , we add in an additional variable and replace each appearance of in the inequalities by . By doing so, we introduce extra variables, but still keep the length linear. Now our formula splits into two parts. The first part consists of integer linear equalities:

 (∗)u=¯¯¯ay.

The second part consists of inequalities of the form:

 (∗∗)u+αv≤w+αz.

We encode integer variables by their Ostrowski representations, and build an automaton that recognizes the solutions of . In other words, each is encoded by the string , where the ’s are from (3.6). Here only a finite number of ’s are nonzero, so is a finite string. Since ’s are periodic (3.9) and , we are working with a finite alphabet.

First, by the result in [HTe], integer addition in Ostrowski representation is recognizable by a finite automaton. In other words, the function is regular. Now we rewrite each equality into single additions, using the doubling trick. For example, the equality is equivalent to the following system:

 y1=y+y,y2=y1+y1,y3=y2+y,z1=z+z,u=y3+z1.

Again, we are introducing additional variables while keeping linear. Each single addition is recognizable by a finite automaton. Taking product of all such automata, one for each addition, we get a single automaton of size that recognizes the first part . Here is some constant dependent on .

Now we build an automaton for each inequality , and later take their product automaton. Recall and from (3.7) and Fact 3.2. We have for every . Here and always lies in the unit length interval . For , we have if and only if:

 u+gα(v)

So the proof is done if we can show that for input :

• The relation is recognizable by a finite automaton.

• The relation is recognizable by a finite automaton.

• The function is recognizable by a finite automaton.

Tasks i) and ii) are straightforward from basic properties of Ostrowski representation. We have if and only if is lexicographically smaller than when read from right to left. Also if and and is the smallest index where , then:

 n odd:bnfα(y).

(see [H2, Fact 2.13]). We have iii) left to show. ∎

###### Lemma 4.2.

The function is recognizable by a finite automaton with Ostrowski encoding.

###### Proof of Lemma 4.2.

We can assume that is purely periodic, with minimum period (see Section 3.2). Also from Fact 3.5, there are fixed such that

 pn=μqn+μ′qn+k for every n≥0.

For with Ostrowski representation we define:

 Shift(x)\coloneqqN∑n=0bn+1qn+k.

In other words, if then . So is clearly recognizable by a finite automaton. By Fact 3.2:

 gα(x)=∑n=0bn+1pn=∑n=0bn+1(μqn+μ′qn+k)=μx+μ′Shift(x).

Since is a linear combination of and and linear equations are regular ([HTe]), we have an automaton for .222By clearing denominators in and building automata for single additions.

###### Proof of Theorem 1.1.

Given the sentence (1.1), by negation, we can assume . First, we build an automaton of size to recognize the quantifier free part .333Actuall, we first need to make so that additional variables in the proof of Lemma 4.1 can be inserted after . After that we make . Apply negations whenever necessary. Then we apply the power set construction (see e.g. [HUM, §2.3.5]) to eliminate . This blows up the size of by at most exponentiations. Thus, the resulting automaton has size at most a tower of height in . Now we still have the outer quantifier remaining, i.e., we still need to decide if has a solution. This is doable by a simple reachability argument, which runs in linear time relative to the size of . ∎

In this section we prove Theorem 1.3. We will first show the lower bound for a general quadratic irrational (Theorem 5.1), and then specialize to (Corollary 5.3). By a short sentence, we mean one with an integer sentence in with a bounded number of variables, quantifiers and atoms (inequalities).

###### Theorem 5.1.

Let be a fixed quadratic irrational and . Then deciding short sentences in the theory is PSPACE-hard.

The most important property for any quadratic irrational is the periodicity of its continued fraction. Before proving Theorem 5.1, we construct in  5.1 some explicit formulas in to deal with the Ostrowski representation of an integer, in this case exploiting the periodicity of . Then we recall the definitions of Turing machine computations in Subsection 5.2. The proof of Theorem 5.1 is in Subsection 5.3, which translates Turing machine computations into Ostrowski representations of integers. An explicit bound on the number of variables and inequalities for the constructed short sentences are given in  5.4, where we also treat the case .

### 5.1. Ostrowski representation for quadratic irrationals

We only need to consider a purely periodic with minimum period (see Section 3.2). Let .

We can define the set of convergents for which . Recall from Remark 3.4 (also see Fact 3.3). Now define the formula:

 (5.1) k+1⋀i=0(0|γi+1(u,u′)−αγi+1(v,v′)|).

We claim that is satisfied if and only if and for some . First, the condition implies that the pairs are consecutive convergents (see (3.12) and (3.13)). In other words, there is an such that:

 (γi(u,u′),γi(v,v′))=(pn+i,qn+i),0≤i≤k+1.

Also by Remark 3.4, we have