1.1 The complexity class
The first order theory of the reals is a set of all true sentences involving real variables, universal and existential quantifiers, boolean and arithmetic operators, constants and , parenthesis, equalities and inequalities, i.e., the alphabet is the set
A formula is called a sentence if it has no free variables, i.e., each variable present in the formula is bound by a quantifier. Note that using such formulas, we can easily express integer constants (using binary expansion) and powers. Each formula can be converted to a prenex form, which means that it starts with all the quantifiers and is followed by a quantifier-free formula. Such a transformation changes the length of the formula by at most a constant factor.
The existential theory of the reals is the set of all true sentences of the first-order theory of the reals in prenex form with existential quantifiers only, i.e., the sentences are of the form
where is a quantifier-free formula of the first-order theory of the reals with variables . The problem ETR is the problem of deciding whether a given sentence of the above form is true, and we say that is an ETR formula. We define
Thus ETR is the problem of deciding if is non-empty. The complexity class consists of all problems that are reducible to ETR in polynomial time. It is currently known that
It is not hard see that the problem ETR is NP-hard, yielding the first inclusion. The containment PSPACE is highly non-trivial, and it has first been established by Canny . In order to compare the complexity classes NP and , we suggest the reader to consider the following two problems. The problem of deciding whether a given polynomial equation with integer coefficients has a solution with all variables restricted to is easily seen to be NP-complete. On the other hand, if the variables are merely restricted to , the problem is -complete [10, Proposition 3.2].
The description complexity or simply complexity of an ETR formula is the number of symbols in , and is also denoted . The complexity of a semi-algebraic set is the minimum complexity of a formula such that .
Abrahamsen, Adamaszek and Miltzow  introduced the algorithmic problem ETR-INV and showed that it is -complete. This was one of the important conceptual steps to show that the Art Gallery Problem is -complete, for two reasons. First, all variables are conveniently bounded to the interval . Second, it is only necessary to encode inversion constraints () instead of the more general multiplication constraints (). See Section 8 for a precise definition.
Self-Containment and exhaustiveness.
We explain all details in one coherent exposition. In particular those that are scattered around and pointed out in various papers. In particular, we also explain some parts that were folklore, and only cited in . (However, we still make use of some facts from real algebraic geometry where we refer to other sources for a proof.)
Running time analysis.
We point out the running time of the reductions precisely. This can be helpful for so called fine-grained complexity and lower bounds based on the Exponential Time Hypothesis.
In our reductions, we transform one formula to another . In generating , we replace old variables by new replacement variables and we add new auxiliary variables. Here, all the replacement variables are just shifted or scaled versions of the old variables, and the auxiliary variables are likewise determined by the old variables. We capture this by defining the notion of linear extensions in Section 1.5. This notion is useful for the so-called Picasso-Theorem  and Kempe’s universality theorem.
It has happened repeatedly that we needed some slightly stronger statement than was provided in the previous paper . We expect this to happen in the future as well. This exposition is supposed to be dynamic and updated, so as to give a complete overview of the known techniques for making -hardness proofs by reductions from ETR-INV.
Every reduction is stated as a separate lemma. We hope that in this way it is more convenient to reuse parts of the reductions in forthcoming papers.
Tiny range promise.
Interestingly, all variables can be restricted to an arbitrarily small range within . This is an important observation for a forthcoming paper.
Reductions by diagrams.
There were a large number of new variables and constraints introduced in the previous reduction to ETR-INV. It was straight-forward but tedious to check that those constraints work correctly and that each new variable was in the correct range. We introduce a new type of diagrams to express such reductions involving numerous constraints, which makes it much easier to read and check the reductions.
1.3 Main Result
To illustrate our findings, we point out one important theorem. Similar theorems can be derived from the reductions presented in this exposition. See Section 1.5 for the definition of rational equivalence and linear extension.
ETR-INV is -complete. Furthermore, for every instance of ETR where is compact, there is an instance of ETR-INV such that and are rationally equivalent and is a linear extension of .
We give two corollaries here to the main theorem.
Corollary 2 (Algebraic consequence).
Let be an algebraic number. Then there exists an instance of ETR-INV, such that has a solution when the variables are restricted to , but no solution when the variables are restricted to a field that does not contain .
Let be a univariate polynomial with , . Furthermore, let be an interval such that is the only root of in . Then and , describe a compact semi-algebraic set . By Theorem 1 there is an ETR-INV instance such that and are rationally equivalent. ∎
Corollary 3 (Torus).
There exists an instance of ETR-INV such that is homeomorphic to a torus.
describes a torus. This is a compact semi-algebraic set. By Theorem 1 exists an homeomorphic ETR-INV formula. ∎
1.4 Related Work
We want to point out that many early parts of this reduction can be considered folklore. Already in 1876 Kempe  exposed ideas which are the core of our reduction in Section 4. Other important work was done by Shor  with his contribution to -hardness of stretchability. See also [11, 4, 14, 12].
1.5 Universality-type theorems
A universality statement says that for every object of type A exists an object of type B such that A and B are equivalent in some sense C. In Theorem 1, we had compact semi-algebraic sets as objects of type A, ETR-INV formulas are objects of type B, and we preserve algorithmic, topological and algebraic properties. Given our reductions, it is possible to make such statements by replacing A, B and C by something else. We think that rational equivalence and compact semi-algebraic sets are good choices for two reasons. First, compact semi-algebraic sets are very versatile. Of course, it would be nicer to have general, rather than compact, semi-algebraic sets, but ETR-INV cannot encode any open set, so this is not conceivable. The second reason is that rational equivalence seems to preserve topological and algebraic properties in a very strong sense and we are not aware how to improve this further. In this paper, whenever, we refer to polynomials, we implicitly assume the polynomials to be multivariate with integer coefficients.
Definition 4 (Rational Equivalence).
Consider two sets and and a function . We say that is a homeomorphism if it is continuous, invertible, and its inverse is continuous as well.
Write as its components , where for each . Then is rational if each function is the ratio of two polynomials, with integer coefficients.
The sets and are rationally equivalent if there exists a homeomorphism such that both and are rational functions. In that case, we write .
Be aware that the term linear extension, that we define below, has other meanings in other contexts.
Definition 5 (linear extension).
Given two sets and , we say that is a linear extension of if there is an orthogonal projection
and two vectorssuch that the mapping
is a continuous bijection. In this case we write .
Rational equivalence linear extension are both transitive relations, i.e., if and , then , and if and , then .
Furthermore, for a compact set , if or , then is compact as well.
Let and . Then is not a linear extension of , and and are neither rationally equivalent, as has two connected components.
1.6 Naming the Variables
We typically denote a new variable with a multi-character symbol such as . Here, is an expression involving already known quantities, and should be thought of as a placeholder with that value. In the case that is a constant, e.g., such that the variable is , then we say that is a constant variable. By constructing a constant variable in an ETR formula , we mean introducing variables and constraints to such that it follows that in every solution to , we have .
The expression of a variable can also involve other parameters such as for instance . In that case should be thought of as a variable holding the value , where is another variable or a parameter of the problem. It should follow from the assumptions or constraints introduced in the concrete case that indeed has the value in any solution to .
2 Reduction to Conjunctive Form
An ETR-CONJ formula is a conjunction , where and each is of one of the two forms
for and is a polynomial.
Note that since there are no strict inequalities in a formula in ETR-CONJ, the set is closed.
We show how to reduce a general ETR formula to an ETR-CONJ formula. The reduction preserves rational equivalence and runs in linear time. A similar reduction has been described by Schaefer and Štefankovič .
Given an ETR formula , we can in time compute an ETR-CONJ formula such that and .
We start with an ETR formula and modify it repeatedly to attain an ETR-CONJ formula . Each modification leads to an equivalent formula. Our modifications can be summarized in four steps. (1) Delete “”. (2) Delete “”. (3) Move “” to variables only. (4) Delete “”. In the rest of this proof and denote polynomials.
Step (1): Here, we merely ”pull“ every negation in front of every atomic predicate. For instance becomes . To see that this can be done in linear time, note that the length of is at least the number of atomic predicates. In the end of this process, every atomic predicate is preceded by either a negation or not. It may be that and symbols are swapped, but we count both as one symbol.
Thereafter each atomic predicate preceded by is replaced as follows:
Those replacements are done repeatedly until there are no occurrence of “” left in the formula.
Step (2): We replace each inequality as follows:
The dots indicate that the predicate does not immediately follow after , but will be adjoined at the end of the new formula. Furthermore, denotes a new variable. Those replacements are done repeatedly till there are no occurrence of “” left in the formula.
Step (3): We replace all atomic predicates of the form by the predicate and adjoin a new predicate at the the end of the formula. Again denotes a new variable.
Step (4): We delete disjunctions as follows. It will also be necessary to replace some conjunctions. Let be the formula after Step (1)–(3). Suppose that there is a disjunction somewhere in , and write it as for two sub-formulas and . Note that might just be a small part of – there will in general be more of to the right and left of this part.
We want to reduce each of to a single polynomial equation, as follows. Note that since we have already performed Step (1)–(3), there are no inequalities in . Suppose that is not already a single polynomial equation. Then there must somewhere in be either (i) a disjunction or (ii) a conjunction . We now explain how to reduce each of these cases to a simpler case.
Case (i): We make the replacement
Case (ii): We make the replacement
Here, and are new variables. As in Step (2), the part following the dots is appended at the end of the complete formula .
Eventually, we have reduced each to a single polynomial equation. Thus the original disjunction has the form as in Case (i), and we apply the replacement rule described there.
At first, it might seem easier in Case (ii) to replace by . However, we want our reduction to be linear and the simplified step could, if done repeatedly, lead to very long formulas.
With the replacement rules we have suggested, each iteration reduces the number of disjunctions and conjunctions by one and increases the length of the formula by at most a constant. Those replacements are done repeatedly till there are no disjunctions left in the formula.
This reduction takes linear time and the final formula is in conjunctive form. We need to describe a rational function
Note that has all the original variables of plus some additional variables, which we denote by . If is introduced in step (2), it is assigned the value and if it is introduced in step (3) or (4), it is assigned the value for some polynomial . This defines . Assume that has the free variables , where are the variables introduced by the reduction. Then
Thus and are rational bijective functions. Thus is a homeomorphism. The description of implies that is a linear extension of .
Note that the standard way to remove strict inequalities is
However, this implies that . This transformation has two issues. First, the number of solutions in a sense doubles, as the sign of is not fixed. Second, irrational solutions are introduced where before may have been only rational solutions.
3 Reduction to Compact Semi-Algebraic Sets
In the problem ETR-COMPACT, we are given an ETR-CONJ formula with the promise that is compact. The goal is to decide if is non-empty.
In this section, we describe a reduction from ETR-CONJ to ETR-COMPACT. We need a tool from real algebraic geometry. The following corollary has been pointed out by Schaefer and Štefankovič  in a simplified form.
Corollary 11 (Basu, Roy  Theorem 2).
Let be an instance of ETR of complexity such that is a non-empty subset of . Let be the set of points in at distance at most from the origin. Then .
Given an ETR-CONJ formula , we can in time create an ETR-CONJ formula such that is compact and . In other words, there is a reduction from ETR-CONJ to ETR-COMPACT in near-linear time.
Let an instance of ETR-CONJ be given and define . To make an equivalent formula such that is compact, we start by including all the variables and constraints of in . We then construct a large constant variable using exponentiation by squaring.
For each variable of , we now introduce the variables and and the constraints
Note that this corresponds to introducing the constraint in .
It now follows by Corollary 11 that
Note that is compact since contains no strict inequalities and each variable is bounded. This finishes the proof. ∎
Unfortunately, we do not have in the above reduction. That is not possible as it would imply, together with Lemma A, that an open subset of is homeomorphic to a compact set. We can also not hope for the reduction to yield a linear extension, as a bounded set cannot be a linear extension of an unbounded one.
4 Reduction to Etr-Ami
ETR-AMI is an abbreviation for Exitential Theory of the Reals with Addition, Multiplication, and Inequalities.
An ETR-AMI formula is a conjunction , where and each is a constraint of one of the forms
Lemma C (Etr-Ami Reduction).
Given an instance of ETR-COMPACT defined by a formula , we can in time construct an ETR-AMI formula such that and .
Recall that is a conjunction of atomic formulas of the form for a polynomial and for a variable . Each polynomial may contain minuses, zeros, and ones. The reduction has four steps. In each step, we make changes to . In the end, has become a formula with the desired properties. In step (1)–(3), we remove unwanted ones, zeros and minuses by replacing them by constants. In step (4), we eliminate complicated polynomials.
Step (1): We introduce the constant variable and the constraint to . We then replace all appearances of with in the atomic formulas of the form .
Step (2): We introduce the constant variable and the constraint to . We then replace all appearances of with except in the constraints of the form .
Step (3): We introduce the constant variable and the constraint to . We then replace all appearances of minus with a multiplication by in .
Step (4): We replace bottom up every occurrence of multiplication and addition by a new variable and an extra addition or multiplication constraint, which will be adjoined at the end of the formula. Here are two examples of such replacements:
In this way every atomic predicate is eventually transformed to atomic predicates of ETR-AMI or is of the form . In the latter case, we replace by .
To see that the reduction is linear, note that every replacement adds a constant to the length of the formula. Furthermore, at most linearly many replacements will be done.
Let us show that this reduction preserves rational equivalence and linear extension. This is trivial for steps (1)–(3), as these just introduce constants in order to rewrite polynomials without using zeros, ones, and minuses. In Step (4), we repeatedly make one of two types of steps, replacing either a multiplication or an addition. Thus it is sufficient to show that one such step preserves all of those properties. Consider a step where we go from to and has the variables and has the variables , with . Here is either multiplication or addition. This defines as
and is defined by
Both functions are rational and bijective, and is an orthogonal projection. This implies both rational equivalence and linear extension between and . ∎
5 Reduction to Etr-Small
Let be given. The definition of ETR-SMALL depends on , but we will suppress in the notation to keep it simpler.
An ETR-SMALL formula is a conjunction , where and each is a constraint of one of the forms
for . We define .
In the ETR-SMALL problem, we are given an ETR-SMALL formula and promised that . The goal is to decide whether .
We are going to present a reduction from the problem ETR-AMI to ETR-SMALL. As a preparation, we present another tool from real algebraic geometry. Schaefer  made the following simplification of a result from , which we will use. More refined statements can be found in .
Corollary 15 ().
If a bounded semi-algebraic set in has complexity at most , then all its points have distance at most from the origin.
Lemma D (Etr-Small Reduction).
Given an ETR-AMI formula such that is compact, we can in time construct an instance of ETR-SMALL defined by a formula such that and .
Let be an instance of ETR-AMI with variables . We construct an instance of ETR-SMALL.
We set , where . In , we first define a constant variable . This is obtained by exponentiation by squaring, using new constant variables and constraints. We first define , , and by the equations
We then use the following equations for all ,
Finally, we define by the constraint .
In , we use the variables instead of . An equation of of the form is transformed to the equation in . An equation of of the form is transformed to the equation of . For an equation of of the form , we also introduce a variable of and the equations
At last, constraints of the form become .
We now describe a function in order to show that has the properties stated in the lemma. Let . In order to define , it suffices to specify the values of the variables of depending on . For all the constant variables , we define . Note that these are all rational constants. For all , we now define and (when appears in ) . Since is a solution to , it follows from the constraints of that these assignments are a solution to .
We need to verify that defines an ETR-SMALL problem, i.e., that satisfies the promise that , where is the number of variables of . To this end, consider an assigment of the variables of that satisfies all the constraints. Note first that the constant variables are non-negative and at most . For the other variables, we consider the inverse , which is given by the assignment for all . It follows that this yields a solution to . Since is compact, it follows from Corollary 15 that . Hence . Similarly, when is a variable of , we get .
By the definitions of and , we have now established that and . The length of is longer than the length of , and can thus be computed in time. ∎
6 Reduction to Etr-Shift
Let be given. The definition of ETR-SHIFT depends on , but we will suppress in the notation to keep it simpler.
An ETR-SHIFT formula is a conjunction
where and each is of one of the forms
An instance of the ETR-SHIFT problem is an ETR-SHIFT formula and, for each variable , an interval such that . For every multiplication constraint , we have and . Define and .
We are promised that . The goal is to decide whether .
We will now present a reduction from the problem ETR-SMALL to ETR-SHIFT. The following technical lemma is a handy tool to show that all variables of the constructed ETR-SHIFT problem are in the ranges we are going to specify.
Let be a rational function such that
where . Let and .
Then for all , where , we have
if and for some , then
if for some and for a given , then
We bound each term in each polynomial from below and above and get
The bounds (1) now follows as so that .
For part (a), note that and . For part (b), we get that
One can then check that if , that range is contained in . ∎
Lemma E (Etr-Shift Reduction).
Let be given, and let such that for . Consider an instance of the ETR-SMALL problem, defined by a formula such that . We can in time compute an instance of the ETR-SHIFT problem with and formula such that and .
In the following, we specify the variables and constraints we add to . Define . As a first step, we construct constant variables for each of , as follows. We first use the constraint . Note that the solutions to this are , but since we are restricted to , we conclude that . We observe that is in the promised range of variables involved in multiplication constraints.
We can then construct the other constants as follows.
We now show how to construct a constant variable . To this end, we construct constant variables for , so that is a synonym for . For the base case , note that this is just the already constructed . Suppose inductively that we have constructed the constant variable . In order to construct , we proceed as follows.
Thus we can generate a variable with the value in steps.
For each of the constant variables thus created, we define . Note that it follows from the constraints that in any solution to , we must have .
For each each variable of , we make a corresponding variable of . As we shall see, for every solution of , there will be a corresponding solution to with , and vice versa.
For each variable of , we construct the variables , , and as follows.
For each of these of the form , , it holds that if , then .
We now go through the constraints of and create equivalent constraints in . For each equation of , we add the equation to . The equation implies that if , then .
For each equation of , we add
to . This equation implies that if and , then .
For each equation of , we have the following set of equations in .
These equations imply that if and , then .
At last, for each constraint of , we introduce the variable of and the equation . The constraint , which holds for all variables of by definition of ETR-SHIFT, then corresponds to .
Note that each of the introduced variables has the form , where is a polynomial of degree at most and with constant term . We now define .
The construction of is now finished, and we need to check that it has the claimed properties. Let the variables of be and the variables of be
For each variable , , the expression is a polynomial of degree at most two in two variables among (this includes the case that is a constant). Consider any solution to . We get a corresponding solution to as follows. We set for every . For every , is a (possibly constant) polynomial in two variables among , and we assign the value we get when evaluating this polynomial.
In order to show that this yields a solution to , we consider the constraint (2) introduced to due to an addition of . The other constraints can be verified in a similar way. Due to the construction of , it follows from that , and similarly that and . Hence we have
so indeed the constraint is satisfied.
Note that the inverse of is
We now show that is a map from to , i.e., that given any solution to , yields a solution to . Consider a constraint of of the form . We then have
In a similar way, the other constraints of can be shown to hold due to the constraints of .
It follows that is a rational homeomorphism so , and since merely subtracts from some variables, we also have .
At last, we need to verify that satisfies the promise that in every solution, each variable is in the interval . Here, is a polynomial of degree at most and with constant term . By the map , we get a solution to by the assignments and (and similarly for the remaining variables of ). It then follows from the constraints of that . By the promise of , we get that . The coefficients of the non-constant terms of are all either or . We therefore get by Lemma 17 that since , then .
Recall that and that . With the exception of the case , we therefore have that , so it follows that . Note that the case only occurs when and . In this case, there is a constraint in . Hence , so that .
In order to construct in , we introduce variables and constraints. For each of the variables and constraints of , we make a constant number of variables and constraints in . It thus follows that the running time is . This completes the proof. ∎
7 Reduction to Etr-Square
In this and the following section, we show that the problem ETR-SHIFT remains essentially equally hard even when we only allow more specialized types of multiplications in our formulas. In this section, we require every multiplication to be a squaring of the form , and in the following section, we only allow inversion of the form . The result that these two restricted types of constraints preserve the full expressibility of ETR-SHIFT is related to the result of Aho et al. [2, Section 8.2] that squaring and taking reciprocals of integers require work proportional to that of multiplication.
Let be given. The definition of ETR-SQUARE depends on , but we will suppress in the notation to keep it simpler.
An ETR-SQUARE formula is a conjunction
where and each is of one of the forms
An instance of the ETR-SQUARE problem is an ETR-SQUARE formula and, for each variable , an interval such that . For every squaring constraint , we have . Define and .
We are promised that . The goal is to decide whether .
Below, we present a reduction from the problem ETR-SHIFT to ETR-SQUARE.
Lemma F (Etr-Square Reduction).
Let be given, and let . Consider an instance of the ETR-SHIFT problem such that , and let . We can in time compute an instance of the ETR-SQUARE problem with and formula such that and .
As in the proof of Lemma E, we first construct constant variables for each of . The only difference is that we now construct using the constraint . The other constants are then constructed in exactly the same way as before.
We include each variable of in as well, and reuse the interval from in . We also reuse all contraints from of the form in , but we have to do something different for the constraints . The idea is very simple and was also used by Aho et al. [2, Section 8.2], and can be expressed by the equations
If there were no range constraints, we could just replace each multiplication of by equations as above (after rewriting the subtractions as additions, etc.). However, in our situation all intermediate variables need to be in a range in any solution. While this makes the description more involved, careful shifting will work for us.
Let be a multiplication constraint in . Let us rename the variables as , , and , so that becomes
Consider two numbers and the two conditions
We claim that ( ‣ 7) is equivalent to
To show this claim, suppose first that ( ‣ 7) holds. Define and . Then , so that ( ‣ 7) holds. Hence we have ( ‣ 7). On the other hand, suppose that ( ‣ 7) holds, and define and so that ( ‣ 7) holds. Our assumption implies that ( ‣ 7) holds, and we thus have , so that ( ‣ 7) holds. Our aim is therefore to make constraints in that ensure ( ‣ 7).
For every variable of , we can construct using the constraint . Similarly, we can construct by .
The construction of is shown in Figure 2. The diagram should be understood in the following way. We start with the original variables and . Each arrow is labeled with the operation that leads to the new variable. It is straightforward to check that the construction ensures condition ( ‣ 7).
Note that each of the constructed auxilliary variables has the form , where is a second degree polynomial with constant term . We define . This finishes the construction of . Note that since and , we get that , as required.
We now verify that has the claimed properties. Consider a solution . We point out an equivalent solution to . For all the variables of that also appear in , we use the same value as in the solution . Each auxilliary variable has the form , where is a second degree polynomial, and contains the multiplication constraint ( ‣ 7). We then get from the promise of that and for . From the construction shown in Figure 2, it follows that in order to get a solution to , we must define . Recall that the constant term satisfies , and note that all the coefficients of the non-constant terms of are in the interval . We then get from Lemma 17 that . The variables are thus in the range , so we have described a solution to .
Similarly, we see that any solution to corresponds to a solution to . Using the promise of and Lemma 17 as above, we then also confirm the promise of that each variable of is in .
The correspondance described implies that and . For each constraint of , we introduce variables and constraints of , so the reduction takes time. ∎
8 Reduction to Etr-Inv
Let be given. The definition of ETR-INV depends on , but we will suppress in the notation to keep it simpler.
An ETR-INV formula is a conjunction
where and each is of one of the forms
An instance of the ETR-INV problem is an ETR-INV formula and, for each variable , an interval such that . Define and .
We are promised that . The goal is to decide whether .
We will now present a reduction from the problem ETR-SQUARE to ETR-INV.
Lemma G (Etr-Inv Reduction).
Let be given, and let . Consider an instance of the ETR-SQUARE problem such that , and let . We can in time compute an instance of the ETR-INV problem with and formula such that and .
As in the proof of Lemma E, we first construct constant variables for each of . The only difference is that we now construct using the constraint . It follows from this constraint that , and since , we must have in every valid solution. The other constants are then constructed in exactly the same way as before. For this reduction we also need the constant variable which is constructed as .
We include each variable of in as well, and reuse the interval from in . We also reuse all contraints from of the form in , but we have to do something different for the squaring constraints . In , we rename the variables as and , so that becomes
Consider a number and the two conditions
Our aim is therefore to make constraints in that ensure ( ‣ 8).
In the same way as described in Section 6 and Section