Real Polynomial Systems
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
x inside
x
or
x
is called a bound occurrence; any other occurrence of
x is called a free occurrence. A variable
x is called a free variable of a real polynomial system if the system contains a free occurrence of
x. A real polynomial system is quantifier free if it contains no quantifiers.
An example of a real polynomial system with free variables
x,
y, and
z is the following
Any real polynomial system can be transformed to the
prenex normal form
where each
Qi is

or

, and
(x1, ..., xn;y1, ..., ym) 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
i, j 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 all of the real polynomial system solving tutorials, we will always assume the system has been transformed to this form.
Reduce can solve arbitrary real polynomial systems. For a system with free variables
x1, ..., xn, the solution (possibly after expanding

with respect to

) is a disjunction of terms of the form
where
B (xk;x1, ..., xk-1) is one of
and
r1 and
r2 are algebraic functions (expressed using
Root objects or radicals) such that for all
x1, ..., xk-1 satisfying
B (x1;)
B (x2;x1)
...
B (xk-1;x1, ..., xk-2),
r1and
r2 are well defined (that is, denominators and leading terms of
Root objects are nonzero), real valued, continuous, and satisfy inequality
r1<r2.
The subset of
n described by formula (
4) is called a
cell. The cells described by different terms of solution of a real polynomial system are disjoint.
This solves the system ( 1). The cells are represented in a nested form.
| Out[1]= |  |
|
This defines a function expanding  with respect to  . |
Here is the solution of the system ( 1) written explicitly as a union of disjoint cells.
| 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 linear 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.
This eliminates quantifiers from the system ( 1).
| 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
RandomSeed 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.
This finds a solution of the system ( 1).
| 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 quantifier-free systems is available in
Mathematica directly as
CylindricalDecomposition. There are also several other algorithms used to solve special case problems.
Cylindrical Algebraic Decomposition
Semi-Algebraic Sets and Cell Decomposition
A subset of
n is
semi-
algebraic 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 semi-algebraic.
Every semi-algebraic set can be represented as a finite union of disjoint cells [
3] defined recursively as follows:
- A cell in
is a point or an open interval
- A cell in
k has one of the two forms
where
Ck is a cell in
k,
r is a continuous algebraic function,
r1 and
r2 are continuous algebraic functions or
-
or

, and
r1<r2 on
Ck.
By an algebraic function we mean a function
r:Ck

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 semi-algebraic set in terms of polynomial equations and inequalities in the free variables. The objective of
Reduce is somewhat different. Given a semi-algebraic 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 quantifier-free 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.
This finds a cell decomposition of an annulus.
| Out[8]= |  |
|
The Projection Phase of the CAD Algorithm
Finding a cell decomposition of a semi-algebraic set using the CAD algorithm consists of two phases, projection and lifting. In the projection phase, we start with the set
An+m of factors of the polynomials present in the quantifier-free part
(x1, ..., xn;y1, ..., ym) of the system (
2) and eliminate variables one by one using a projection operator
P such that
Generally speaking, if all polynomials of
Ak have constant signs on a cell
C
k, then all polynomials of
Ak+1 are delineable over
C, that is, each has a fixed number of real roots on
C as a polynomial in
tk+1, the roots are continuous functions on
C, they have constant multiplicities, and two roots of two of the polynomials are equal either everywhere or nowhere in
C. Variables are ordered so that
This way the roots of polynomials of
A1, ..., An are the algebraic functions needed in the construction of the cell decomposition of the semi-algebraic 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 semi-algebraic 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 semi-algebraic set. Generally speaking, although the actual details depend on the projection operator used, we start with cells in
1 consisting of all distinct roots of
A1 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 semi-algebraic set (the system may contain conditions involving only
t1). Next we lift the cells to cells in
n, one dimension at a time. Suppose we have lifted the cells to
k. To lift a cell
C
k to
k+1, we find the real roots of
Ak+1 with
t1, ..., tk replaced with the coordinates of the sample point
c in
C. Since the polynomials of
Ak+1 are delineable on
C, each root
r is a value of a continuous algebraic function at
c, and the function can be represented as a
pth root of a polynomial
f
Ak+1 such that
r is the
pth root of
f (c, tk+1). Now the lifting of the cell
C to
k+1 will consist of graphs of these algebraic functions and of the slices of
C×

between the subsequent graphs. The sample points in each of the new cells will be obtained by adding the
k+1st coordinate to
c, 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 semi-algebraic set.
If
k≥n,
tk+1=yl 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
QlylQl+1yl+1... Qmym
on
C. If
Ql=
, we know that the value is
True as soon as the truth value of
Ql+1yl+1... Qmym
on one of the lifted cells is
True. If
Ql=
, we know that the value is
False as soon as the truth value of
Ql+1yl+1... Qmym
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
x1, ..., xn 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
(x1, ..., xn) has solutions.
All algorithms used by
Mathematica to solve real polynomial decision problems are capable of producing a point satisfying
(x1, ..., xn) 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.
Solving this decision problem proves that the set S={ (x, y) 2:x4+y4-2xy≤1} contains the disk of radius 4/5 centered at the origin.
| Out[9]= |  |
|
This shows that S does not contain the unit disk and provides a counterexample: a point in the unit disk that does not belong to S.
| Out[10]= |  |
|
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
InequalitySolvingOptions 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
InequalitySolvingOptions 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
InequalitySolvingOptions 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 semi-algebraic set.
Reduce gives a description of this set in the solved form (
4).
This shows for what r>0 the set S={ (x, y) 2:x4+y4-2xy≤1} contains the disk of radius r centered at the origin.
| Out[11]= |  |
|
This gives the projection of x2+y2+z2-xyz≤1 on the (x, y) plane along the z axis.
| Out[12]= |  |
|
This finds the projection of Whitney's umbrella x2-y2z=0 on the (y, z) plane along the x axis.
| Out[13]= |  |
|
Here we find the interior of the previous projection set by directly using the definition.
| Out[14]= |  |
|
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.
Producing a fully solved quantifier-free formula here is difficult because of the complexity of polynomials in a, b, and c appearing in the input. However, since x appears in the input polynomials only linearly, the quantifier can be quickly eliminated using the Loos-Weispfenning linear quantifier elimination algorithm, which depends very little on the complexity of coefficients.
| Out[15]= |  |
|
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
a or
b is a nonzero constant, this eliminates the variable
y.
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.
| | |
| 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
By default, Reduce does not use the Cardano formulas for solving cubics or quartics over the reals.
| Out[16]= |  |
|
Setting options Cubics and Quartics to True makes Reduce use the Cardano formulas to represent numeric solutions of cubics and quartics.
| Out[17]= |  |
|
Solutions of cubics and quartics involving parameters will still be represented using Root objects.
| Out[18]= |  |
|
This is because the Cardano formulas do not separate real solutions from nonreal ones. For instance, in this case, for a=-1 the third radical solution is real, but for a=1 the first radical solution is real.
| Out[19]= |  |
| Out[20]= |  |
|
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.
This problem is too hard for Reduce working in infinite WorkingPrecision, due to the high degrees of the algebraic numbers involved. Using sample points with 30 digits of precision gives a solution in under two seconds.
| Out[21]= |  |
|
ReduceOptions Group of System Options
Here are the system options from the
ReduceOptions group that may affect the behavior of
Reduce,
Resolve, and
FindInstance for real polynomial systems. The options can be set with
| | |
| "FactorInequalities" | False | whether inequalities should be factored at the input preprocessing stage |
| "ReorderVariables" | False | whether Reduce and Resolve are allowed to reorder the specified variables |
ReduceOptions group options affecting the behavior of Reduce, Resolve, and FindInstance for real polynomial systems.
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.
Here Reduce does not use transformations ( 7).
| Out[25]= |  |
|
Using transformations ( 7) speeds up the first example; however, it makes the other two examples significantly slower. The second example suffers from exponential growth of the number of inequalities. By replacing y7≥0 with y≥0 in the third example, we get a degree-21 system in y instead of a degree-3 system in y7.
| Out[28]= |  |
|
ReorderVariables
By default, Reduce is not allowed to reorder the specified variables. Variables appearing earlier in the variable list may be used to express solutions for variables appearing later in the variable list, but not vice versa.
| Out[30]= |  |
|
Setting the system option ReorderVariables->True allows Reduce to pick a variable order that makes the system easier to solve.
| Out[32]= |  |
|
InequalitySolvingOptions Group of System Options
Here are the system options from the
InequalitySolvingOptions group that may affect the behavior of
Reduce,
Resolve, and
FindInstance for real polynomial systems. The options can be set with
| | |
| "ARSDecision" | False | whether to use the decision algorithm given in [ ] |
| "BrownProjection" | True | whether the CAD algorithm should use the improved projection operator given in [ ] |
| "CAD" | True | whether to use the CAD algorithm |
| "CADDefaultPrecision" | 30.103 | the precision to which nonrational roots are computed in the lifting phase of the CAD algorithm; if computation with approximate roots cannot be validated, the algorithm reverts to exact algebraic number computation |
| "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 |
| "ContinuedFractionRootIsolation" |
| True | whether the CAD algorithm should use a real root isolation method based on continued fractions rather than on interval bisection [ ] |
| "EquationalConstraintsCAD" | Automatic | whether the projection phase of the CAD algorithm should use equational constraints; with the default Automatic setting the operator proven correct in [ ] is used; if True the unproven projection operator using multiple equational constraints suggested in [ ] is used |
| "FGLMBasisConversion" | False | whether the CAD algorithm should use a Gröbner basis conversion algorithm based on [ ] to find univariate polynomials in zero-dimensional Gröbner bases; otherwise, GroebnerWalk 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 [ ] 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 [ ] 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} | 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 [ ] for quantifier elimination problems |
| "LWDecision" | True | whether to use the Loos-Weispfenning linear quantifier elimination algorithm [ ] for decision problems with linear inequality systems |
| "LWPreprocessor" | Automatic | whether to use the Loos-Weispfenning linear quantifier elimination algorithm [ ] 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" | True | whether to replace xd with x in the input to the CAD, where d is the GCD of all exponents of x 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 |
| "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 [ ] |
InequalitySolvingOptions group options affecting the behavior of Reduce, Resolve, and FindInstance for real polynomial systems.
ARSDecision
The option ARSDecision specifies whether 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].
| Out[34]= |  |
|
BrownProjection
By default, the 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 BrownProjection specifies whether Brown's improvement should be used. In the first example [ 21], using Brown's improved projection operator results in a speedup by a factor of 3; in the second, it results in a 40% slowdown.
| Out[40]= |  |
| Out[44]= |  |
|
CAD
The option CAD specifies whether Mathematica is allowed to use the CAD algorithm. With CAD 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.
| Out[47]= |  |
|
CADDefaultPrecision
By default, 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]. The option CADDefaultPrecision specifies the initial precision with which the sample point coordinates are computed. Choosing the value of CADDefaultPrecision is a trade-off between speed of numeric computations and the number of points where the algorithm reverts to exact computations due to precision loss. With the default value of 100 bits, the cases where the algorithm needs to revert to exact computations due to precision loss seem quite rare. Setting CADDefaultPrecision 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 CADDefaultPrecision setting. (Specifying values lower than 16.2556 (54 bits) results in CADDefaultPrecision being set to 16.2556.) With CADDefaultPrecision->Infinity, the example did not finish in 1000 seconds.
| Out[49]= |  |
| Out[51]= |  |
|
CADSortVariables
The performance of the CAD algorithm often depends quite strongly on the order of variables used. Some aspects of the variable ordering are fixed by the problem we are solving: quantifier variables need to be projected before free variables, and variables from innermost quantifiers need to be projected first. Variables specified in Reduce and Resolve cannot be reordered unless ReorderVariables is set to True. This, however, still leaves some freedom in ordering of variables: variables from the same quantifier can be reordered, and so can be variables given to FindInstance. By default, 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 CADSortVariables 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.
| Out[53]= |  |
|
This shows the optimal variable ordering for the example.
| Out[55]= |  |
|
CADZeroTest
One of the most time-consuming operations in the
lifting phase of the CAD algorithm is determining the sign of a polynomial evaluated at a sample point with algebraic number coordinates. We try to avoid the problem by using sample points with arbitrary-precision floating-point number coordinates and keeping track of the "genealogy" of projection polynomials and sample points in order to validate the results. However, if some of the results cannot be validated, we have to revert to computations with exact algebraic number coordinates. 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 bignum), we know the sign. Otherwise, we need to test whether a polynomial expression in algebraic numbers is zero. The value of the
CADZeroTest option specifies what zero testing method should be used at this moment. The value should be a pair
{t, acc}. With the default value
t=0, Mathematica computes an accuracy
eacc such that if the expression is zero up to this accuracy, it must be zero. If
eacc≤acc, the value of the expression is computed up to accuracy
eacc 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
acc=
, we revert to
RootReduce if
eacc>$MaxPrecision. If
t=1,
RootReduce is always used. If
t=2, expressions that are zero up to accuracy
acc 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.
This example runs faster with the CAD algorithm using the 30 digits of accuracy numeric zero test. The result in this example is correct; however, this setting of CADZeroTest may lead to incorrect results.
| Out[60]= |  |
|
ContinuedFractionRootIsolation
To isolate real roots of polynomials,
Mathematica uses methods based on Descartes' rule of sign. There are two interval subdivision strategies implemented, one based on interval bisection and another based on continued fractions (see [
19] for details). The variant based on continued fractions is generally faster and is used by default. Setting
ContinuedFractionRootIsolation to
False causes
Mathematica to use the interval bisection variant.
Here is an example where the speed difference between the two root isolation methods affects Reduce timing. We need to clear the Root cache between the Reduce calls; otherwise, the second call would save time on factoring the 400 th degree polynomial when Root objects are created.
| Out[68]= |  |
|
EquationalConstraintsCAD
The
EquationalConstraintsCAD 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.
Here we find an instance satisfying the system using the CAD algorithm with EquationalConstraintsCAD->True. Even though the method used to find the solution was based on an unproven conjecture, the solution is proven to be correct, that is, it satisfies the input system.
| Out[71]= |  |
|
With the default setting EquationalConstraintsCAD->Automatic, finding a solution of this system takes more than twice as long.
| Out[73]= |  |
|
With EquationalConstraintsCAD->False, finding a solution of this system again takes almost twice as long.
| Out[75]= |  |
|
Here FindInstance shows that the system has no solutions. Since it is using the CAD algorithm with EquationalConstraintsCAD->True, the correctness of the answer depends on an unproven conjecture.
| Out[77]= |  |
|
With the default setting EquationalConstraintsCAD->Automatic, proving that the system has no solutions takes longer, but the answer is known to be correct.
| Out[79]= |  |
|
FGLMBasisConversion
For systems with equational constraints generating a zero-dimensional ideal
I,
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
I does not contain linear polynomials with constant coefficients in every variable but the last one, then for every variable
xi we find a univariate polynomial in
xi that belongs to
I.
Mathematica can do this in two ways. By default, it uses a method based on
GroebnerWalk computations. Setting
FGLMBasisConversion to
True causes
Mathematica to use a method based on [
20].
The method based on [ 20] seems to be slightly slower in general.
| Out[83]= |  |
|
FGLMElimination
The
FGLMElimination option specifies whether
Mathematica should use a special case heuristic applicable to systems with equational constraints generating a zero-dimensional ideal
I. The heuristic uses a method based on [
20] to find in
I 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.
This by default uses the elimination method based on [ 20], and returns a quantifier-free system in an unsolved form.
| Out[85]= |  |
|
With FGLMElimination set to False, the example takes longer to compute and the answer is in a solved form. (We show N of the answer for better readability.)
| Out[87]= |  |
|
If there is only one free variable, Resolve by default does not use the elimination method based on [ 20]. (We show N of the answer for better readability.)
| Out[89]= |  |
|
With FGLMElimination set to True, the example takes longer to compute and the answer is given in an unsolved form.
| Out[91]= |  |
|
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
GenericCAD specifies whether
Mathematica should use the method.
Here the GenericCAD method finds a solution of the strict inequality version of the system.
| Out[93]= |  |
|
Without GenericCAD, finding a solution of the system takes much longer |