# Real Polynomial Systems

Introduction | Arbitrary Real Polynomial Systems |

Cylindrical Algebraic Decomposition | Options |

Decision Problems, FindInstance, and Assumptions | References |

## Introduction

A *real polynomial system* is an expression constructed with polynomial equations and inequalities

combined using logical connectives and quantifiers

An occurrence of a variable inside or is called a bound occurrence; any other occurrence of is called a free occurrence. A variable is called a free variable of a real polynomial system if the system contains a free occurrence of . A real polynomial system is quantifier free if it contains no quantifiers.

An example of a real polynomial system with free variables , , and * *is the following:

Any real polynomial system can be transformed to the *prenex normal form*

where each is or , and is a quantifier-free formula called the quantifier-free part of the system.

Any quantifier-free real polynomial system can be transformed to the disjunctive normal form

where each is a polynomial equation or inequality.

Reduce, Resolve, and FindInstance always put real polynomial systems in the prenex normal form, with quantifier-free parts in the disjunctive normal form, and subtract sides of equations and inequalities to put them in the form

In this tutorial, it is always assumed the system has been transformed to this form.

Reduce can solve arbitrary real polynomial systems. For a system with free variables , the solution (possibly after expanding with respect to ) is a disjunction of terms of the form

and and are algebraic functions (expressed using Root objects or radicals) such that for all satisfying , and are well defined (that is, denominators and leading terms of Root objects are nonzero), real valued, continuous, and satisfy inequality .

The subset of described by formula (4) is called a *cell*. The cells described by different terms of solution of a real polynomial system are disjoint.

In[1]:= |

Out[1]= |

In[2]:= |

In[5]:= |

Out[5]= |

Resolve can eliminate quantifiers from arbitrary real polynomial systems. If no variables are specified in the input and all input polynomials are at most quadratic in the bound variables, Resolve may be able to eliminate the quantifiers without solving the resulting system. Otherwise, Resolve uses the same algorithm and gives the same answer as Reduce.

In[6]:= |

Out[6]= |

FindInstance can handle arbitrary real polynomial systems, giving instances of real solutions or an empty list for systems that have no solutions. If the number of instances requested is more than one, the instances are randomly generated from the full solution of the system and therefore may depend on the value of the option. If one instance is requested and the system does not contain general () quantifiers, a faster algorithm producing one instance is used and the instance returned is always the same.

In[7]:= |

Out[7]= |

The main general tool used in solving real polynomial systems is the Cylindrical Algebraic Decomposition (CAD) algorithm (see, for example, [1]). CAD for real polynomial systems is available in *Mathematica* directly as CylindricalDecomposition. There are also several other algorithms used to solve special case problems.

## Cylindrical Algebraic Decomposition

### Semialgebraic Sets and Cell Decomposition

A subset of is *semialgebraic* if it is a solution set of a quantifier-free real polynomial system. According to Tarski's theorem [2], solution sets of arbitrary (quantified) real polynomial systems are semialgebraic.

Every semialgebraic set can be represented as a finite union of disjoint cells [3] defined recursively as follows:

where is a cell in , is a continuous algebraic function, and are continuous algebraic functions, or or , and on .

By an algebraic function we mean a function for which there is a polynomial

In *Mathematica* algebraic functions can be represented as Root objects or radicals.

The CAD algorithm, introduced by Collins [4], computes a cell decomposition of solution sets of arbitrary real polynomial systems. The objective of the original Collins algorithm was to eliminate quantifiers from a quantified real polynomial system and to produce an equivalent quantifier-free polynomial system. After finding a cell decomposition, the algorithm performed an additional step of finding an implicit representation of the semialgebraic set in terms of polynomial equations and inequalities in the free variables. The objective of Reduce is somewhat different. Given a semialgebraic set presented by a real polynomial system, quantified or not, Reduce finds a cell decomposition of the set, explicitly written in terms of algebraic functions.

While* *Reduce may use other methods to solve the system, CylindricalDecomposition gives a direct access to the CAD algorithm. For a real polynomial system, CylindricalDecomposition gives a nested formula representing disjunction of cells in the solved form (4). As in the output of Reduce, the cells are disjoint and additionally are always ordered lexicographically with respect to ranges of the subsequent variables.

In[8]:= |

Out[8]= |

SemialgebraicComponentInstances gives at least one sample point in each connected component of a semialgebraic set. The function uses the CAD algorithm and returns a sample point in each of the constructed cells.

In[9]:= |

Out[9]= |

### The Projection Phase of the CAD Algorithm

Finding a cell decomposition of a semialgebraic set using the CAD algorithm consists of two phases, projection and lifting. In the projection phase, we start with the set of factors of the polynomials present in the quantifier-free part of the system (2) and eliminate variables one by one using a projection operator such that

Generally speaking, if all polynomials of have constant signs on a cell , then all polynomials of are delineable over , that is, each has a fixed number of real roots on as a polynomial in , the roots are continuous functions on , they have constant multiplicities, and two roots of two of the polynomials are equal either everywhere or nowhere in . Variables are ordered so that

This way the roots of polynomials of are the algebraic functions needed in the construction of the cell decomposition of the semialgebraic set.

Several improvements have reduced the size of the original Collins projection. The currently best projection operator applicable in all cases is due to Hong [5]; however, in most situations we can use a smaller projection operator given by McCallum [6, 7], with an improvement by Brown [8]. There are even smaller projection operators that can be applied in some special cases. When equational constraints are present, we can use the projection operator suggested by Collins [9], and developed and proven by McCallum [10, 11]. When there are no equations and only strict inequalities, and there are no free variables or we are interested only in the full-dimensional part of the semialgebraic set, we can use an even smaller projection operator described in [12, 13]. For systems containing equational constraints that generate a zero-dimensional ideal, Gröbner bases are used to find projection polynomials.

*Mathematica* uses the smallest of the previously mentioned projections that is appropriate for the given example. Whenever applicable, we use the equational constraints; otherwise, we attempt to use McCallum's projection with Brown's improvement. When the system does not turn out to be well oriented, we compute Hong's projection.

### The Lifting Phase of the CAD Algorithm

In the lifting phase, we find a cell decomposition of the semialgebraic set. Generally speaking, although the actual details depend on the projection operator used, we start with cells in consisting of all distinct roots of and the open intervals between the roots. We find a sample point in each of the cells and remove the cells whose sample points do not satisfy the system describing the semialgebraic set (the system may contain conditions involving only ). Next we lift the cells to cells in , one dimension at a time. Suppose we have lifted the cells to . To lift a cell to , we find the real roots of with replaced with the coordinates of the sample point in . Since the polynomials of are delineable on , each root is a value of a continuous algebraic function at , and the function can be represented as a root of a polynomial such that is the root of . Now the lifting of the cell to will consist of graphs of these algebraic functions and of the slices of × between the subsequent graphs. The sample points in each of the new cells will be obtained by adding the coordinate to , equal to one of the roots, or to a number between two subsequent roots. As in the first step, we remove those lifted cells whose sample points do not satisfy the system describing the semialgebraic set.

If , is a quantifier variable and we may not need to construct all the lifted cells. All we need is to find the (necessarily constant) truth value of on . If , we know that the value is True as soon as the truth value of on one of the lifted cells is True. If , we know that the value is False as soon as the truth value of on one of the lifted cells is False.

The coefficients of sample points computed this way are in general algebraic numbers. To save costly algebraic number computations, *Mathematica* uses arbitrary-precision floating-point number (*Mathematica* "bignum") approximations of the coefficients, whenever the results can be validated. Note that using approximate arithmetic may be enough to prove that two roots of a polynomial or a pair of polynomials are distinct, and to find a nonzero sign of a polynomial at a sample point. What we cannot prove with approximate arithmetic is that two roots of a polynomial or a pair of polynomials are equal, or that a polynomial is zero at a sample point. However, we can often use information about the origins of the cell to resolve these problems. For instance, if we know that the resultant of two polynomials vanishes on the cell, and these two polynomials have exactly one pair of complex roots that can be equal within the precision bounds, we can conclude that these roots are equal. Similarly, if the last coordinate of a sample point was a root of a factor of the given polynomial, we know that this polynomial is zero at the sample point. If we cannot resolve all the uncertainties using the collected information about the cell, we compute the exact algebraic number values of the coordinates. For more details, see [14, 24].

## Decision Problems, FindInstance, and Assumptions

A *decision problem* is a system with all variables existentially quantified, that is, a system of the form

where are all variables in . Solving a decision problem means deciding whether it is equivalent to True or to False, that is, deciding whether the quantifier-free system of polynomial equations and inequalities has solutions.

All algorithms used by *Mathematica* to solve real polynomial decision problems are capable of producing a point satisfying if the system has solutions. Therefore the algorithms discussed in this section are used not only in Reduce and Resolve for decision problems, but also in FindInstance, whenever a single instance is requested and the system is quantifier free or contains only existential quantifiers. The algorithms discussed here are also used for inference testing by *Mathematica* functions using assumptions such as Simplify, Refine, Integrate, and so forth.

In[10]:= |

Out[10]= |

In[11]:= |

Out[11]= |

The primary method that allows *Mathematica* to solve arbitrary real polynomial decision problems is the Cylindrical Algebraic Decomposition (CAD) algorithm. There are, however, several other special case algorithms that provide much better performance in cases in which they are applicable.

When all polynomials are linear with rational number or floating-point number coefficients, *Mathematica* uses a method based on the simplex linear programming method. For other linear systems, *Mathematica* uses a variant of the Loos-Weispfenning linear quantifier elimination algorithm [15]. When the system contains no equations and only strict inequalities, a faster "generic" version of CAD is used [12, 13]. For systems containing equational constraints that generate a zero-dimensional ideal, *Mathematica* uses Gröbner bases to find a solution. For nonlinear systems with floating-point number coefficients, an inexact coefficient version of CAD [16] is used.

There are also some special case methods that can be used as preprocessors to other decision methods. When the system contains an equational constraint linear with a constant coefficient in one of the variables, the constraint is used to eliminate the linear variable. If there is a variable that appears in the system only linearly with constant coefficients, the variable is eliminated using the Loos-Weispfenning linear quantifier elimination algorithm [15]. If there is a variable that appears in the system only quadratically, the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm [22, 23] could be used to eliminate the variable. For some examples this gives a substantial speedup; however, quite often it results in a significant slowdown. By default, the algorithm is not used as a preprocessor. Setting the system option QVSPreprocessor in the group to True makes *Mathematica* use it.

There are two other special cases of real decision algorithms available in *Mathematica*. An algorithm by Aubry, Rouillier, and Safey El Din [17] applies to systems containing only equations. There are examples for which the algorithm performs much better than CAD; however, for randomly chosen systems of equations, it seems to perform significantly worse; therefore, it is not used by default. Setting the system option ARSDecision in the group to True causes *Mathematica* to use the algorithm. Another algorithm by G. X. Zeng and X. N. Zeng [18] applies to systems that consist of a single strict inequality. Again, the algorithm is faster than CAD for some examples, but slower in general; therefore, it is not used by default. Setting the system option ZengDecision in the group to True causes *Mathematica* to use the algorithm.

## Arbitrary Real Polynomial Systems

### Solving Real Polynomial Systems

According to Tarski's theorem [2], the solution set of an arbitrary (quantified) real polynomial system is a semialgebraic set. Reduce gives a description of this set in the solved form (4).

In[12]:= |

Out[12]= |

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

In[15]:= |

Out[15]= |

### Quantifier Elimination

The objective of Resolve with no variables specified is to eliminate quantifiers and produce an equivalent quantifier-free formula. The formula may or may not be in a solved form, depending on the algorithm used.

In[16]:= |

Out[16]= |

### Algorithms

The primary method used by *Mathematica* for solving real polynomial systems and real quantifier elimination is the CAD algorithm. There are, however, simpler methods applicable in special cases.

If the system contains an equational constraint in a variable from the innermost quantifier, the constraint is used to simplify the system using the identity

Note that if or is a nonzero constant, this eliminates the variable .

If all polynomials in the system are linear in a variable from the innermost quantifier, the variable is eliminated using the Loos-Weispfenning linear quantifier elimination algorithm [15].

If all polynomials in the system are at most quadratic in a variable from the innermost quantifier, the variable is eliminated using the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm [22, 23]. With the default setting of the system option QuadraticQE, the algorithm is used for Resolve with no variables specified and with at least two parameters present, and for Reduce and Resolve with at least three variables as long as elimination of one variable at most doubles the LeafCount of the system.

The CAD algorithm is used when the previous three special case methods are no longer applicable, but there are still quantifiers left to eliminate or a solution is required.

For systems containing equational constraints that generate a zero-dimensional ideal, *Mathematica* uses Gröbner bases to find the solution set.

## Options

The *Mathematica* functions for solving real polynomial systems have a number of options that control the way that they operate. This section gives a summary of these options.

option name | default value | |

Cubics | False | whether the Cardano formulas should be used to express numeric solutions of cubics |

Quartics | False | whether the Cardano formulas should be used to express numeric solutions of quartics |

WorkingPrecision | ∞ | the working precision to be used in computations |

Reduce, Resolve, and FindInstance options affecting the behavior for real polynomial systems.

### Cubics and Quartics

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

In[19]:= |

Out[19]= |

In[20]:= |

Out[20]= |

In[21]:= |

Out[21]= |

### WorkingPrecision

The setting of WorkingPrecision affects the lifting phase of the CAD algorithm. With a finite working precision prec, sample points in the first variable lifted are represented as arbitrary-precision floating-point numbers with prec digits of precision. When we compute sample points for subsequent variables, we find roots of polynomials whose coefficients depend on already computed sample point coordinates and therefore may be inexact. Hence coordinates of sample points will have precision prec or lower. Determining the sign of polynomials at sample points is simply done by evaluating Sign of the floating-point number obtained after the substitution. Using a finite WorkingPrecision may allow getting the answer faster; however, the answer may be incorrect or the computation may fail due to loss of precision.

In[22]:= |

Out[22]= |

In[23]:= |

Out[23]= |

### ReduceOptions Group of System Options

Here are the system options from the group that may affect the behavior of Reduce, Resolve, and FindInstance for real polynomial systems. The options can be set with

`SetSystemOptions["ReduceOptions"->{"option name"->value}].`

option name | default value | |

"AlgebraicNumberOutput" | True | whether Reduce should output AlgebraicNumber objects instead of polynomials in one Root object |

"FactorInequalities" | False | whether inequalities should be factored at the input preprocessing stage |

"ReorderVariables" | Automatic | whether Reduce, Resolve, and Solve are allowed to reorder the specified variables |

"UseNestedRoots" | Automatic | whether Root objects representing algebraic numbers defined by triangular systems of equations can be used in the output |

group options affecting the behavior of Reduce, Resolve, and FindInstance for real polynomial systems.

#### AlgebraicNumberOutput

For systems with equational constraints generating a zero-dimensional ideal , *Mathematica* uses a variant of the CAD algorithm that finds projection polynomials using Gröbner basis methods. If the lexicographic order Gröbner basis of contains linear polynomials with constant coefficients in every variable but the last one (which is true "generically"), then all coordinates of a solution are polynomials in one algebraic number, namely the last coordinate. The setting of determines whether Reduce represents the solution coordinates as AlgebraicNumber objects in the field generated by the last coordinate.

In[24]:= |

Out[24]= |

In[25]:= |

Out[26]= |

In[27]:= |

#### FactorInequalities

at the input preprocessing stage may speed up the computations in some cases. In general, however, it does not make the problem easier to solve, and, in some cases, it may make the problem significantly harder. By default, these transformations are not used.

In[28]:= |

Out[30]= |

In[31]:= |

Out[34]= |

In[35]:= |

#### ReorderVariables

In[36]:= |

Out[36]= |

In[37]:= |

Out[38]= |

In[39]:= |

In[40]:= |

Out[40]= |

In[41]:= |

Out[42]= |

In[43]:= |

#### UseNestedRoots

In[44]:= |

Out[44]= |

In[45]:= |

Out[46]= |

In[47]:= |

Out[48]= |

In[49]:= |

Out[50]= |

In[51]:= |

Out[52]= |

In[53]:= |

Out[54]= |

### InequalitySolvingOptions Group of System Options

Here are the system options from the group that may affect the behavior of Reduce, Resolve, FindInstance, and CylindricalDecomposition for real polynomial systems. The options can be set with

`SetSystemOptions["InequalitySolvingOptions"->{"option name"->value}].`

option name | default value | |

"ARSDecision" | False | whether to use the decision algorithm given in [17] |

"BrownProjection" | True | whether the CAD algorithm should use the improved projection operator given in [8] |

"CAD" | True | whether to use the CAD algorithm |

"CADBacksubstitution" | Automatic | whether the CAD algorithm should backsubstitute numeric values of solution coordinates |

"CADCombineCells" | True | whether the output of the CAD algorithm should be simplified by combining adjacent cells over which the solution formulas are identical |

"CADDefaultPrecision" | 30.103 | the initial precision to which nonrational roots are computed in the lifting phase of the CAD algorithm; if the computation with approximate roots cannot be validated, the algorithm raises the precision by the value of ; if this does not resolve the issue, the algorithm reverts to exact algebraic number computation |

"CADExtraPrecision" | 30.103 | the amount of extra precision to be used in the lifting phase of the CAD algorithm |

"CADMethod" | Automatic | specifies the CAD computation method used by CylindricalDecomposition |

"CADSortVariables" | True | whether the CAD algorithm should use variable reordering heuristics for quantifier variables within a single quantifier or in decision problems |

"CADZeroTest" | {0,∞} | determines the zero testing method used by the CAD algorithm for expressions obtained by evaluating polynomials at points with algebraic number coordinates |

"EquationalConstraintsCAD" | Automatic | whether the projection phase of the CAD algorithm should use equational constraints; with the default Automatic setting the operator proven correct in [11] is used; if True the unproven projection operator using multiple equational constraints suggested in [4] is used |

"FGLMBasisConversion" | False | whether the CAD algorithm should use a Gröbner basis conversion algorithm based on [20] to find univariate polynomials in zero-dimensional Gröbner bases; otherwise, is used |

"FGLMElimination" | Automatic | whether the decision and quantifier elimination algorithms for systems with equational constraints forming a zero-dimensional ideal should use an algorithm based on [20] to look for linear equation constraints (with constant leading coefficients) in one of the variables to be used for elimination |

"GenericCAD" | True | whether to use the variant of the CAD algorithm described in [13] for decision and optimization problems |

"GroebnerCAD" | True | whether the CAD algorithm for systems with equational constraints forming a zero-dimensional ideal should use Gröbner bases as projection |

"LinearDecisionMethodCrossovers" | ||

{0,30,20,Automatic} | determines methods used to find solutions of systems of linear equations and inequalities with rational number coefficients | |

"LinearEquations" | True | whether to use linear equation constraints (with constant leading coefficients) to eliminate variables in decision problems |

"LinearQE" | True | whether to use the Loos-Weispfenning linear quantifier elimination algorithm [15] for quantifier elimination problems |

"LWDecision" | True | whether to use the Loos-Weispfenning linear quantifier elimination algorithm [15] for decision problems with linear inequality systems |

"LWPreprocessor" | Automatic | whether to use the Loos-Weispfenning linear quantifier elimination algorithm [15] as a preprocessor for the decision problems |

"ProjectAlgebraic" | Automatic | whether the CAD algorithm should compute projections with respect to variables replacing algebraic number coefficients or use their minimal polynomials instead |

"ProveMultiplicities" | True | determines the way in which the lifting phase of the CAD algorithm validates multiple roots and zero leading coefficients of projection polynomials |

"QuadraticQE" | Automatic | whether to use the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm in quantifier elimination |

"QVSPreprocessor" | False | whether to use the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm as a preprocessor for the decision problems |

"ReducePowers" | Automatic | whether to replace with in the input to the CAD, where is the GCD of all exponents of in the system |

"RootReduced" | False | whether the coordinates of solutions of systems with equational constraints forming a zero-dimensional ideal should be reduced to single Root objects |

"Simplex" | True | whether to use the simplex algorithm in the decision algorithm for linear inequality systems |

"SimplifyInequalities" | Automatic | whether to use the inequality simplification heuristic presented in [25] |

"ThreadOr" | True | whether to solve each case of disjunction separately in decision problems, optimization, and in quantifier elimination of existential quantifiers when the quantifier-free system does not need to be solved |

"ZengDecision" | False | whether to use the decision algorithm given in [18] |

group options affecting the behavior of Reduce, Resolve, and FindInstance for real polynomial systems.

#### ARSDecision

*Mathematica*should use the algorithm by Aubry, Rouillier, and Safey El Din [17]. The algorithm applies to decision problems containing only equations. There are examples for which the algorithm performs much better than the CAD algorithm; however, for randomly chosen systems of equations it seems to perform significantly worse. Therefore it is not used by default. Here is a decision problem (referred to as butcher8 in the literature), which is not done by CAD in 1000 seconds, but which can be done quite fast by the algorithm given in [17].

In[55]:= |

Out[55]= |

In[56]:= |

#### BrownProjection

*Mathematica*implementation of the CAD algorithm uses Brown's improved projection operator [8]. The improvement usually speeds up computations substantially. There are some cases where using Brown's projection operator results in a slight slowdown. The option specifies whether Brown's improvement should be used. In the first example [21], using Brown's improved projection operator results in a speedup; in the second, it results in a slowdown.

In[57]:= |

Out[61]= |

In[62]:= |

In[63]:= |

Out[65]= |

In[66]:= |

#### CAD

*Mathematica*is allowed to use the CAD algorithm. With set to False, computations that require CAD will fail immediately instead of attempting the high complexity CAD computation. With CAD enabled, this computation is not done in 1000 seconds.

In[67]:= |

Out[68]= |

In[69]:= |

#### CADBacksubstitution

*Mathematica*backsubstitutes rational values of solution coordinates in the CAD algorithm. Other numeric values are not backsubstituted.

In[70]:= |

Out[70]= |

In[71]:= |

Out[71]= |

In[72]:= |

Out[73]= |

In[74]:= |

Out[74]= |

*Mathematica*does not backsubstitute coordinate values in the CAD algorithm.

In[75]:= |

Out[76]= |

In[77]:= |

Out[77]= |

In[78]:= |

#### CADCombineCells

*Mathematica*simplifies the result of the CAD algorithm by combining adjacent cells over which the solution formulas are identical. Here the solution formula for is the same for all real , even though the solution set is not connected.

In[79]:= |

Out[79]= |

In[80]:= |

Out[80]= |

*Mathematica*combines adjacent cells over which the solution formulas are identical only when the solution formulas do not contain Root functions. This guarantees that, after distributing conjunction over disjunction in the result of CylindricalDecomposition, each conjunction describes a connected set.

In[81]:= |

Out[82]= |

In[83]:= |

Out[83]= |

In[84]:= |

Out[85]= |

In[86]:= |

#### CADDefaultPrecision and CADExtraPrecision

*Mathematica*uses validated numeric computations in the lifting phase of the CAD algorithm, reverting to exact algebraic number computations only if the numeric computations cannot be validated [14, 24]. The option specifies the initial precision with which the sample point coordinates are computed. If the computations performed with this precision cannot be validated, the algorithm raises the precision by the value of . If this does not resolve the issue, the algorithm reverts to exact algebraic number computation. Choosing the values of and is a tradeoff between the speed of numeric computations and the number of points where the algorithm reverts to exact computations due to precision loss. With the default values of 100 bits, the cases where the algorithm needs to revert to exact computations due to precision loss seem quite rare. Setting to Infinity causes

*Mathematica*to use exact algebraic number computations in the lifting phase of CAD. Here is an example that runs fastest with the lowest setting. (Specifying values lower than 16.2556 (54 bits) results in being set to 16.2556.) With CADDefaultPrecision->Infinity, the example did not finish in 1000 seconds.

In[87]:= |

Out[87]= |

In[88]:= |

Out[89]= |

In[90]:= |

#### CADMethod

The setting of determines the CAD computation method used by CylindricalDecomposition. It does not affect other functions using the CAD algorithm. The default setting CADMethod->Automatic is a combination of the Direct and settings.

In[91]:= |

Out[92]= |

In[93]:= |

Out[94]= |

In[95]:= |

Out[96]= |

In[97]:= |

Out[98]= |

In[99]:= |

#### CADSortVariables

*Mathematica*uses a variable ordering heuristic to determine the order of these variables. In most cases the heuristic improves the performance of CAD; in some examples, however, the heuristic does not pick the best ordering. Setting to False disables the heuristic and the order of variables used is as given in the quantifier variable list or in the variable list argument to FindInstance. Here is an example [21] that without reordering of quantified variables does not finish in 1000 seconds.

In[100]:= |

Out[100]= |

In[101]:= |

In[102]:= |

Out[102]= |

In[103]:= |

#### CADZeroTest

The setting of this option affects the lifting phase of the CAD algorithm when sample points with exact algebraic number coordinates are used. By default *Mathematica* uses sample points with arbitrary-precision floating-point number coordinates and validates the results using the methods of [14, 24]. Sample points with exact algebraic number coordinates are used only if the results of approximate computation cannot be validated or if CADDefaultPrecision is set to Infinity.

To determine the sign of a polynomial evaluated at a sample point with algebraic number coordinates, we first evaluate the polynomial at numeric approximations of the algebraic numbers. If the result is nonzero (that is, zero is not within the error bounds of the resulting approximate number), we know the sign. Otherwise, we need to test whether a polynomial expression in algebraic numbers is zero. The value of the option specifies what zero testing method should be used at this moment. The value should be a pair . With the default value *Mathematica* computes an accuracy such that if the expression is zero up to this accuracy, it must be zero. If , the value of the expression is computed up to accuracy and its sign is checked. Otherwise, the expression is represented as a single Root object using RootReduce and the sign of the Root object is found. With the default value we revert to RootReduce if eacc>$MaxPrecision*. *If , RootReduce is always used. If , expressions that are zero up to accuracy are considered zero. This is the fastest method, but, unlike the other two, it may give incorrect results because expressions that are nonzero but close to zero may be treated as zero.

In[104]:= |

Out[105]= |

In[106]:= |

Out[107]= |

In[108]:= |

Out[110]= |

#### EquationalConstraintsCAD

The option specifies whether the projection phase of the CAD algorithm should use equational constraints. With the default setting Automatic, *Mathematica* uses the projection operator proven correct in [11]. With EquationalConstraintsCAD->True, the smaller but unproven projection operator suggested in [4] is used.

In[111]:= |

Out[112]= |

In[113]:= |

Out[114]= |

In[115]:= |

Out[116]= |

In[117]:= |

Out[118]= |

In[119]:= |

Out[120]= |

#### FGLMBasisConversion

For systems with equational constraints generating a zero-dimensional ideal , *Mathematica* uses a variant of the CAD algorithm that finds projection polynomials using Gröbner basis methods. If the lexicographic order Gröbner basis of does not contain linear polynomials with constant coefficients in every variable but the last one and UseNestedRoots is set to False, then for every variable we find a univariate polynomial in that belongs to . *Mathematica* can do this in two ways. By default, it uses a method based on computations. Setting to True causes *Mathematica* to use a method based on [20].

In[121]:= |

Out[125]= |

In[126]:= |

#### FGLMElimination

The option specifies whether *Mathematica* should use a special case heuristic applicable to systems with equational constraints generating a zero-dimensional ideal . The heuristic uses a method based on [20] to find in polynomials that are linear (with a constant coefficient) in one of the quantified variables and uses such polynomials for elimination. The method can be used both in the decision algorithm and in quantifier elimination. With the default Automatic setting, it is used only in Resolve with no "solve" variables specified and for systems with at least two free variables.

In[128]:= |

Out[128]= |

In[129]:= |

Out[130]= |

In[131]:= |

Out[132]= |

In[133]:= |

Out[134]= |

In[135]:= |

#### GenericCAD

*Mathematica* uses a simplified version of the CAD algorithm described in [13] to solve decision problems or find solutions of real polynomial systems that do not contain equations. The method finds a solution or proves that there are no solutions if all inequalities in the system are strict ( or ). The method is also used for systems containing weak ( or ) inequalities. In this case, if it finds a solution of the strict inequality version of the system, it is also a solution of the original system. However, if it proves that the strict inequality version of the system has no solutions, the full version of the CAD algorithm is needed to decide whether the original system has solutions. The system option specifies whether *Mathematica* should use the method.

In[136]:= |

Out[136]= |

In[137]:= |

Out[138]= |

In[139]:= |

*Mathematica*needs to run the full CAD to prove that there are no solutions.

In[140]:= |

Out[140]= |

In[141]:= |

Out[142]= |

In[143]:= |

In[144]:= |

Out[144]= |

In[145]:= |

Out[146]= |

In[147]:= |

#### GroebnerCAD

For systems with equational constraints generating a zero-dimensional ideal , *Mathematica* uses a variant of the CAD algorithm that finds projection polynomials using Gröbner basis methods. Setting to False, causes *Mathematica* to use the standard CAD projection instead.

In[148]:= |

Out[148]= |

In[149]:= |

In[150]:= |

Out[150]= |

In[151]:= |

Out[151]= |

In[152]:= |

#### LinearDecisionMethodCrossovers, LWDecision, and Simplex

These three options specify methods used to solve decision problems or find solution instances for systems of linear equations and inequalities. The available methods are the Loos-Weispfenning algorithm [15], the simplex algorithm, and the revised simplex algorithm. All three methods can handle systems with rational or floating-point number coefficients. For systems with exact numeric nonrational coefficients, only the Loos-Weispfenning algorithm is implemented. specifies whether the Loos-Weispfenning algorithm is available. specifies whether the simplex and revised simplex algorithms can be used. determines which method is used if all are available and applicable. The value of the option should be a triple . For linear systems with up to variables, *Mathematica* uses the Loos-Weispfenning method [15]; for systems with to variables, the simplex algorithm; and for more than variables, the revised simplex algorithm. If the simplex algorithm is used, the slack variables are used if the number of inequalities is no more than times the number of variables and either is True or is Automatic and the system is exact. The default values are , , , and s==Automatic.

In[153]:= |

Out[153]= |

In[154]:= |

Out[155]= |

In[156]:= |

Out[157]= |

In[158]:= |

In[159]:= |

Out[159]= |

In[160]:= |

Out[161]= |

In[162]:= |

#### LinearEquations

The option specifies whether linear equation constraints with constant leading coefficients should be used to eliminate variables. This generally improves the performance of the algorithm. The option is provided to allow experimentation with the "pure" CAD-based decision algorithm.

*Mathematica*uses the first equation to eliminate before using CAD to find a solution of the resulting system with two variables.

In[163]:= |

Out[163]= |

In[164]:= |

Out[165]= |

In[166]:= |

#### LinearQE

The option specifies methods used to handle systems containing at least one innermost quantifier variable that appears at most linearly in all equations and inequalities in the system. The option setting does not affect solving of decision problems. With the default setting True, *Mathematica* uses the Loos-Weispfenning algorithm [15] to eliminate all quantifier variables that appear only linearly in the system, and then if there are any quantifiers left or the result needs to be solved for the free variables, the CAD algorithm is used. With LinearQE->Automatic, the Loos-Weispfenning algorithm is used only for variables that appear in the system only linearly with constant coefficients. With LinearQE->False, the Loos-Weispfenning algorithm is not used.

In[167]:= |

Out[167]= |

In[168]:= |

Out[169]= |

In[170]:= |

Out[171]= |

In[172]:= |

Out[172]= |

In[173]:= |

Out[174]= |

In[175]:= |

Out[176]= |

In[177]:= |

Out[178]= |

In[179]:= |

Out[180]= |

#### LWPreprocessor

The option setting affects solving decision problems and instance finding. The option specifies whether the Loos-Weispfenning algorithm [8] should be used to eliminate variables that appear at most linearly in all equations and inequalities before applying the CAD algorithm to the resulting system. With the default setting Automatic, *Mathematica* uses the Loos-Weispfenning algorithm to eliminate variables that appear only linearly with constant coefficients. With LWPreprocessor->True, the Loos-Weispfenning algorithm is used for all variables that appear only linearly. With LWPreprocessor->False, the Loos-Weispfenning algorithm is not used as a preprocessor to the CAD-based decision algorithm.

In[181]:= |

Out[181]= |

In[182]:= |

Out[183]= |

In[184]:= |

Out[185]= |

In[186]:= |

Out[187]= |

In[188]:= |

Out[189]= |

In[190]:= |

Out[191]= |

In[192]:= |

#### ProjectAlgebraic

The setting of the option affects handling of algebraic number coefficients in the CAD algorithm.

Algebraic numbers found in coefficients of the input system are replaced with new variables. The new variables are always put first in the variable ordering so that in the projection phase of the CAD algorithm they are eliminated last. When the current projection polynomials contain variables with at least first variables replacing algebraic number coefficients, we have a choice of whether or not to continue the projection phase. If we do not continue the projection phase, we can start the lifting phase extending the zero-dimensional cell in the first variables on which each of the variables is equal to the corresponding algebraic number coefficient. If we choose to compute the last projections, we may find in the lifting phase that the algebraic number coefficient corresponding to a variable being lifted lies between the roots of the projection polynomials. Hence for this variable we will be extending a one-dimensional cell with a rational number sample point. Thus there is a trade-off between avoiding computation of the last projections and avoiding algebraic number coordinates in sample points.

With ProjectAlgebraic->True, the projection phase is continued for variables replacing algebraic number coefficients until there is one variable left. With ProjectAlgebraic->False, the projection phase is stopped as soon as there is one variable left that does not replace an algebraic number coefficient. With the default setting ProjectAlgebraic->Automatic, the projection phase is stopped if there is at most one variable left that does not replace an algebraic number coefficient and there are at least three projection polynomials, or there is a projection polynomial of degree more than two in the projection variable.

In[193]:= |

Out[196]= |

In[197]:= |

Out[198]= |

In[199]:= |

Out[200]= |

In[201]:= |

Out[202]= |

In[203]:= |

#### ProveMultiplicities

The setting of determines the way in which the lifting phase of the CAD algorithm validates multiple roots and zero leading coefficients of projection polynomials obtained using arbitrary-precision floating-point number (*Mathematica* "bignum") computations (for more details, see [14, 24]). With the default setting ProveMultiplicities->True, *Mathematica* uses information about the origins of the cell, if this is not sufficient computes exact values of cell coordinates and uses principal subresultant coefficients and exact zero testing, and only if this fails reverts to exact computations. With ProveMultiplicities->Automatic, *Mathematica* uses information about the origins of the cell and, if this is not sufficient, reverts to exact computation. With ProveMultiplicities->False, *Mathematica* reverts to exact computation each time bignum computations fail to separate all roots or prove that the leading coefficients of projection polynomials are nonzero.

In[204]:= |

Out[205]= |

In[206]:= |

Out[207]= |

In[208]:= |

Out[209]= |

In[210]:= |

#### QuadraticQE

The option specifies whether the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm [22, 23] should be used to eliminate quantified variables that appear at most quadratically in all equations and inequalities in the system. The complexity of Weispfenning's algorithm depends very little on the number of free variables, unlike the complexity of the CAD algorithm that is doubly exponential in the number of all variables. Hence, it is definitely advantageous to use it when all quantifiers can be eliminated using the algorithm, there are many free variables present, and the quantifier-free version of the system does not need to be given in a solved form. On the other hand, eliminating a variable using Weispfenning's algorithm often significantly increases the size of the formula. So if *Mathematica* needs to apply CAD to the result or if the system contains few free variables, using CAD on the original system may be faster. With the default setting Automatic, *Mathematica* uses the algorithm for Resolve with no variables specified and with at least two parameters present, and for Reduce and Resolve with at least three variables as long as elimination of one variable at most doubles the LeafCount of the system. This criterion seems to work reasonably well; however, for some examples it does not give the optimal choice of the algorithm. Changing the option value may allow problems to be solved which otherwise take a very long time. With QuadraticQE->True, Weispfenning's algorithm is used whenever there is a quadratic variable to eliminate, with QuardaticQE->False, Weispfenning's algorithm is not used.

In[211]:= |

Out[211]= |

In[212]:= |

Out[212]= |

In[213]:= |

Out[214]= |

In[215]:= |

Out[216]= |

In[217]:= |

Out[218]= |

In[219]:= |

Out[219]= |

In[220]:= |

Out[221]= |

In[222]:= |

#### QVSPreprocessor

The option setting affects solving decision problems and instance finding. The option specifies whether the quadratic case of Weispfenning's quantifier elimination by virtual substitution algorithm [22, 23] should be used to eliminate variables that appear at most quadratically in all equations and inequalities before applying the CAD algorithm to the resulting system. The default setting is False and the algorithm is not used. There are examples where using Weispfenning's algorithm as a preprocessor significantly helps the performance, and there are examples where using the preprocessor significantly hurts the performance. It seems that the preprocessor tends to help in examples with many variables and where instances exist. With QVSPreprocessor->True, Weispfenning's algorithm is used each time there is a quadratic variable. With QVSPreprocessor->Automatic, *Mathematica* uses the algorithm for systems with at least four variables.

*Mathematica*finds a solution using Weispfenning's algorithm as a preprocessor. Without the preprocessor, this example takes much longer.

In[223]:= |

Out[224]= |

In[225]:= |

Out[226]= |

In[227]:= |

Out[228]= |

In[229]:= |

Out[230]= |

#### ReducePowers

For any variable in the input to the CAD algorithm, if all powers of appearing in the system are integer multiples of an integer , *Mathematica* replaces in the input system with a new variable, runs the CAD on the new system, and then resolves the answer so that it is expressed in terms of the original variables. Setting ReducePowers->False turns off this shortcut. With ReducePowers->False, the algebraic functions appearing as cell bounds in the output of the CAD algorithm are always rational functions, quadratic radical expressions, or Root objects. With the default setting ReducePowers->True, they may in addition be for any of the previous expressions ,* *or Root[a#^{n}-e&, 1] for some integer , and a rational function or a quadratic radical expression .

In[231]:= |

Out[231]= |

In[232]:= |

Out[233]= |

#### RootReduced

For systems with equational constraints generating a zero-dimensional ideal , *Mathematica* uses a variant of the CAD algorithm that finds projection polynomials using Gröbner basis methods. If the lexicographic order Gröbner basis of contains linear polynomials with constant coefficients in every variable but the last one (which is true "generically"), then all coordinates of solutions are easily represented as polynomials in the last coordinate. Otherwise the coordinates are given as Root objects representing algebraic numbers defined by triangular systems of equations. Setting to True causes *Mathematica* to represent each coordinate as a single numeric Root object defined by a minimal polynomial and a root number. Computing this reduced representation often takes much longer than solving the system.

In[234]:= |

Out[234]= |

In[235]:= |

Out[235]= |

*Mathematica*to represent the value of as a single Root object. However, the computation takes more time.

In[236]:= |

Out[237]= |

In[238]:= |

In[239]:= |

Out[239]= |

*Mathematica*to represent the value of as a Root object defined by a minimal polynomial and a root number. However, the computation takes more time.

In[240]:= |

Out[241]= |

In[242]:= |

#### SimplifyInequalities

With the default setting SimplifyInequalities->Automatic, *Mathematica* uses the inequality simplification heuristic presented in [25] to simplify inputs to the CAD algorithm, deduce inequalities on CAD projection factors, and use the inequalities to recognize nonzero coefficients and subresultants in the projection phase and to eliminate cells in the lifting phase. The heuristic is also used to simplify intermediate results in the virtual substitution algorithms [15, 23]. Setting SimplifyInequalities to True makes the inequality simplification heuristic perform an additional transformation . With SimplifyInequalities->False, the inequality simplification heuristic is not used.

In[243]:= |

Out[243]= |

In[244]:= |

Out[245]= |

In[246]:= |

Out[250]= |

In[251]:= |

Out[252]= |

#### ThreadOr

The option specifies how the identity

should be used in the decision algorithm (Reduce and Resolve for systems containing no free variables or parameters), FindInstance, and quantifier elimination (Resolve with no variables specified). With the default setting ThreadOr->True, the identity (8) is used before attempting any solution algorithms. With ThreadOr->False, the identity (8) may be used by algorithms that require using it (for instance, the simplex algorithm), but will not be used by algorithms that do not require using it (for instance, the CAD algorithm).

In[253]:= |

Out[253]= |

In[254]:= |

Out[255]= |

In[256]:= |

Out[257]= |

In[258]:= |

Out[259]= |

In[260]:= |

#### ZengDecision

*Mathematica*should use the algorithm by G. X. Zeng and X. N. Zeng [18]. The algorithm applies to decision problems with systems that consist of a single strict inequality. There are examples for which the algorithm performs better than the strict inequality variant of the CAD algorithm described in [13]. However, for randomly chosen inequalities, it seems to perform worse; therefore, it is not used by default. Here is an example from [18] that runs slightly faster with ZengDecision->True.

In[261]:= |

Out[261]= |

In[262]:= |

Out[263]= |

In[264]:= |

## References

[1] Caviness B. F. and J. R. Johnson, eds. *Quantifier Elimination and Cylindrical Algebraic Decomposition: Texts and Monographs in Symbolic Computation*. Springer-Verlag (1998)

[2] Tarski A. *A Decision Method for Elementary Algebra and Geometry*. University of California Press (1951)

[3] Łojasiewicz S. *Ensembles Semi-Analytiques. *Inst. Hautes Études Sci. (1964)

[4] Collins G. E. "Quantifier Elimination for the Elementary Theory of Real Closed Fields by Cylindrical Algebraic Decomposition" *Lecture Notes in Computer Science* 33 (1975): 134-183

[5] Hong H. "An Improvement of the Projection Operator in Cylindrical Algebraic Decomposition" In* Issac *'*90: Proceedings of the International Symposium on Symbolic and Algebraic Computation* (M. Nagata, ed.), 261-264, 1990

[6] McCallum S. "An Improved Projection for Cylindrical Algebraic Decomposition of Three Dimensional Space" *J. Symb. Comput.* 5, no. 1/2 (1988): 141-161

[7] McCallum S. "An Improved Projection for Cylindrical Algebraic Decomposition" In *Quantifier Elimination and Cylindrical Algebraic Decomposition: Texts and Monographs in Symbolic Computation* (B. F. Caviness and J. R. Johnson, eds.). Springer-Verlag, 242-268, 1998

[8] Brown C. W. "Improved Projection for Cylindrical Algebraic Decomposition" *J. Symb. Comput.* 32, no. 5 (2001): 447-465

[9] Collins G. E. "Quantifier Elimination by Cylindrical Algebraic Decomposition—Twenty Years of Progress" In *Quantifier Elimination and Cylindrical Algebraic Decomposition: Texts and Monographs in Symbolic Computation* (B. F. Caviness and J. R. Johnson, eds.). Springer-Verlag, 8-23, 1998

[10] McCallum S. "On Projection in CAD-Based Quantifier Elimination with Equational Constraint" In* Issac *'*99: Proceedings of the International Symposium on Symbolic and Algebraic Computation* (Sam Dooley, ed.), 145-149, 1999

[11] McCallum S. "On Propagation of Equational Constraints in CAD-Based Quantifier Elimination" In* Issac 2001: Proceedings of the International Symposium on Symbolic and Algebraic Computation*, 223-231, 2001

[12] Strzebonski A. "An Algorithm for Systems of Strong Polynomial Inequalities" *The Mathematica Journal* 4, no. 4 (1994): 74-77

[13] Strzebonski A. "Solving Systems of Strict Polynomial Inequalities" *J. Symb. Comput.* 29, no. 3 (2000): 471-480

[14] Strzebonski A. "Cylindrical Algebraic Decomposition Using Validated Numerics" Paper presented at the ACA 2002 Session on Symbolic-Numerical Methods in Computational Science, Volos, Greece (2002) (Notebook with the conference talk available at members.wolfram.com/adams)

[15] Loos R. and V. Weispfenning. "Applying Linear Quantifier Elimination" *Comput. J.* 36, no. 5 (1993): 450-461

[16] Strzebonski A. "A Real Polynomial Decision Algorithm Using Arbitrary-Precision Floating Point Arithmetic" *Reliable Comput.* 5, no. 3 (1999): 337-346; *Developments in Reliable Computing* (Tibor Csendes, ed.). Kluwer Academic Publishers (1999): 337-346

[17] Aubry P., F. Rouillier, and M. Safey El Din. "Real Solving for Positive Dimensional Systems" *J. Symb. Comput.* 34, no. 6 (2002): 543-560

[18] Zeng G. X. and X. N. Zeng. "An Effective Decision Method for Semidefinite Polynomials" *J. Symb. Comput.* 37, no. 1 (2004): 83-99

[19] Akritas A. G. and A. Strzebonski. "A Comparative Study of Two Real Root Isolation Methods" *Nonlinear Analysis: Modelling and Control *10, no. 4 (2005): 297-304

[20] Faugere J. C., P. Gianni, D. Lazard, and T. Mora. "Efficient Computation of Zero-Dimensional Gröbner Bases by Change of Ordering" *J. Symb. Comput.* 16, no. 4 (1993): 329-344

[21] Dorato P., W. Yang, and C. Abdallah. "Robust Multi-Objective Feedback Design by Quantifier Elimination" *J. Symb. Comput.* 24, no. 2 (1997): 153-159

[22] Weispfenning V. "Quantifier Elimination for Real Algebra—The Cubic Case" In* Issac 1994: Proceedings of the International Symposium on Symbolic and Algebraic Computation*, 258-263, 1994

[23] Weispfenning V. "Quantifier Elimination for Real Algebra—The Quadratic Case and Beyond" *Appl. Algebra Eng. Commun. Comput.* 8, no. 2 (1997): 85-101

[24] Strzebonski A. "Cylindrical Algebraic Decomposition Using Validated Numerics" *J. Symb. Comput.* 41, no. 9 (2006): 1021-1038

[25] Brown C. W. and A. Strzebonski. "Black-Box/White-Box Simplification and Applications to Quantifier Elimination" In* Issac 2010: Proceedings of the International Symposium on Symbolic and Algebraic Computation* (Stephen M. Watt, ed.), 69-76, 2010

[26] Strzebonski A. "Computation with Semialgebraic Sets Represented by Cylindrical Algebraic Formulas" In* Issac 2010: Proceedings of the International Symposium on Symbolic and Algebraic Computation* (Stephen M. Watt, ed.), 61-68, 2010

[27] Strzebonski A. "Solving Polynomial Systems over Semialgebraic Sets Represented by Cylindrical Algebraic Formulas" In* Issac 2012: Proceedings of the International Symposium on Symbolic and Algebraic Computation* (Joris van der Hoeven and Mark van Hoeij, eds.), 335-342, 2012