Quantier elimination for real algebra - the quadratic case and beyond Volker Weispfenning Lehrstuhl fur Mathematik, Universitat Passau, D-94030 Passau, Germany, e-mail: [email protected] Abstract. We present a new, \elementary" quantier elimination method for various special cases of the general quantier elimination problem for the rst{order theory of real numbers. These include the elimination of one existential quantier 9x in front of quantier{free formulas restricted by a non-trivial quadratic equation in x (the case considered also in [7]), and more generally in front of arbitrary quantier{free formulas involving only polynomials that are quadratic in x. The method generalizes the linear quantier elimination method by virtual substitution of test terms in [9]. It yields a quantier elimination method for an arbitrary number of quantiers in certain formulas involving only linear and quadratic occurences of the quantied variables. Moreover, for existential formulas ' of this kind it yields sample answers to the query represented by '. The method is implemented in reduce as part of the redlog package (see [4, 5]). Experiments show that the method is applicable to a range of benchmark examples, where it runs in most cases signicantly faster than the qepcad package of Collins and Hong. An extension of the method to higher degree polynomials using Thom's lemma is sketched. Keywords: Fast quantier elimination and decision methods, rst{order theory of reals, automatic theorem proving. 1 Introduction Quantier elimination for the rst{order theory of real numbers is a fascinating area of research at the intersection of various eld of mathematics and computer science, such as mathematical logic, commutative algebra and algebraic geometry, computer algebra, computational geometry and complexity theory. The rst quantier elimination procedure for the elementary formal theory of real closed elds was found in the 1930's by A. Tarski, using an extension of Sturm's theorem of the 1830's for counting the number 2 V. Weispfenning of real zeros of a univariate polynomial in a given interval. Since then an abundance of new decision and quantier elimination methods for this theory with variations and optimizations has been published with the aim both of establishing the theoretical complexity of the problem and of nding methods that are of practical importance (see the discussion and references in [12, 1] for a comparsion of these methods). The high \practical complexity" of the general quantier elimination problem for the reals stimulated research concerning more specialized procedures for subproblems given by input formulas of special forms. The case of input formulas in which all quantied variables occur only linearly has been handled in [13, 9]. Elimination of a single quantied variable that is restricted by a non-trivial quadratic equation has been treated in [7]. In both cases the specialized \elementary" methods perform signicantly better than the general purpose method in [3, 6] in some test examples. Notice, however, that the theoretical worst-case complexity of the quantier elimination problem for the linear case is \the same" as for the general case up to undetermined multiplicative constants (see [12, 13]). In the present note we explore an extension of the ideas in [9] from the linear to the quadratic case. In the linear case (i.e. the case, where all quantied variables occur only linearly in the input formula) theWelimination of a quantier 9x' was achieved by replacing 9x' by a nite disjunction t2S '[t=x] ranging over certain test terms t that may formally involve improper expressions such as 1 or an \innitesimal" . The substitution '[t=x] is however dened in such a way that these improper expressions do not really occur in the resulting formula. We refer to this method as \virtual substitution" of t for x in '. In the following we extend this idea to various \quadratic cases". These include The case of a single quantied variable restricted by a non-trivial quadratic equa- tion (treated in [7] by a dierent method). The case of a single quantied variable occuring in the given input formula only at most quadratically (but not necessarily restricted by a quadratic equation). The case of several quantied variables occuring in the given input formula at most quadratically certain restrictions that guarantee that the degrees of all quantied variables never exceed 2 during successive elimination steps. This includes the case, where that all but the outermost or second to outermost of the quantied variables occur at most linearly. If by polynomial factorization these degrees can be lowered to values of at most 2, the elimination method succeeds as well. The respective cases are considered in the following three sections. We prove upper worst-case complexity bounds that match the known bounds for the general real quantier elimination problem (see [12, 1]). Moreover these bounds are independent of the number of free variables of the input formula; this is an inherent feature of the virtual substitution method. We note also that the method can be used as a partial quantier Quantier elimination for real algebra - the quadratic case and beyond 3 elimination for input formulas, where only some of the innermost quantied variables are of the type described above. The substitutions of improper expressions occuring in the linear case are extended to improper expressions containing besides 1 and a positive innitesimal also squareroot symbols; moreover these virtual substitutions are performed in arbitrary polynomials, not just linear or quadratic ones. Moreover, in contrast to [9] we avoid the use of inverses containing variables altogether, instead of eliminating inverses after quantier elimination. This has turned out to be less cumbersome in practice, since the resulting formulas are better prepared for automatic simplication. Algorithmically the virtual substitutions can be handled in a single preprocessing step for any given degree bound in the variable to be substituted. Section 5 presents examples computed in reduce using the redlog package of A. Dolzmann and T. Sturm (see [4, 5]). Where applicable comparative timings with the qepcad package are given. Our experiments include some well-known benchmark examples (compare [3, 6, 7, 8, 9, 10]), a fourth-degree example, and an example involving 5 generic quadratic polynomials and hence 15 free variables. For the latter type of input formula with many free variables elimination methods based on a cell decomposition of the whole variable space, such as the qepcad package of Collins-Hong, tend to perform badly. The last section explores the potential of the method for higher degree polynomials. The sketch given here has been worked out in detail for cubic polynomials in [15]. 2 Substitution of square-root expressions in formulas An atomic formula is an expression of the form f (x ; : : : ; xn) g(x ; : : : ; xn ), where f; g 2 Q[x ; : : : ; xn ] and is one of the relations =; ; <; 6=. Formulas are obtained from atomic formulas by means of the propositional operators ^; _; : and quantication 9xi ; 8xi over variables xi, together with appropriate use of parenthesis. The quantier elimination problem asks for an algorithm that on input of a formula ' outputs a quantier-free formula '0 (i.e. a propositional combination of atomic formulas) such that ' and '0 are equivalent in the ordered eld R of real numbers (i.e. yield the same truth value for any assignment of real numbers to unquantied variables). We are going p to describe the formal substitution of square-root expressions of the form d? (a + b c) into formulas in such a way that the surd does not actually appear in the resulting expression, i.e. such that this expression is again a formula as described above. p In the following a square-root expression will denote a string of the form d? (a + b c), where a; b; c; d 2 Q[x ; : : : ; xn ] and d 6= 0. Addition and multiplication of square-root expressions involving the same radicant is dened as usual: p p p d? (a + b c) + d0? (a0 + b0 c) = (dd0)? ((d0a + a0 d) + (d0b + b0 d) c); 1 1 1 1 1 1 1 1 1 4 V. Weispfenning p p p d? (a + b c) d0? (a0 + b0 c) = (dd0)? ((aa0 + bb0 c) + (ab0 + a0b) c): 1 1 1 p Using this denition, the substitution of a square-root expression e = d? (a + b c) for a variable xi in a polynomial f 2 Q[x ; : : : ; xn ] yields again a square-root expression f [e=xi ]: In practice this substitution is performed preferably by Horner's rule in case of a dense polynomial f or by repeated squaring in case of a sparse polynomial f . The substitution of e for xi in an atomic formula ' of the form f 0 with 2 f=; ; <; 6=g is dened as follows: p Let f [e=xi ] be of the form d? (a + b c). Note that d = dk , where k is the formula degree of f in xi . Put = 1 if k is odd and = 0 otherwise. Then in case b = 0|so that f [e=xi] = d? a |we put: 1 1 1 1 f [e=xi ] = 0 : a = 0 f [e=xi ] 0 : a d 0 f [e=xi ] < 0 : a d < 0 In the general case of an arbitrary b we put: f [e=xi ] = 0 : a b 0 ^ a ? b c = 0 2 2 f [e=xi] 0 : [a d 0 ^ 0 a ? b c)] _ [b d 0 ^ a ? b c 0] f [e=xi ] < 0 : [ad < 0 ^ 0 < a ? b c] _ [b d 0 ^ (ad < 0 _ a ? b c < 0)] f [e=xi] 6= 0 : ab > 0 _ a ? b c 6= 0: Notice that these denitions are semantically correct, i.e., the left hand side taken literally is equivalent to the right hand side provided c 0 and d 6= 0. For an arbitrary atomic formula ' : f g (with 2 f=; ; <; 6=g) the substitution '[e=xi ] is dened by (f ? g)[e=xi] 0. Finally, e is substituted for xi in an arbitrary formula ' by substituting e for xi in every atomic subformula of '. Using the substitution of square-root expressions into formulas, we can now handle quantier elimination for the case of quadratically restricted formulas that was treated dierently in [7] by an extended resultant calculus. 2 2 2 2 2 2 2 2 2 2 Theorem 2.1 Let ' be an arbitrary quantier-free formula, let x be a variable, and let f = ax + bx + c. Then under the hypothesis a = 6 0 _ b= 6 0 _ c= 6 0, the formula 0 9x(f = 0 ^ ') is equivalent to the following formula ' : (a = 0 ^ b = 6 0 ^ '[?b? c=x]) _ (a = 6 0 ^ 0 b ?4ac ^ ('[(2a)? (?b+pb ? 4ac)=x] _ '[(2a)? (?b?pb ? 4ac)=x])): 2 1 2 1 2 1 2 Quantier elimination for real algebra - the quadratic case and beyond 5 Proof. Obvious from the semantic correctness of the substitution. Let us estimate the worst-case complexity of '0: For a formula or a set of polynomials , let D() denote the maximum of 1 and the total degree of all polynomials in ; for a formula , let at() denote the number of atomic formulas in . Corollary 2.2 Let be the formula f = 0 and let k be the maximal x-degree of all polynomials in '. Then D('0) 2(k + 1)D(') ? 2k for D( ) D(') 0 D(' ) 3D( ) ? 5 for D( ) > 2; D(') = 1 D('0) 2 for D( ) = 2; D(') = 1 at('0) 11 at(') + 4 The same estimates hold if the degree D of formulas is taken with respect to a xed arbitrary set of variables including x. p Proof. Let e = ?b?1 c or e = (2a)?1(?b b2 ? 4ac); and dene the degree of a square-root as half the degree of the radicand, the degree of a rational function as the maximum of the degree of numerator and denominator. Then for a polynomial g in '; D(g[e=x]) (k + 1)D(') ? 2k, and so D('0) 2((k + 1)D(') ? 2k) = 2(k + 1)D(') ? 4k: For the remaining cases one argues similarly. p From the fact that at('[?b?1 c=x]) = at(') and at('[2a?1 (?b b2 ? 4ac)=x]) 5 at('), we may conclude that at('0) 2 + at(') + 2 + 10 at(') = 4 + 11 at('): 3 Substitution of innitesimal expressions Consider a formula 9x', where ' is quantier-free and x occurs in ' only linearly or quadratically. Then an elimination of the quantier 9x in this formula may be obtained by an extension of the technique in [9] from the linear to the quadratic case. The crucial step is to dene a formal substitution of expressions of the form e + for a variable x in a formula ', where is a symbol for a positive innitesimal, and e is a square-root expression. Semantically, such expressions are handled as follows: All variables in terms, formulas or square-root expressions are still considered to range over the eld R of real numbers. The symbol is interpreted as a positive innitesimal (i.e. 0 < < R ) in some proper ordered extension eld R of R. The properties of we are going to use are the following: Let 0 6= f (x) 2 R[x], 2 R. Then + 6 V. Weispfenning 1. f ( + ) 6= 0; 2. f () 6= 0 ) f () f ( + ) > 0 (i.e. f keeps its sign on an innitesimal neighborhood of in R); 3. 0 = f () = : : : = f k? () 6= f k () ) f k () f ( + ) > 0 (i.e. the highest non-vanishing derivative of f with respect to x at determines the sign of f at a point innitesimally to the right of in R). ( 1) ( ) These properties are immediate from the Taylor-expansion of f at evaluated at the point + in R. They guarantee that the following denition of a formal substitution of an innitesimal expression into a formula is semantically correct. Let e + be an innitesimal expression, i.e. e is a square-root expression and is a symbol for a positive innitesimal. Then the substitution '[e + =x] of e + for the variable x in an atomic formula is dened as follows: P Assume, to begin with, that ' is of the form f 0 with 2 f=; ; <; 6=g, f = ni ai xi, where the ai are polynomials that do not involve the variable x. Dene the formula (f ) recursively with respect to the formal degree n of f in x as follows: If n = 0, then (f ) : f < 0. If n > 0, then (f ) : f < 0 _ (f = 0 ^ (f 0 )). Then we put: n ^ (f = 0)[e + =x] : ai = 0 =0 i=0 (f < 0)[e + =x] : (f )[e=x] (f 0)[e + =x] : (f = 0)[e + =x] _ (f < 0)[e + =x] (f 6= 0)[e + =x] : n _ i=0 ai 6= 0: If ' is an arbitrary atomic formula of the form f g then '[e + =x] is dened by (f ? g 0)[e + =x]. Finally for an arbitrary formula ', the substitution '[e + =x] is obtained by performing the substitution [e + =x] in all atomic subformulas of '. Besides these substitutions, we also need the formal substitution of 1 for a variable x in a formula. Since the semantics of 1 is obvious (take e.g. 1 as some elements of R with ?1 < R < 1), the denition is straightforward: For f as above, dene the formula (f ) recursively with respect to n as follows: If n = 0, then (f ) : a < 0. P If n > 0, then (f ) : (?1)nan < 0 _ (an = 0 ^ ( in? aix)). 0 (f = 0)[?1=x] : n ^ i=0 1 =0 ai = 0 Quantier elimination for real algebra - the quadratic case and beyond 7 (f < 0)[?1=x] : (f ) (f 0)[?1=x] : (f < 0)[?1=x] _ (f = 0)[?1=x] (f 6= 0)[?1=x] : n _ i=0 ai 6= 0: For 1 in place of ?1 the denitions are analogous. The extension of the substitution '[1=x] to arbitrary formulas is dened similarly as before. Let now x be a variable and let ' be an ^?_-combination of atomic formulas such that x occurs in ' at most quadratically. Let f i : i 2 I g be the set of atomic subformulas of ' and let i be the relation occurring in i. Let I ; I ; I ; I be the set of those i 2 I such that i is the relation =; ; <; 6=, respectively. Suppose, moreover, that the i have been normalized with respect to x in the form ai x + bix + ci i 0. Let ei = ?b?i ci, p ei = (2ai)? (?bi + pbi ? 4ai ci), ei = (2ai)? (?bi ? bi ? 4ai ci), di = bi ? 4aici . Then an elimination of the quantier 9x in 9x(') can be obtained as follows: 1 2 3 4 2 1 0 1 2 1 2 1 2 2 Theorem 3.1 9x(') is equivalent in R to the following formula '0: _ i2I1 [I2 ((ai = 0 ^ bi 6= 0 ^ '[ei =x]) _ (ai 6= 0 ^ 0 di ^ ('[ei =x] _ '[ei =x]))) 0 _ '[?1=x] _ _ i2I3 [I4 1 2 ((ai = 0 ^ bi 6= 0 ^ '[(ei + )=x]) _ 0 (ai 6= 0 ^ 0 di ^ ('[(ei + )=x] _ '[(ei + )=x]))): Moreover, if all terms ai = 0 except for one, say aj with j 2 I [ I [ I (i.e. if the only quadratic occurrence of x is in one inequality), then 9x(') is equivalent to the following formula '00: 1 2 2 (aj = 0 ^ bj 6= 0 ^ '[ej =x]) _ 0 _ '[1=x] _ _ i2I3 [I4 ;i6=j _ i2I1 [I2 ;i6=j 3 (bi 6= 0 ^ '[ei =x]) 0 (bi 6= 0 ^ '[(ei )=x]) _ 0 (aj 6= 0 ^ '[?(2aj )? bj =x]) 1 4 8 V. Weispfenning Proof. The implication from right to left is obvious. For the converse suppose all variables in ' except x are given xed real values. Then the set M of all r 2 R such that '(r) holds in R forms a nite union of pairwise disjoint (closed, halfclosed, open, semiinnite or innite) Sintervals. Let S be set of nite endpoints of these intervals. Then S is contained in i2I fei ; ei ; ei g. Moreover, if ei 2 S , then ai = 0 and bi 6= 0, and if ei 2 S or ei 2 S then ai 6= 0 and di 0 for the corresponding discriminant di. If the interval is closed (open) at an endpoint eij (j = 0; 1; 2) then i 2 I [ I (i 2 I [ I ). Assume now that M 6= ;. Then at least one of the intervals I constituting M is nonempty. If I is unbounded from below then '[?1=x] holds in R. Otherwise let 2 R and 2 R be the lower and the upper endpoint of I . If I is closed at (i.e. 2 I ) then is of the form ei ; ei or ei for i 2 I [ I , and the corresponding side conditions hold, so that the right-hand side is true in R. If I is open at (i.e. 2= I ), then < and is of the form ei ; ei ; ei for some i 2 I [ I and the corresponding side conditions hold, so that ei + ; ei + ; ei + ; respectively, are elements of I , and so again the right hand side is true in R. In order to prove the last statement of the theorem, let M 6= ; and I be as above and assume all the disjunctive parts of '00 except possibly the last one fail. Then the endpoints of I have to be the two zeros of the polynomial t = aj x + bj x + cj . But then @t has the zero x = b (2a )? in the interval I . by Rolle's theorem @x j j Remarks. 1. Further savings in the number of terms of the form ei and ei + to be substituted in ' can be achieved in theorem 3.1 in case the sign of bi is known (either by the fact that bi is a rational constant, or by user specied information, or by structural information, as e.g. the fact that bi is a positive constant plus a sum of squares). This fact has been exploited for parametric optimization in [16]. 2. The second option in theorem 3.1 does not necessarily yield a smaller output than the rst (after suitable formula simplication). It has, however, the great advantage that it does not increase the degree of the remaining variables in the output formula. Thus it may enable an iteration of our quantier elimination method for several quantifers, where the rst option may fail (compare section 4 below). 3. Sometimes theorem 3.1 can also be applied to formulas, where the variable x to be eliminated occurs in polynomials of higher x-degrees, namely if all these polynomials factor into factors that are at most quadratic in x. In this case the input formula ' could in principle be rewritten as a formula ' that is quadratic in x. In practice this rewriting is unnecessary: It suces to compute the appropriate substitution terms from polynomials in ' and to substitute them directly in the original formula '. This device (due to T. Sturm and A. Dolzmann, see [9], section 3.6, for a similar idea) leads to smaller output formulas. 4. If the variable x to be eliminated occurs in ' only in the form xki, where 1 < k 2 N is xed, then the input formula 9x(') can be simplied to 9y('[y=xk]) in case k is odd, and to 9y(0 y ^ '[y=xk ]) in case k is even. 0 0 1 1 0 1 2 0 0 2 3 1 1 1 1 2 2 4 2 2 3 4 2 2 1 0 0 Quantier elimination for real algebra - the quadratic case and beyond 9 5. The elimination method in theorem 3.1 can be augmented by recording the substitution terms used in the various disjunctive parts of the output formula as sample (parametric) answers for the query represented by the input formula. 6. The optimizations indicated in remarks 1. - 4. and the option 5. are to a large extent realized in the redlog-package (see below). The worst-case complexity of the output '0 of theorem 3.1 can be estimated as follows: Corollary 3.2 D('0) 6D(') ? 8 for D(') 2 0 at(' ) 8at(')+ j I [ I j (4 + 11at('))+ j I [ I j (4 + 52at(')) 8at(') + at(')(8 + 63 at(')) Moreover, if x occurs only linearly in ', i.e. i is of the form bi x + ci i 0 then the 1 2 3 4 bounds can be improved to D('0) 2D(') ? 1 at('0) 5at(')+ j I1 [ I2 j (1 + at('))+ j I3 [ I4 j (1 + 5at(')) 5at(') + at(')(2 + 6at(')) For the second elimination option in theorem 3.1 the bounds are: D('0) 2D(') ? 1 at('0 ) 2 + 6at(')+ j I [ I j (1 + at('))+ j I [ I j (2 + 11at(')) 2 + 6at(') + at(')(3 + 12at(')) 1 2 3 4 The same estimates hold if the degree of formulas is taken with respect to an arbitrary set of variables including x. Proof. The upper bound von D('0) follows readily from the bound in corollary 2.2 for 0 k 2 and the fact that the substitution of an innitesimal expression in f for x can be reduced to the substitution of a square-root expression in f and its derivatives with respect to x. For the bound on at('0) we remark to begin with that for a polynomial g of x-degree k, both (g) and (g) contain k equations and k +1 strict inequalities. Hence at((g 0)[e+ =x]) (k + 1) + (2k + 1) = 3k + 2, if e is ei0 or ?1, and at[(g 0)[(e + )=x]) k + 1 + 2k + 5(k + 1) = 8k + 6, if e is ee1 or ei2 . Since k 2, this entails: at('0) j I1 [ I2 j [2 + at(') + 2 + 10at(')] + 8at(')+ j I3 [ I4 j [2 + (3k + 2)at(') + 2 + 2(8k + 6)at(')] = 8at(')+ j I1 [ I2 j [4 + 11at(')]+ j I3 [ I4 j [4 + 52at(')] 8at(') + at(')[8 + 63at(')]: 10 V. Weispfenning The bounds for the linear case and the second option in theorem 3.1 are proved similarly. 4 Eliminating several quantiers If we want to apply the elimination method described above iteratively in order to eliminate several quantiers, the applicability of the method according to theorem 2.1 or theorem 3.1 has to be checked before each single elimination step. In general the method will not work for formulas with more than one quantier, even if all quantied variables occur only quadratically, since by corollary 3.2 the rst elimination step will in general double the degree in the remaining quantied variables. Nevertheless this phenomenon does not occur in a surprisingly large number of examples (usually with a geometric background)|at least if we use the remarks following theorem 3.1. In the following, we describe a number of formula types, where a complete quantier elimination by our method can be guaranteed from the outset. Notice that the iterated elimination of variables by theorem 3.1 can be represented by a tree of depth bounded by the number of quantied variables in the input formula. Each node of this tree corresponds to one disjunct in the output formula of theorem 3.1 applied to the parent node as input formula. The most straightforward case are input formulas in which all quantied variables except one occur only linearly and in which the exceptional variable occurs quadratically. We refer to such formulas as mixed quadratic-linear formulas. For an exact description of such formulas, we group all variables into three pairwise disjoint sets: The set of parameter variables (that may not be quantied), the set fx ; : : : ; xn g of linear variables, and the set consisting of the single quadratic variable y. Atomic formulas will be expressions of the form f g, where as before is one of the relation symbols =; ; <; 6= and f,g are of the form a + a x + : : : + anxn + by + cy where ai ; b; c are polynomials in the parameter variables with rational coecients. Mixed quadratic-linear formulas are then built up from these atomic formulas by means of ^; _ and quantication over some of the variables in the set fx ; : : : ; xn; yg. Note that by our choice of relations, negations can be eliminated in formulas without increase of length. So we may assume from now on that we deal with a formula without negations. In order to eliminate all quantiers in such a formula we iterate the method of the previous section as follows: Theorem 4.1 Let ' be a prenex mixed quadratic-linear formula with quadratic variable y. Assume moreover that the quantier 9y or 8y corresponding to y is outermost or second to outermost in the prex of '. Then a quantier-free equivalent '0 to ' can be obtained by successively eliminating quantiers by the method of theorem 3.1. 1 0 1 2 1 1 Quantier elimination for real algebra - the quadratic case and beyond 11 Proof. The prex of ' is of the form Q yQ x : : : Qnxn or Q x Q yQ x : : : Qn xn; 0 1 1 1 1 0 2 2 where Qi are quantiers 9 or 8. By induction on the number of quantiers, it suces to eliminate the single innermost quantier in such a formula, provided we can show that the result of this elimination is again a mixed quadratic-linear formula of the given type. If the innermost quantier refers to a linear variable xn, this fact follows from the second degree bound in corollary 3.2, where the degree is taken w.r.t. all quantifed variables in '. Next suppose the innermost quantier is Qy, say w.l.o.g. 9y and this quantier is eliminated by the method of theorem 3.1. Then in the rst case, there is nothing more to prove. In the second case we use the rst degree bound in corollary 3.2: Replace the variable x in ' temporarily by z for a new variable z and take the degree w.r.t. y and z; then D(') = 2 and so by corollary 3.2, D('0) 4. After resubstitution of x for z , this entails that x occurs in '0 at most quadratically, which proves the claim. The worst-case complexity of the output formula '0 can be bound very roughly by applying the bounds of corollary 3.2 iteratively (n + 1)-times. These bounds conform with the recent bounds in [1] for the general real quantier elimination problem; in addition, they do not depend on the number of free variables of the input formula. 2 1 1 2 1 Corollary 4.2 Put d = 2nD(') ? 2n +1, e = 2n? D(') ? 2n? +1, d0 = max(d; 2); e0 = max(e; 2). Then in the rst case D('0) 6d0 ? 8 and in the second case D('0) 36e0 ? 56. 1 1 2 Suppose the quantiers referring to the linear variables xi following y in the prex of ' are grouped into b blocks of similar quantiers, each consisting of at most m quantiers. Assume moreover that at(') 4. Then in the rst case at('0) 65 14bm at(') in the second case we have 2 at('0 ) 65 14bm at(') 3 2 m)b (2 2 m)b (2 4 ; : Morover the elimination method is well-parallelizable (compare [1]). Proof. In the rst case the elimination of n linear quantiers yields by corollary 3.2 a degree bound d = 2nD(') ? 2n + 1. Let d0 = max(d; 2). Then the elimination of the last quantier raises this bound by corollary 3.2 to 6d0 ? 8. In the second case the elimination of n ? 1 linear quantiers yields the degree bound e = 2n? D(') ? 2n? +1. e0 1 1 With = max(e; 2) the elimination of the last two quantiers raises this bound to 36e0 ? 56. 2 12 V. Weispfenning In order to iterate the bounds on at(') of corollary 3.2, we analyse them as saying that for a linear variable x the output formula is a disjunction of at most (at(') + 1) subformulas i with at( i ) (2 + 6at(')) 7at('). So after elimination of a block of m linear existential variables (moving existential quantiers across the disjunctions) m m? we obtain an output formula '0 consisting of a disjunction of at most (2at('))m7 subformulas, each with at most 7mat(') atomic parts. So the total number of atomic formulas in '0 is at most ( 2m at(')m 7 +1 m(m+1) 2 2 1) 14m at(') m 2 2 Iterating this elimination procedure for all linear quantiers inside the rst non-linear quantier, we obtain an output formula '0 with at('0) 14bm at(') 2 m)b : (2 The subsequent elimination of the quantier for y raises the number of atomic formulas in the output by corollary 3.2 to at most 65 14bm at(') 2 m)b (2 2 : In the second case the remaining elimination of two more quantiers raises the number of atomic formulas in the output to at most 65 14bm at(') 3 2 m)b (2 4 : The last assertion follows from the fact that the elimination tree can be represented by an arithmetical network of depth polynomial in n (when all polynomials are written as distributive polynomials in x ; : : : ; xn ; y with unexpanded parametric coecients). 1 Theorem 4.1 can be extended to other classes of input formulas ': They may contain several quantiers refering to quadratic variables, say Qy : : : Qym, that occur in the prex of ' in this order (possibly interspersed with additional linear quantiers); we require, however, certain structural restrictions on ' that enable an iterated elimination of quantiers by theorem 3.1. One condition for which the method of theorem 4.1 is still valid is that the quadratic variables yi are pairwise separated, i.e. no two dierent of them occur in the same atomic subformula of '. Then the degrees of the remaining quantied variables do not increase in an elimination step. Another sucient condition is that all occurrences of y ; : : : ; ym with the possible exception of y are pure, i.e. contain no linear yi-term, since these variables can then be replaced by linear variables (compare remark 4 in section 3). Finally the yi may 1 1 1 Quantier elimination for real algebra - the quadratic case and beyond 13 even occur in higher degrees provided these degrees can be reduced by polynomial factorization to values at most 2 (compare remark 3 in section 3). 5 Examples The algorithms described above have been implemented in reduce; rst in a preliminary manner in [11] and now in a much more rened way in the redlog-package of A. Dolzmann and T. Sturm (see [4, 5]). The following examples were computed on an sun sparc 10/40 using the redlog implementation. The rst 6 examples are taken from [3, 6, 7]; an additional example shows the power of our method in case of many free variables in comparison to the qepcad package of Collins-Hong (compare [6]). A degree 4 example demonstrates the use of remark 4 in section 3. All these examples except the rst one are outside the scope of [7]. More benchmark examples are mentioned with comparative timings. All timings are in milliseconds; where possible, comparative timings (on the same workstation) are given for the qepcad package of Collins and Hong in a version kindly provided to us by H. Hong in October 1993. 5.1 Hong's Example This example is discussed in detail in [7] as an application of Hong's method of slope resultants. The input formula is ' : 9x[A = 0 ^ B = 0 ^ C 0] ; where A = ux + vx + 1; B = vx + wx + u; C = wx + vx + u 2 3 2 Under the hypothesis u 6= 0 _ v 6= 0 Hong's elimination method yields the following output formula '' (after elimination of negations): [u = 0 ^ v 6= 0 ^ RB0 = 0 ^ RC0 0] _ [u 6= 0 ^ 0 v ? 4u ^ 2 [(RB = 0 ^ TB SB 0 ^ (RC 0 _ TC 0) ^ (0 RC _ SC 0) ^(TC 0 _ SC 0)) _ (RB = 0 ^ 0 TB SB ^ (RC 0 _ TC 0) ^ (0 RC _ 0 SC ) ^ (TC 0 _ 0 SC )]; where RB0 = v u ? v w ? v; RC0 = v u ? v + w; RB = u ? wvu + u w + 3v u ? 2wvu ? v u + v w + v TB = 2u ? wvu ? v + 3v u; SB = u w + v ? vu RC = u ? v u + v u ? 2u w + wv u ? v w + w 3 5 2 3 2 4 4 2 2 2 2 2 2 4 2 2 2 4 2 3 2 2 2 3 2 2 2 14 V. Weispfenning TC = 2u ? v u + v w ? 2uw; SC = uv ? wv By comparsion, an application of theorem 2.1 yields the following output formula '00 : [u = 0 ^ v 6= 0 ^ RB0 = 0 ^ RC0 0] _ [u 6= 0 ^ 0 v ? 4u ^ f[[SB TB 0 ^ 4u RB = 0] ^ [SC 0 _ (TC 0 ^ 0 4u RC )] ^ [TC 0 _ 4u RC 0]] _ [[0 SB TB ^ 4u RB = 0] ^ [0 SC _ (TC 0 ^ 0 4u RC )] ^ [TC 0 _ 4u RC 0]]g Inspection of '0 and '00 shows that both output formulas are logically equivalent in the reals. In fact they are almost syntactically identical. The dierence is on one hand the additional non-zero factor 4u of RB and the positive factor 4u of RC occuring in '00; on the other hand there is a saving of 2 atomic formulas in '00 (20 atomic formulas) in comparison to '0 (22 atomic formulas) that is due to a simple propositional equivalence. Time: 459 ms 3 2 2 2 3 2 2 3 2 2 3 2 5.2 The Collins{Johnson Example For the origin of this example see [6]. The input formula is: ' := 9r(3a r ? a ? 2ar + 3b r ? b < 0 ^ 3a r ? 2a ? 4ar + 2a + 3b r ? 2b + r > 0 ^ a 1=2 ^ b > 0 ^ r > 0 ^ r < 1) The resulting output formula contains 26 atomic subformulas. Time: 969 ms (qepcad: 7616 ms, with output formula containing 20 atomic subformulas). 2 2 2 2 2 2 2 2 5.3 The Davenport{Heintz{ Example For the origin of this example see [3]. The input formula is ' := 9c8b8a(a = d ^ b = c _ a = c ^ b = 1 =) a = b) This is a mixed quadratic{linear example, where the applicability of our method is not obvious; but after interchanging the quantiers 8b and 8a the formula is of the type linear{quadratic{linear that was considered in section 4. The output formula is d 6= 0 ^ (d + 1 = 0 _ d ? 1 = 0) (The superous occurence of d 6= 0 can be removed automatically by an application of the Grobner simplier implemented in redlog.) Time: 102 ms (qepcad: 1733 ms, with the improved output formula). 2 Quantier elimination for real algebra - the quadratic case and beyond 15 5.4 The X {axis ellipse problem For the origin of this example see [6]. The input formula is ' := 8x8x(b (x ? c) + a y ? a b = 0 =) x + y 1) 2 2 2 2 2 2 2 2 This is a problem with two quadratic variables, where the innermost variable has only purely quadratic occurences; so it ts into one of the types considered in section 4. The output formula contains 75 atomic subformulas. Time: 4063 ms (qepcad 4455333 ms, with output formula containing 14 atomic subformulas). 5.5 Example: 5 generic quadratic polynomials This example involves 2 quadratic equations and 3 quadratic inequalities all with indeterminate coecients. So the input formula has 15 free variables and one bound variable. We were unable to compute a quantier{free formula for this example using the Collins{Hong package qepcad due to lack of memory. So the example shows the superiority of the present method in situations, where many free variables are present. The input formula is: ' := 9x(a x + b x + c = 0 ^ a x + b x + c = 0 ^ a x + b x + c < 0 ^ a x + b x + c < 0 ^ a x + b x + c < 0) 1 2 1 4 1 2 2 2 4 2 4 2 2 5 3 5 2 3 3 5 The output formula contains 408 atomic subformulas. Time: 107168 ms 5.6 Example: The Motzkin polynomial The polynomial f (x; y) = 1 + x y (x + y ? 3) found by L. Motzkin is an example of a positive semidenite polynomial on R that is not a sum of squares of real polynomials. The assertion 2 2 2 2 2 8x8y(1 + x y (x + y ? 3) 0) 2 2 2 2 that f is positive semidenite is veried by redlog via an implicit reduction of this formula (by remark 4 of section 3) to the formula 8x8y(x 0 ^ y 0 =) 1 + xy(x + y ? 3) 0); 16 V. Weispfenning where quantier elimination succeeds. Time (for the original input formula): 51 ms (qepcad: 483 ms) The following decision problems from [3] have been solved by the method via a complete quantier elimination using the implicit factorization option described in remark 3 of section 3: The collision problem: Time: 85 ms (qepcad: 633 ms). Consistency in strict inequalities: Time: 340 ms, (qepcad: 993 ms) Termination of term rewrite system: Time: 2788 ms (qepcad: 934 ms) redlog has also been able to eliminate all quantiers in the geometric examples 1. - 7. of [10] in timings comparable or smaller than those quoted for the faster CSI-option on a DEC-station 5000/25 in [10]. 6 Beyond Quadratic Polynomials Let us briey analyze which features of quadratic polynomials with parametric coecients we have used in sections 2 and 3 for our quantier elimination method: 1. The non-negativity of the discriminants provides an easy test for the existence of real roots. 2. The two real roots can be represented unambiguously by square-root expressions. 3. The sign of other polynomials with parametric coecients at a square-root expression can be evaluated without use of such an expression. Which of these properties can be lifted to arbitrary degree polynomials? Of course, representation of roots by surds is in general impossible. As far as a unique representation of real roots is concerned, there is, however, a perfect replacement by Thom's lemma (see [2]): Any real root of f (x) 2 R[x] is uniquely determined by the sign of the derivatives f 0(); : : : ; f d? (), where d = deg(f (x)). Of course, not any combination of signs is consistent, since there are at most d reals roots. Similarly, the sign of a further polynomial g(x) 2 R[x] can be found by determining the unique one among the sign conditions g(x) > 0; g(x) = 0; g(x) < 0 that is consistent with f (x) = 0 and the signs of f i (x)() (1 i < d). So in order to extend our method to a general quantier elimination procedure for the reals, one can proceed as follows: 1 ( ) Quantier elimination for real algebra - the quadratic case and beyond 17 Suppose one has already found a method to determine quantier-free equivalents '0(f )d; and 0 (f; g)d; , respectively, for the following formulas '(f )d; and (f; g)d; : '(f )d; : 9x(f (x) = 0 ^ (f; g)d; : 9x(f (x) = 0 ^ d^ ?1 i=1 d^ ?1 i=1 f i (x) i 0) ( ) f i (x) i 0 ^ g(x) d 0); ( ) where 2 f>; =; <gd? ; 2 f>; =; <gd and f; g are polynomials in x of (formal) degree d in x with indeterminate coecients, a ; : : : ; ad and b ; : : : ; bd , respectively. For xed d > 0, let us call a set f ; : : : ; k g (1 k d) of sign sequences of length (d ? 1) maximally consistent, if there exist real values of the coecients a ; : : : ; ad of f such that f has exactly k dierent real roots, say ; : : : ; k , satisfying the sign conditions ; : : : ; k , (i.e. '(f )d; ; : : : ; '(f )d;k ), respectively. The number s(d) of maximally consistent sets of sign sequences is much less than one may expect a priori, e.g. = 16; s(4) = 32; whereas a theoretical upper bound for s(d) is Pd for ds?(2)k = 6; s(3) d = O(3 ): k 3 Suppose, we have for a given degree bound (by a suitable special purpose decision procedure) determined the set S (d) of sets of maximal consistent sign-sequences. Then a general quantier elimination method based on the computation of S (d); 'd; and d; is obtained as follows: Consider w.l.o.g. an input formula 9x('), where ' is an ^{_{combination of the atomic formulas fi (x) i 0; (1 i m), and fi are polynomials of formal degree d in x with parametric coecients and i 2 f=; <g. For 1 i m and a sign-sequence of length (d ? 1), we may consider the unique real root i; of fi satisfying , provided that it exists. We may then dene { as in the quadratic case { a formal substitution of i; for x in an atomic formula g = 0 or g > 0: 1 0 0 1 0 1 1 =1 ( 1) 1 2 (g = 0)[i;=x] : 0 (f; g)d;f g (g < 0)[i;=x] : 0 (fi; g)d;f<g: = Similarly for innitesimal expressions i; + : (g = 0)[(i; + )=x] : d ^ i=0 bd = 0 (g < 0)[(i; + )=x] : 18 V. Weispfenning (g < 0)[i;=x] _ ?1 d k^ _ ( (g i = 0)[i;=x] ^ (g k < 0)[i;=x]): k=0 i=0 ( ) ( ) V The substitution of i; or i; + for x in mi fi i 0 is then performed in the obvious way. Then essentially the same proof as for theorem 3.1 yields: Theorem 6.1 Let 9x(') be the input formula above. Then 9x(') is equivalent in the reals to the following quantier-free formula '': =1 _ k _ _ [ i ;:::;k )2S (d) j =1 i=1:::m;i 2f=g '[i;j =x] _ ('[?1=x] _ ( _ i=1:::m;i 2f<g '[(i;j + )=x]): This elimination method has been carried out in detail for the cubic case in [15]. Its complexity can be bound relative to the complexity of the special purpose quantier elimination assumed in our hypothesis as follows: Let d = max(2; D(')) and let (d) = max(d; D( 0(fi; fj )d;fj g j ; 1 i; j m) (d; m) = max(d + 1; at( 0 (fi; fj )d;fj g j ; 1 i; j m) and assume (d) increases monotonically with d. Then the output formula '0 of theorem 6.1 has a degree bounded by (d); moreover it is a disjunction consisting of at most s(d)d at(')(2 + 3d at(')) disjunctive parts, each with at most (d; at(')) many atomic formulas. In particular, at('0) = (d)O(d )O(at(') )(d; at(')). 2 3 2 References [1] S. Basu, R. Pollack, M.-F. Roy, On the combinatorial and algebraic complexity of quantier elimination, preprint 1995. [2] J. Bochnak, M. Coste, M.-F. Roy, Geometrie algebrique reelle, Ergebnisse der Mathematik und ihrer Grenzgebiete, Springer Verlag, 1987. [3] G.E. Collins, H. Hong, Partial cylindrical algebraic decomposition for quantier elimination, J. Symb. Comp. 12 (1991), pp. 299-328. [4] A. Dolzmann, T. Sturm, Simplication of quantier-free formulas over ordered elds, Technical report MIP-9517, University of Passau, 1995, submitted. [5] A. Dolzmann, T. Sturm, redlog, computer algebra meets computer logic, Technical report MIP-9603, University of Passau, 1996, submitted. Quantier elimination for real algebra - the quadratic case and beyond 19 [6] H. Hong, Simple solution formula construction in cylindrical algebraic decomposition based quantier elimination, in ISSAC'92, P. S. Wang editor, ACM Press 1992, New York, pp. 177 - 188. [7] H. Hong, Quantier elimination for formulas constrained by quadratic equation, The Computer Journal 36, 5 (1993), pp. 440-449. [8] D. Lazard, Quantier elimination: Optimal solution for two classical examples, J. Symb. Comp. 5 (1988), pp. 261-266. [9] R. Loos, V. Weispfenning, Applying linear quantier elimination, The Computer Journal 36 (1993), pp. 450-462. [10] S. McCallum, Solving polynomial strict inequalities using cylindrical algebraic decomposition, The Computer Journal, 36 (1993), pp. 432-438. [11] E.{M. Nolden, Implementierung eines Quantoreneliminationsverfahrens fur quadratische Ungleichungen, Diplomarbeit, Universitat Passau, 1994. [12] J. Renegar, On the computational complexity of the rst-order theory of reals; Parts I-III, J. Symb. Comp. 13 (1992), pp. 255-352. [13] V. Weispfenning, The complexity of linear problems in elds, J. Symb. Comp. 5 (1988), pp. 3-27. [14] V. Weispfenning, A new approach to quantier elimination for real algebra, Proc. Collins Symposium Linz Oct. 1993, to appear. [15] V. Weispfenning, Quantier elimination for real algebra { the cubic case, in J. von zur Gathen, M. Giesbrecht Eds., Proceedings ISSAC 94, Oxford 1994, ACM Press, New York, pp. 258 - 263. [16] V. Weispfenning, Parametric linear and quadratic optimization by elimination, J. Symb. Comp., to appear.
© Copyright 2025 Paperzz