Cylindrical Algebraic Decomposition - An Introduction
Cylindrical Algebraic Decomposition - An Introduction
Cylindrical Algebraic Decomposition - An Introduction
Mats Jirstrand Department of Electrical Engineering Linkoping University S-581 83 Linkoping Sweden email: matsj@isy.liu.se 1995-10-18
REGL
ERTEKNIK
AU
LINKPING
Technical reports from the Automatic Control group in Linkoping are available as UNIXcompressed Postscript les by anonymous ftp at the address 130.236.20.24 (ftp.control.ee.liu.se).
1 Introduction
The aim of this report is to describe a constructive method in real algebraic geometry to obtain a so called Cylindrical Algebraic Decomposition, (CAD) of Rn . A CAD is a decomposition of the n-dimensional real space into regions over which a given set of polynomials have constant sign. Given such a decomposition it is easy to give a solution of a system of inequalities and equations de ned by the polynomials, so called real polynomial systems. The CAD-algorithm was discovered by Collins in 1973 6] as a subalgorithm in his work on an e ective method for quanti er elimination (QE) in real closed elds. The rst algorithm for the solution of this problem was given by Tarski 1948 18] but was completely impractical. The subalgorithms of CAD has been improved over the years see e.g., 16, 14, 11] and it is now possible to run nontrivial examples on a computer with realistic runtimes. For an extensive bibliography on QE and CAD see 1]. The report is organized as follows: section 2 presents an introductory example of the use of CAD. In Section 3 and 4 we present the machinery 1
needed to understand the CAD algorithm. Section 5 is a presentation of the algorithm. In Section 6 we consider some examples and nally in Section 7 we give a summary of the report.
2 An Introductory Example
To get a feeling of what kind of problems CAD may solve we present an introductory example.
Example 2.1 Suppose we are given the following real polynomial system: x2 + x2 - 1 < 0 1 2 (1) x3 - x2 = 0 1 2
x2
For system (1) the set of solutions is very easy to nd. It consists of the part of the cuspidal cubic inside the unit circle, see Figure 1.
x1
Figure 1: The zero sets of the polynomials in system (1) and some projections onto the x1 -axis (gray dots). In this case it was easy to solve the system by inspection but is there a systematic approach which can be used for more complicated problems? The answer is yes and we will now give an outline of a procedure for nding the solution of system (1). Let f1 = x2 + x2 - 1 and f2 = x3 - x2 . The 1 2 1 2 procedure can be divided into three steps: (i) Find the projections onto the x1 -axis of all points of the zero sets of f1 and f2 corresponding to vertical tangents, singularities and intersections (gray dots). The projections of these points of system (1) 2
is
5 open intervals). (ii) Evaluate f1 and f2 over a \sample point" of each component (dot or interval). This gives 2 9 polynomials in x2 .
where 0:7549 is the real zero of x3 + x2 - 1. The projected points induce a decomposition of the x1 -axis into 9 components (4 points and
-1 0
(iii) Evaluate the signs of the obtained polynomials, i.e., evaluate the signs of f1 and f2 on a vertical line over each \sample point". Notice that a vertical line over each component intersects the zero sets of f1 and f2 a constant number of times, since the points of the x1 -axis over which the zero sets change \character" is exactly the points picked out by the projection. Enumerating the components of the decomposition from left to right Table 1 summarizes the number of intersections over each component. Component 1 2 3 4 5 6 7 8 9 # of intersections 0 1 2 3 4 2 4 3 2 Table 1: Number of intersections with (x1 x2 ) 2 R2 j f1 = 0 and f2 = 0 . To illustrate step (ii) and (iii) we just consider \sample points" of component 2 and 5, 2 = -1 (which is the only choice for this particular component) and 5 = 1 . The evaluation of f1 and f2 is summarized in Table 2. 2 real x1 f1(x1 x2) f2(x1 x2 ) #of f roots 1 f2
2 5
"
x2 2
-1 - x2 2
1 - x2 2 8
2 0 2 2
x2 - 3 2 4
+ 0 + - - + 0 - - - - - 0 + - - - 0 + 0 - - -
sign(f1 ) sign(f2 )
x2 : -1 ! +1
Table 2: Evaluation of f1 and f2 over 2 and 5 . Since f1 < 0 and f2 = 0 for a solution of system (1) Table 2 shows that there are two sets of solutions of (1) over component 5, i.e., over the interval 3
0 < x1 < which consists of parts of the zero set of f2 . We also see that
there are no solutions over component 2. The whole solution of system (1) is given by
x3 - x2 = 0 1 2 0 x1 <
(2)
where is the real zero of x3 + x2 - 1. In Figure 2 (sign(f1 (x1 x2 )) sign(f2 (x1 x2 )) along the lines x1 = -1 and 1 x1 = 2 is displayed.
x2
(+ -) (+ -) ( (- -)
0 -) 5 0) 0)
0 -)
(- -)
(-
x1
(- +) (-
(+ -)
0 -)
(+ -)
Figure 2: A part of the construction of the solution. In this example it was easy to nd the projections and evaluate the polynomials over di erent sample points. However, the general projection operation is more intricate and for the evaluation step one usually need to do calculations with algebraic numbers. In the rest of this report we will treat these problems in detail.
3 A Semi-Algebraic Dictionary
In this section we will introduce the reader to some of the basic concepts of the CAD-machinery and their geometrical interpretation. The de nitions essentially follows 2]. A very detailed description of CAD is given in 17] and some briefer presentations may be found in 9, 10]. Since one of the aims of this report is to understand algorithmic ways of treating systems of equations and inequalities, important objects to study is so called semi-algebraic sets.
f x 2 Rn j f(x) 0 g
An interesting property of semi-algebraic sets is that they are closed under projection, i.e., the projection of a semi-algebraic set to some lower dimensional space is again a semi-algebraic set. This is not true for algebraic sets, i.e., sets de ned by a system of polynomial equations (consider the unit circle). We also observe that the set of points which satis es a system of equalities and inequalities is a semi-algebraic set.
Sx1 = x 2 R2 j x2 + x4 - 1 0 _ 1 x1 2 1 1
is again a semi-algebraic set, see Figure 3. We now introduce some terminology for describing how algebraic curves and surfaces partition Rn .
x2
x1
Figure 3: A semi-algebraic set (black region) and its projection onto the x1-axis (gray region). The dashed sets are the zero sets of the de ning polynomials.
De nition 3.2 A region, R is a connected subset of Rn . The set Z(R) = R R = f ( x) j 2 R x 2 R g is called a cylinder over R. Let f f1 f2 be continuous, real-valued functions on R. A f-section of Z(R) is the set f ( f( )) j 2 R g and a (f1 f2 )-sector of Z(R) is the set f ( ) j 2 R f1( ) < < f2( ) g :
Notice that an algebraic equation implicitly de nes a set of real-valued, piecewise continuous functions. The real roots of an polynomial equation in one variable are piecewise continuous functions of its coe cients. 6
X=
Xi Xi \ Xj =
i 6= j
De nition 3.4 A stack over R is a decomposition which consists of fi -sections and (fi fi 1 )-sectors, where f0 < : : : < fk 1 for all x 2 R and f0 = -1 fk 1 = +1.
+ + +
Observe the strict inequalities in De nition 3.4. Geometrically this means that the graphs of di erent functions may not intersect each other over R. Z(R)-cylinder x3
f1-section
(f1 f2 )-sector
f2-section x2 x1 R-region
Figure 4: A geometrical interpretation of the de nitions of region, cylinder, sections, sectors and stack. 7
in nite open intervals bounded by these numbers. n > 1 D = F1 : : : Fm is a cylindrical decomposition of Rn-1 and over each Fi there is a stack which is a subset of D.
0
De nition 3.5 A decomposition D of Rn is cylindrical if n = 1 D is a partition of R1 into a nite set of numbers, and the nite and
From the de nition of a cylindrical decomposition it is clear that any cylindrical decomposition of Rn induces a cylindrical decomposition of Rn-1 etc. down to R1 .
De nition 3.6 Let X Rn and f 2 k x1 : : : xn]. Then f is invariant on X if one of the following conditions holds: (i) 8x 2 X : f(x) > 0 (ii) 8x 2 X : f(x) = 0 (iii) 8x 2 X : f(x) < 0 The set F = ff1 : : : fr g 2 R x1 : : : xn ] of polynomials is invariant on X if each fi is invariant on X. We also say that X is F -invariant if F is invariant on X. Example 3.2 Let F = fx2 + x2 - 1 (x1 - 1)2 - x2 - 1g. Then the set I 1 2 2 is F -invariant, see Figure 5. De nition 3.7 A decomposition is algebraic if each of its components is
a semi-algebraic set.
Example 3.3 Let f(x) = (x1 - 2)2 + (x2 - 2)2 - 1. Then f x j f(x) > 0 g f x j f(x) = 0 g f x j f(x) < 0 g
is an algebraic decomposition of R2 . 8
x2
x1
Figure 5: The zero set of F in Example 3.2 (dashed lines) and the F invariant set I . Notice that when the decomposition is de ned by a set of polynomials it is algebraic since all boundaries are zero sets of the de ning polynomials. decomposition which is both cylindrical and algebraic. The components of a CAD is called cells.
The CAD consists of the distinct black \dots", \arcs" and \patches of white space" in Figure 6. The induced CAD of R1 consists of the gray dots on the x1-axis and the intervals between.
x2
Example 3.4 Let F = f(x1 - 2)2 +(x2 - 2)2 - 1 (x1 - 3)2 +(x2 - 2)2 - 1g.
x1
fx 2 R2 j (x1 - 2)2 + (x2 - 2)2 - 1 > 0 ^ (x1 - 3)2 - (x2 - 2)2 - 1 < 0 ^ x1 < 3 ^ x2 < 2 g:
Which one?
4 Basic Tools
In this section we will present some theoretical tools which are important for the understanding of the di erent steps of the CAD-algorithm. These are polynomial remainder sequences, subresultants, principal subresultant coe cients, Sturm chains and representations of algebraic numbers. All concepts are treated in 17]. These are also the main tools for other constructive methods in real algebra and real algebraic geometry, see 4, 3, 12]. We start with the univariate case and then generalize the ideas to multivariate polynomials. Given two polynomials f g 2 k x]. How many common zeros do f and g have? How many distinct zeros do f have? These two questions may be answered knowing the greatest common divisor (gcd) of two polynomials. In the rest of this section k denotes a eld of characteristic zero.
Lemma 4.1 The number of common zeros of f g 2 k x] is deg(gcd(f g)) Proof. The lemma follows from the de nition of gcd and the fact that the Lemma 4.2 The number of distinct zeros of f 2 k x] is deg(f) - deg(gcd(f f )): Proof. Let f 2 k x] have l distinct zeros 1 : : : l . Then f(x) = a(x - 1 )e1 (x - l )el :
0
10
and the lemma follows. How do one calculate the gcd of two univariate polynomials? The answer is provided by the Euclidean algorithm for polynomials. By repeated polynomial division we end up with the gcd of the two original polynomials. The process may be described as
f1 f2 fp fp
2 -1
-
= q1f2 + f3 = q2f3 + f4
. ..
-
= qp 2fp 1 + fp deg(fp ) < deg(fp 1 ) = qp 1fp + 0 where fp = gcd(f1 f2 ), see 13] or 8] for a detailed treatment. The al(f1 f2 : : : fp ) is called a polynomial remainder sequence (PRS).
gorithm terminates since the degree decreases in each step. The sequence
Example 4.1 Let f1 = (1 + x)(3 + x)(1 + x + x2) and f2 = (1 + x)(2 + x)2 . The PRS of f1 f2 in expanded form is f1 (x) = 9 + 24x + 31x2 + 23x3 + 8x4 + x5 f2 (x) = 4 + 8x + 5x2 + x3 f3 (x) = 9 + 12x + 3x2 f4 (x) = 1 + x where f4 (x) = 1 + x = gcd(f1 f2 ).
We now extend the above ideas to multivariate polynomials. Let f g 2 k x1 : : : xn 1] xn], i.e., f and g is considered as polynomials in the variable xn with polynomial coe cients in the variables x1 : : : xn 1. Hence the coe cients of f and g is no longer xed numbers but depends on over which point = ( 1 : : : n 1 ) 2 Rn 1 they are evaluated. This implies that both the number of zeros and their location varies for di erent 2 Rn 1 .
-
11
Example 4.2 Let f = (x2 + x2 - 1)x2 + (x2 - 1)x3 + x2: 1 2 3 2 Consider f as a polynomial in x3 . Then degx3 (f) = 2 everywhere except on the cylinder x2 + x2 - 1 = 0. On the cylinder degx3 (f) = 1 except on the 1 2 line (x1 x2 ) = (0 1) where degx3 (f) = 0.
For some 2 Rn-1 there might be common factors of f and g but not for others, i.e., the gcd(f g) and hence its degree depends on . To calculate a gcd of two polynomials we use the Euclidean algorithm with pseudo division in each step since the polynomial coe cients no longer belongs to a eld. Here is a brief exposition of pseudo division.
Lemma 4.3 Let f g 2 k x1 : : : xn 1 ] xn], f = fp xp + : : : f0 n g = gmxm + : : : g0 n i.e., fi gj are polynomials in k x1 : : : xn 1 ] and m p. Then gs f = qg + r m where q r 2 k x1 : : : xn 1 ] xn ] are unique, s 0 and degxn (r) < m. Proof. A proof can be found in e.g., 8]. The remainder, r of the pseudo division is called the pseudo remainder of f1 and f2 and is denoted prem(f1 f2 ).
-
If we allow denominators pseudo division can be seen as Ordinary polynomial division for polynomials in xn with coe cients from the rational function eld k(x1 : : : xn-1 ), followed by Clearing denominators. The only term which needs to be inverted in the division is the leading coe cient, gm of g. Hence we get the equation gs f = qg + r. m
12
De nition 4.1 Let R be a unique factorization domain. Two polynomials in R x] are similar, denoted f(x) g(x) if there exist a b 2 R such that af(x) = bg(x).
We can now generalize the concept of polynomial remainder sequences.
De nition 4.2 Let R = k x1 : : : xn 1 ] and f1 f2 2 R xn] with degxn (f1 ) degxn (f2 ). The sequence f1 f2 : : : fk is a polynomial remainder sequence (PRS) for f1 and f2 if: (i) For all i = 3 : : : k fi prem(fi 2 fi 1 ) (ii) The sequence terminates with prem(fk 1 fk ) = 0
-
Since we only claim similarity there are in nitely many PRS to every pair f1 f2 2 k x1 : : : xn-1 ] xn ] of polynomials. Immediately one thinks of the following two sequences: Euclidean Polynomial Remainder Sequence (EPRS):
fi = prem(fi 2 fi 1) 6= 0 prem(fk 1 fk ) = 0
-
fi = pp(prem(fi 2 fi 1 )) 6= 0 prem(fk 1 fk ) = 0
-
where pp stands for primitive part, i.e. the remaining part of the polynomial when we have removed all common factors of the coe cients. We observe that a PRS is unique up to similarity since pseudo division is unique. Furthermore, gcd(f1 f2 ) : : : gcd(fk-1 fk ) fk 13
i.e., PRS essentially computes the gcd of two polynomials up to similarity. From a computational point of view both EPRS and PPRS su ers from complexity problems. EPRS has an exponential coe cient growth and the PPRS algorithm involves calculations of gcd of the coe cients, which in our case again is polynomials. However, this computational complexity is not inherent in the problem. The Subresultant Polynomial Remainder Sequence (SPRS) o ers a tradeo between coe cient growth and the cost of gcd calculations of the coe cients. We will now take a closer look at subresultants and SPRS. In this subsection we will present a way of calculating the SPRS, see e.g., 13, 15, 17]. To do this we observe that the process of pseudo division may be organized as row operations on a matrix containing the coe cients of the polynomials.
4.2 Subresultants
Example 4.3 Pseudo division applied to f = x3 + 2x2 + 3x + 1 and g = 2x2 + x + 2 gives 22f = (2x + 3)g + 5x - 2 :
One way of organizing the calculations is
1 2 3 1 M=6 2 1 2 0 7 4 5 0 2 1 2
2 1 2 07 6 0 2 1 2 5=M 4 0 0 5 -2
where M- is obtained from M by row operations. Observe the correspondence between the pseudo remainder coe cients and the last row of M- . In fact multiplying the rst row of M with 22, M- can be obtained by just subtracting integer multiples of the other rows from the rst row. Finally, permuting the rows gives the triangular form. According to the triangular structure of M- the pseudo remainder coe cients may be found, modulo a common factor, by determinant calculations on a matrix consisting of the rst two columns of M- augmented by either column three or four. Since M and M- only di ers by row operations their minors are strongly related. Hence the coe cients of a polynomial similar to the pseudo remainder may be calculated as minors of the original matrix M. In fact, 14
by calculating minors of matrices whose elements are the coe cients of two polynomials f and g we can construct a whole PRS of f and g. To see this we rst need a couple of de nitions. Throughout the rest of this subsection R is a unique factorization domain (UFD).
De nition 4.3 Let fi = Pni0 fijxj 2 R x] i = 1 : : : k. The matrix j associated with f1 : : : fk is h i mat(f1 : : : fk ) = fi l j where l = 1 + max1 i k(ni ).
= -
is
In Example 4.3 we have M = mat(f x g g), detpol(M) = 5x - 2 = prem(f g) and detpol(M- ) = 22(5x - 2).
De nition 4.5 Let f g 2 R x] and deg(f) = m deg(g) = n m n. The kth subresultant of f and g is subresk (f g) = detpol(Mk ) where Mk = mat(xn k 1 f : : : f xm k 1 g : : : g): The subresultant chain of f and g is (Sj )n 01, where j
- - + =
Sn Sn Sn S0
15
Observe that M0 is the Sylvester matrix of f and g and subres0 = detpol(M0 ) = det(M0 ) is the resultant of f and g. Furthermore, the Mk matrices is obtained by deleting rows and columns of M0 . The importance of the de nition of subresultants and subresultant chains lies in the fact that all PRS of f and g is embedded in the subresultant chain of f and g up to similarity. We illustrate the de nitions with a numerical example.
one column from the right part. Now, the subresultants is the determinant polynomials of M0 M1 and M2 , i.e.,
Example 4.4 Let f = x5 - 2x4 + 3x3 - 4x2 + 5x - 6 and g = 3x3 + 5x2 + 7x + 9. Then 2 3 1 -2 3 -4 5 -6 0 0 6 0 1 -2 3 -4 5 -6 0 7 6 7 6 6 0 7 0 1 -2 3 -4 5 -6 7 6 7 6 3 7 M0 = 6 0 5 7 9 0 0 0 0 7 6 3 5 7 9 0 0 07 6 7 6 0 0 3 5 7 9 0 07 6 7 6 4 0 5 0 0 3 5 7 9 07 0 0 0 0 3 5 7 9 2 1 -2 3 -4 5 -6 0 3 2 3 6 0 1 -2 3 -4 5 -6 7 1 -2 3 -4 5 -6 7 6 7 6 3 7 6 5 7 M1 = 6 3 5 7 9 0 0 0 7 M2 = 6 0 3 5 9 0 0 7 : 7 6 6 6 0 4 5 3 5 7 9 0 07 7 9 07 7 6 4 0 0 3 5 7 9 05 0 0 3 5 7 9 0 0 0 3 5 7 9 Observe how M1 and M2 is obtained by deleting rows and columns of M0 . The Mkl matrices are formed by the left part of the partitioned matrices and
( )
S4 = x5 - 2x4 + 3x3 - 4x2 + 5x - 6 S3 = 3x3 + 5x2 + 7x + 9 S2 = det(M24 )x2 + det(M25 )x + det(M26 ) = 263x2 - 5x + 711 S1 = det(M16 )x + det(M17 ) = -2598x - 11967 S0 = det(M0 ) = 616149 = 32 223 307
( ) ( ) ( ) ( ) ( )
16
~ where f4 = 81 f4 = 3 S1 . Notice the tremendous coe cient growth in the EPRS compared with the modest growth in the subresultant chain. In this example there is a one to one correspondence between the PRS and the subresultant chain. This is due to the fact that the degree drops by one for each pseudo division. If the degree drops with more than one some of the subresultants becomes similar. What is the connection between a polynomial in a PRS and the determinant polynomial of Mk ? By row operations on Mk a number of pseudo divisions may be carried out consecutively. The process is described by the following example which is a generalization of Example 4.3.
Compare the subresultant chain with the EPRS and PPRS for f and g: ~ f1 = x5 - 2x4 + 3x3 - 4x2 + 5x - 6 f1 = x5 - 2x4 + 3x3 - 4x2 + 5x - 6 ~ f2 = 3x3 + 5x2 + 7x + 9 f2 = 3x3 + 5x2 + 7x + 9 ~ f3 = -263x2 + 5x - 711 f3 = -263x2 + 5x - 711 ~ f4 = -70146x - 323109 f4 = -866x - 3989 ~ f5 = -38 223 2632 307 f5 = -1
Example 4.5 Let f = a5x5 + a4x4 + a3x3 + a2x2 + a1x + a0 and g = b3x3 + b2x2 + b1x + b0. The corresponding M1 matrix becomes 3 2 2 b3 b2 b1 b0 a5 a4 a3 a2 a1 a0 6 b3 b2 b1 b0 a5 a4 a3 a2 a1 a0 7 6 7 6 6 7 1 6 6 b b b b b3 b2 b1 b0 7 6 M1 = 6 3 b2 b1 b0 b 7 6 6 7 6 6 b3 b2 b1 b0 3 2 1 0 7 6 6 5 4 4 ~ ~ ~ b3 b2 b1 b0 a2 a1 a0 ~ ~ ~ b3 b2 b1 b0 a2 a1 a0 2 3 b3 b2 b1 b0 6 7 b3 b2 b1 b0 6 7 6 7 b3 b2 b1 b0 6 7=M 6 7 1 ~ 2 a1 a0 ~ ~ 6 7 a 6 7 4 ~ ~ ~ a2 a1 a0 5 ~ ~ b1 b0
( ) -
3 7 7 7 (2) 7 7 7 7 5
Row operations in detail: (1) Multiply the rst row with b3 and subtract multiplicities of row 3 4 3 and 5 to eliminate a5 a4 and a3 . A similar treatment of the second row 17
followed by interchanging rows gives the second matrix. The resulting ~ matrix elements ai are the coe cients of prem(f g). (2) The same process as in (1) repeated on row 4 5 and 6. The matrix ~ elements bi are the coe cients of prem(g prem(f g)). As pointed out earlier the only operations needed to get from Mk to the last triangular matrix, M- are row operations. It is then clear that k (l) the minors det(Mk ) and the corresponding minors of the triangular matrix only di ers by a common factor. Our original motivation for calculating PRS was to determine the gcd of two polynomials and especially its degree. Hence we are interested in the coe cient of the highest power of a gcd.
De nition 4.6 Let f g 2 R x] and deg(f) = m deg(g) = n m n. The kth principal subresultant coe cient of f and g is psck (f g) = det(Mkk ) 0 k n:
( )
In other words psck (f g) is the coe cient of xk in subresk (f g). The following lemma, which is not hard to believe in knowing the connection between a PRS and the corresponding subresultant chain, tells us that knowing the psc chain of two polynomials we know the degree of their gcd. Lemma 4.4 Let f g 2 R x] where deg(f) = m and deg(g) = n. Then for all 0 < i min(m n) f and g have a common factor of degree = i pscj (f g) = 0 j = 0 : : : i - 1 and psci (f g) 6= 0 Proof. See Corollary 7.7.9. in 17]. In this subsection we have worked with polynomials in R x] where R is a unique factorization domain (UFD). For simplicity the examples were done for polynomials over the integers but any UFD will do e.g., multivariate polynomials. In the following we use R = R x1 : : : xn-1 ], i.e., polynomials in R x1 : : : xn-1 ] xn ]. 18
()
fi(x1 : : : xn 1 xn) = fdi (x1 : : : xn 1)xdi + + f0(x1 : : : xn 1) n i i and = ( 1 : : : n 1 ) 2 Rn 1 . Then we write fi (xn ) = f( 1 : : : n 1 xn ) for the univariate polynomial obtained by substituting for the rst n - 1
-
The key idea in the so called projection phase of the CAD-algorithm is to nd regions over which the given polynomials have a constant number of real roots, cf. Example 2.1. This is formalized by the concept of delineability. Let fi 2 R x1 : : : xn-1 ] xn ] be a real polynomial in n-variables:
variables. ^i We also introduce the reductum, fki of a polynomial. Let ^i fki (x1 : : : xn-1 xn) = fki (x1 : : : xn-1)xki + + f0(x1 : : : xn-1) n i i
where 0 then
ki
De nition 4.7 Let F = ff1 f2 : : : fr g R x1 : : : xn-1 ] xn] be a set of multivariable real polynomials and C Rn-1 . We say that F is delineable on C, if it satis es the following invariant properties: (i) For every 1 i r, the total number of complex roots of fi (counting multiplicity) remains invariant as varies over C. (ii) For every 1 i r, the number of distinct complex roots of fi remains invariant as varies over C. (iii) For every 1 i < j r, the total number of common complex roots of fi and fj (counting multiplicity) remains invariant as varies over C.
Consider one of the polynomials fi 2 F . Since it has real coe cients its complex roots have to occur in conjugate pairs. Let and be two points in C Rn-1 . The only way for a pair of complex conjugated roots of fi to become real when varies to is to coalesce into a real double root, i.e. the number of distinct roots of fi drops. Hence a transition from a nonreal root to a real root is impossible over C. Similar arguments holds for the reversed problem.
0 0
19
Lemma 4.5 Let F R x1 : : : xn 1] xn] be a set of polynomials and let F be delineable over C Rn 1 . Then the total number of distinct real roots of F is invariant over C. Proof. See Lemma 8.6.3. in 17].
-
Theorem 4.1 Let F R x1 : : : xn 1] xn ] be a set of polynomials and let C Rn 1 be a connected maximal F -delineable set. Then C is semi-
algebraic.
Here we only sketch the ideas. The idea is to show that the three invariant properties of De nition 4.7 have semi-algebraic characterizations. Let pscxn i denote the ith principal resultant coe cient w.r.t. xn and Dxn denote the formal derivative operator w.r.t. xn . (i) Total number of complex roots of fi remains invariant over C. This corresponds to the claim that
(81 i r)(90 < ki di)(90 li ki - 1) h (8k > ki) fk (x1 : : : xn 1) = 0] ^ fki (x1 : : : xn 1) 6= 0 ^ i i ^i (8l < li) pscxn (fki (x1 : : : xn) Dxn (fki (x1 : : : xn ))) = 0] ^ l ^i i ^i ^i pscxin (fki (x1 : : : xn ) Dxn (fki (x1 : : : xn ))) 6= 0 l holds for all 2 C. (iii) The total number of common complex roots of fi and fj (counting multiplicity) remains invariant over C, which is characterized by
-
holds for all 2 C. (ii) The number of distinct complex roots of fi remains invariant over C, which corresponds to
(8k > ki) fk (x1 : : : xn 1) = 0] ^ fki (x1 : : : xn 1) 6= 0 ^ i i (8k > kj) fk (x1 : : : xn 1) = 0] ^ fkj (x1 : : : xn 1 ) 6= 0 ^ j j ^j (8m < mi j) pscxn (fki (x1 : : : xn) fkj (x1 : : : xn)) = 0] ^ m ^i i ^j pscxni j (fki (x1 : : : xn ) fkj (x1 : : : xn )) 6= 0] m ^i holds for all 2 C.
-
In summary, given a set of polynomials F R x1 : : : xn-1 ] xn ] we can compute another set of (n-1)-variate polynomials proj(F ) R x1 : : : xn-1 ], which characterizes the maximal connected F -delineable subsets of Rn-1 . Let then where
F = ff1 f2 : : : fr g
proj(F ) = proj1 (F )
proj2 (F )
proj3 (F )
proj1 = ffk (x1 : : : xn-1 ) j 1 i r 0 k di g i ^i proj2 = fpscxn (fk (x1 : : : xn ) Dxn (fk (x1 : : : xn ))) j l ^i
1 i r 0 l < k di - 1g
1 i < j r 0 m ki di 0 m kj djg
Suppose that the set proj(F ) is invariant over C Rn-1 . The invariance of the set proj1 (F ) implies that the degree w.r.t. xn of the polynomials is constant over C and hence the number of roots of each polynomial is constant over C (condition (i) in De nition 4.7). The invariance of proj2 (F ) implies that the gcd of each polynomial and its derivative has constant degree according to Lemma 4.4. Together with the invariance of proj1 (F ) the number of distinct zeros of each polynomial in F is constant, cf. Lemma 4.2 (condition (ii) in De nition 4.7). 21
The invariance of proj3 (F ) together with the invariance of proj1 (F ) implies that the number of common zeros of each pair of polynomials in F is constant, cf. Lemma 4.4 (condition (iii) in De nition 4.7). According to Lemma 4.5 the set proj(F ) characterize the sets over which there are a constant number of real zeros of the polynomials in F . In this subsection we will describe a method for calculating the number of distinct real zeros of a univariate polynomial using so called Sturm chains. This is important in both the so called base and extension phase of the CAD-algorithm since we then need to isolate the real roots of a number of univariate polynomials. We will also take a brief look on how one may do calculations with and represent algebraic numbers.
De nition 4.8 Let f1 : : : fr 2 R x] have the following properties with respect to the interval (a b): (i) fk (x) = 0 ) fk 1 (x)fk 1 (x) < 0 a < x < b (ii) fr (x) = 0 a < x < b 6 Then f1 : : : fr is called a Sturm chain in the interval (a b). If each poly+
Example 4.6 Let f1 2 R x]. We will now construct an important Sturm chain whose rst two elements are f1 and f1 . Let f2 = f1 and consider the following PRS: f1 = q1f2 - f3 f2 = q2f3 - f4
fr fr
2 -1
-
where fr = gcd(f1 f2 ). This sequence is a Sturm chain in (a b) by construction if fr 6= 0 in (a b) or a generalized sturm chain in (-1 1), since 22
= qr 2fr 1 - fr = qr 1fr + 0
-
.. .
f1 : : : fr may be seen as Sturm chain multiplied by the gcd of all fi . Observe the reversed sign of each remainder, which guarantees property (ii) of De nition 4.8.
=
De nition 4.9 Let (ai)r 1 be a nite sequence of real numbers. Then let i var(a1 : : : ar ) denote the number of variations in sign of the sequence. Example 4.7 var(-1 0 -2 0 0 4 3 -1) = 2 and var(3 5 0 -1 2 0 -2 1) = 4: Theorem 4.2 Let f1 : : : fr be the chain obtained in Example 4.6 and V (x) = var(f1 (x) : : : fr (x)). Then the number of distinct real zeros of f1 in (a b)1
is
V (a) - V (b)
Proof. See 9, 17]. Example 4.8 Let f1 = (x2 + x + 1)(x + 1)(x - 1)(x - 3). Then f2 = f1 = 5x4 - 8x3 - 9x2 - 2x + 2 and the Sturm chain in Example 4.6 of f1 and f2 becomes: f1 = x5 - 2 x4 - 3 x3 - x2 + 2 x + 3 f2 = 5 x4 - 8 x3 - 9 x2 - 2 x + 2 46 36 f3 = 25 x3 + 33 x2 - 25 x - 79 25 25 6825 x2 + 2625 x + 37875 f4 = - 2116 1058 2116 321632 x - 50784 f5 = - 29575 4225 2142075 f6 = - 190969
0
According to Theorem 4.2 we can calculate the number of distinct real zeros of f1 in (-2 2). We have
23
where only the signs of the evaluated Sturm chain is presented. Hence the number of real zeros of f1 in (-2 2) is 2. The total number of distinct real zeros of f1 is 3 since V (-1) = var(- + - - + -) = 4 V (1) = var(+ + + - - -) = 1:
f1(x) x
Figure 7: A plot of f1 (x). We now have a method for counting the number of distinct real zeros of a univariate polynomial in an interval. Together with a bound on the modulus of the zeros it is easy to state an algorithm which separates or isolates the real zeros of a polynomial, e.g., using some bisection method, see 9] and 17]. In the so called extension phase of the CAD-algorithm multivariate polynomials are evaluated over algebraic numbers, i.e., zeros of univariate polynomials. Then one needs both representations and algorithms for calculations with these numbers. A real algebraic number, may be represented in a number of di erent ways. Perhaps the most intuitive way is by a polynomial and an isolating interval. Usually one choose a polynomial of lowest degree which has as a zero:
than . The main tool for arithmetic operations with algebraic numbers is resultants. We will not go into details here but there are algorithms for e.g., addition, multiplication, inverse and sign evaluation of polynomials. 24
More about representation of and calculation with algebraic numbers can be found in 17, 9, 7]. There are also a library of C routines called SACLIB o ering algebraic number arithmetic, see 5].
5 The CAD-Algorithm
In this section we will describe the CAD-algorithm in detail. The algorithm can be divided into three phases: projection, base and extension. The input of the algorithm is a set, F of n-variate polynomials. The projection phase consists of a number of steps, each in which new sets of polynomials is constructed. The zero sets of the resulting polynomials of each step is the projection of \signi cant" points of the zero set of the preceding polynomials, i.e., self-crossings, isolated points, vertical tangent points etc. In each step the number of variables is decreased by one and hence the projection phase consists of n - 1 steps. The base phase consists of isolation of real roots, i 2 R1 of the monovariate polynomials, which are the outputs from the projection phase. Each root and one point in the each interval between two roots are chosen as sample points of a decomposition of R1 . The purpose of the extension phase is to construct sample points of all cells of the CAD of Rn . The extension phase consists of n - 1 steps. In the rst step a sample point, ( i j ) 2 R2 of each cell of the stack over the cells of the base phase is constructed. In the following steps the above procedure is repeated until we have sample points of all cells of the CAD of Rn . Observe that to determine if a real polynomial system has a solution, it is enough to determine the signs of F in a sample point of each cell since F is invariant on each cell by construction. The algorithm can be summarized as: Input: F = ff1 : : : fr g R x1 : : : xn ]. Output: An F -invariant CAD of Rn . Projection:
F0 = F
R x1
: : : xn] F1 R x1 : : : xn 1] : : : Fn
-
R x1 ]:
Base: Root isolation and sample point construction of a CAD of R1 . Extension: Sample point construction of CADs of Rk k = 2 : : : n. We now describe the details of each phase. 25
In the projection phase the proj-operator of Section 4 is applied recursively n - 1 times. Let F = ff1 : : : fr g, proj0 = F and proji (F ) = proj(proji-1 (F )) for 1 i n - 1. Then
: : : xn ] proj(F ) R x1 : : : xn 1 ] proj2 (F ) R x1 : : : xn 2 ]
-
R x1
.. .
projn-1 (F ) R x1 ] where the corresponding zero sets are the successive projections of the \signi cant" points of the original zero set.
Example 5.1 Consider the 3D-sphere of radius 1 centered at (2 2 2) which is given by the real zero set of f, f = (x1 - 2)2 + (x2 - 2)2 + (x3 - 2)3 - 1:
x3
1
x2
2 0 0 1 1
4 3
x1
2 3 4
Figure 8: The real zero set of f and the projections of its \signi cant" points.
26
4((x1 - 2)2 + (x2 - 2)2 - 1) (x1 - 2)2 + (x2 - 2)2 + 3 4(x1 - 1)(x1 - 3)(x2 - 4x1 + 19) 1 4 - 8x3 + 30x2 - 56 + 113) 16(x1 1 1 2 - 4x1 + 7) 4(x1 x2 - 4x1 + 11 1 256(x1 - 1)(x1 - 3) g The only real zeros of the polynomials in proj(f) correspond to the circle in the x1 x2 -plane in Figure 8 and the only real zeros of the polynomials in proj2 (f) is 1 and 3, i.e., the gray dots on the x1 -axis in Figure 8.
proj(f) = proj2 (f) = The zeros of the monovariate polynomials in projn-1 (F ) de ne a sign invariant decomposition of R1 . Enumerate the real zeros of the polynomials in projn-1 (F ) according to
-1 <
1< 2<
< s < +1
The projn-1(F )-invariant decomposition of R1 consists of these zeros and the intermediate open intervals. The purpose of the base phase is to isolate the above zeros and nd sample points for each component in the decomposition, i.e., the zeros and a sample point in each interval. For an open interval we may choose a rational sample point but for a zero we must store an exact representation of the algebraic number. There are several ways of doing this, as was discussed in Section 4. The base phase may thus be described brie y as: Input: A set of monovariate polynomials, projn-1 (F ). Output: Sample points of each component of the decomposition of R1 . Real root isolation: 1 2 (u1 v1 ] : : : s 2 (us vs ], where ui vi 2 Q . Choice of sample points: 1 = u1 2 = 1 : : : 2s+1 = vs + 1. 27
ple 5.1 we isolate the real roots of its polynomials. The number of real roots of each polynomial may be calculated using Theorem 4.2. This gives the 7 1 real roots 1 and 3 with isolating intervals ( 2 2] and (2 2 ], respectively. The x1-axis is decomposed into 5 cells with the following sample points:
Example 5.2 Given the proj2(f) set from the projection phase of Exam-
1 1 2 3 7: 2 2
In the extension phase we \lift" a sign invariant decomposition, Di-1 of Ri-1 to a sign invariant decomposition, Di of Ri using the technique of the base phase repetitively. Consider the \lift" from R1 to R2 . According to the way projn-2 (F ) is constructed it is delineabel over each cell of D1 . We will construct the sample points of those cells of D2 which belongs to the stack over the cell C D1. Evaluate the polynomials in projn-2(F ) over the sample point, of C. We then get a set of monovariate polynomials in x2 corresponding to the values of projn-2(F ) on the \vertical" line x1 = . These monovariate polynomials is then treated in the same way as the polynomials in the base phase, i.e., root isolation and choice of sample points. Hence the \lift" from R1 to R2 corresponds to the construction of the second component of the sample points of Dn . Having sample points for all cells of D2 the above process may be repeated to construct sample points of the cells of D3 : : : Dn . A geometrical picture of the steps in the extension phase consists of so to speak raising vertical lines over each sample point of the lower dimensional decomposition and calculate the intersections between these lines with the zero set of the next higher dimensional set of polynomials. The result of the extension phase is a list of cells (indexed in some way) and their sample points. Hence, the decomposition may be represented as a tree structure where the rst level of nodes under the root corresponds to the cells of R1 , the second level of nodes represents the cells of R2 , i.e., the stacks over the cells of R1 etc, see Figure 10. The leaves represents the cells of the CAD of Rn . In each node or leaf a sample point of the corresponding cell is stored. To each level of the tree there are a number of projection polynomials projk (F ) whose signs when evaluated over a sample point de nes a cell. 28
Notice that the projection polynomials projk (F ) k = 0 : : : n - 1 together with the sample points describes the set of solutions of a system of polynomial equations and inequalities. The signs of the projection polynomials gives us information about the restrictions on the solution set imposed by the original system on smaller and smaller sets of variables.
Example 5.3 We now extend the CAD of R1 from Example 5.2 to a CAD
of R2 and R3 . The base phase gives a decomposition of the x1 -axis into ve cells and a sample point of each cell, see the top left plot in Figure 9. Now, specializing the polynomials of proj(f) over each sample point gives ve univariate polynomials in x2 . For each specialized polynomial we use the same algorithms as in the base phase to construct sample points of the cells of R2 . We may choose the following sample points
1 ( 2 2) (1 1) (1 2) (1 3) 7 (2 1 ) (2 1) (2 2) (2 3) (2 2 ) 2 (3 1) (3 2) (3 3) ( 7 2): 2
In the same way we specialize f over each sample point of R2 and construct the 25 sample points of the CAD of R3 . In Figure 10 the structure of a tree representation of the CAD is given.
Observe that even for this trivial example the number of cells become quite large. In general the number of cells of a CAD grow very fast as the number of variables increase.
29
x3
1
x3
1
x2
2 0 0 1 1
4 3
x2
2
0 0 1
4 3
x1
2 3 4
x1
2 3 4
x3
1
x2
2 1
0 1
4 3
x1
2 3 4
30
proj2 (F ) proj(F )
F
Figure 10: A tree representation of the CAD.
6 Examples
Example 6.1 Given the following polynomials f1 = x2 - 2x1x2 + x4 2 1 f2 = (2431x1 - 3301)x2 - 2431x1 + 2685
determine a corresponding CAD of R2 .
3
(3)
x2
1
-2
-1
00
x1
-1
-2
Figure 11: A plot of the real zero set of the polynomials in (3).
31
Projection: proj1 (f1 ) proj1 (f2 ) proj2 (f1 ) proj2 (f2 ) proj3 (ff1 f2 g)
-x1 -4862 x1 + 5370 + 2431 x14 - 3301 x13 (17 x1 - 15) (13 x1 - 5) 26741 x14 - 38742 x13 - 8854 x12 - 51552 x1 + 96123
Base: The real roots of proj(ff1 f2 g) are
It turns out that we only need ve of these roots to determine a CAD of R2 . These are We also need sample points from each interval between the above roots, e.g., Hence the base phase produces 13 sample points. Extension: We calculate the sample points for the stack over cell 7 (x1 = 1 ) of the decomposition of R1 to illustrate the procedure. We 2 have
1 f1( 2 x2 ) = x22 - x2 + 1=16 f2( 1 x2 ) = - 4171 x2 + 2939 2 2 2
2685 0:93208 1 2431 3301 1:59982 2431 where and is the real zeros of 2431x4 - 3301x3 - 4862x1 + 5370. 1 1 5 3301 -1 0 13 15 1 2431 : 17
5 -1 0 13 15 17
9 -2 - 1 1 1 10 5 2: 2 4 2 4
respectively. Together with four points in the intermediate intervals we get seven sample points, see Table 3. 32
+ 0 0 +
+ + + 0 -
Table 3: Sample points and signs of f1 and f2 over cell 7. The information in one row of Table 3 is typically what is stored in a leaf of a tree representation of a CAD, i.e., the sample point and the signs of the polynomials. The whole CAD of R3 consists of 63 cells, see Figure 12. Given the sign of f1 and f2 in all cells we can \solve" any real polynomial system de ned by f1 and f2 .
Figure 12: The CAD, where the gray region corresponds to row ve in Table 3, i.e., f1 < 0 and f2 < 0.
33
(4)
-4
-2 0
x1
-2
x2
-4
-6
-8
Figure 13: A plot of the real zero set of the polynomials in (4).
x13 x1 - 1 - (x1 - 1) x12 + x1 + 1 -4 x12 (x1 + 1) - (x1 - 1) x16 + 4 x14 - 4 x13 - 4 x1 + 4 -x19 - 2 x17 - x16 + 2 x15 + 3 x14 - 2 x13 - 2 x12 + 1 -x12 (x1 + 1) -x19 - x18 + x16 - 2 x13 + 1 Base: The real roots of proj(ff1 f2 g) are -1 0 0:72685 0:78694 1
34
35
7 Conclusions
We have described an algorithm which takes a number of multivariate polynomials as input and produce a decomposition (CAD) of Rn as output. The decomposition has the following properties: The signs of the input polynomials is invariant on each component. It is cylindrical, i.e., a \vertical" line through an sample point, of a lower dimensional component, C intersects the same components above and below C regardless of the choice of 2 C. It is algebraic, i.e., all components may be described by a set of polynomial equations and inequalities. The decomposition may be represented as a tree structure where the leaves corresponds to the cells of a CAD of Rn . Given such a tree it is easy to answer questions such as: is this real polynomial system solvable or which constraints does it impose on a subset of the variables, i.e., elimination of variables. We may also treat logical combinations of real polynomial systems. The complexity of the CAD-algorithm is very high which is not surprising since there are a huge number of problems which may be formulated as solutions to real polynomial systems.
Acknowledgement
This work was supported by the Swedish Research Council for Engineering Sciences (TFR), which is gratefully acknowledged.
References
1] D.S. Arnon. A bibliography of quanti er elimination for real closed elds. J. Symbolic Comput., 5(1-2):267{274, Feb-Apr 1988. 2] D.S. Arnon, G.E. Collins, and S. McCallum. Cylindrical algebraic decomposition I: The basic algorithm. SIAM J. Comput., 13(4):865{877, November 1984. 3] R. Benedetti and J. Risler. Real Algebraic and Semi-Algebraic Sets. Hermann, Paris, 1990. 36
4] J. Bochnak, M. Coste, and M-F. Roy. Geometrie algebrique reelle. Springer, 1987. 5] B. Buchberger, H. Hong, R. Loos, G. Collins, J. Johnson, A. Mandache, M. Encarnacion, W. Krandick, A. Neubacher, and H. Vielhaber. Saclib 1.1 user's guide. Technical Report 93-19, RISC, Johannes Kepler University, A-4040 Linz, Austria, 1993. 6] G.E. Collins. Quanti er elimination for real closed elds by cylindrical algebraic decomposition. In Second GI Conf. Automata Theory and Formal Languages, Kaiserslauten, volume 33 of Lecture Notes Comp. Sci., pages 134{183. Springer, 1975. 7] M. Coste and M.F. Roy. Thom's lemma, the coding of real algebraic numbers and the computation of the topology of semi-algebraic sets. J. Symbolic Computation, 5:121{129, 1988. 8] D. Cox, J. Little, and D. O'Shea. Ideals, Varieties, and Algorithms: An Introduction to Computational Algebraic Geometry and Commutative Algebra. Undergraduate Texts in Mathematics. Springer, 1992. 9] J.H. Davenport, Y. Siret, and E. Tournier. Computer Algebra. Systems and Algorithms for Algebraic Computation. Academic Press, 1988. 10] J. Hollman and L. Langemyr. Algorithms for non-linear algebraic constraints. In F. Benhamou and A. Colmerauer, editors, Constraint Logic Programming. Selected Research, pages 113{131. The MIT Press, 1993. 11] H. Hong. An improvement of the projection operator in cylindrical algebraic decomposition. In Proceedings ISAAC '90, pages 261{264, 1990. 12] M. Knebusch and C. Schneiderer. Einfuhrung in die reelle Algebra. Vieweg, Braunschweig, 1989. 13] D.E. Knuth. The Art of Computer Programming. Vol. 2: Seminumerical Algorithms. Addison-Wesley, second edition, 1981. 14] D. Lazard. An improved projection for cylindrical algebraic decomposition. Technical report, Informatique, Universite Paris VI, F-75252 Paris Cedex 05, France, April 1990. 15] R. Loos. Generalized polynomial remainder sequences. In B. Buchberger, G.E. Collins, and R. Loos, editors, Computer Algebra. Symbolic 37
16] S. McCallum. An improved projection operator for cylindrical algebraic decomposition of three dimensional space. J. Symbolic Computation, 5:141{161, 1988. 17] B. Mishra. Algorithmic Algebra. Texts and Monographs in Computer Science. Springer-Verlag, 1991. 18] A. Tarski. A Decision Method for Elementary Algebra and Geometry. University of California Press, second edition, 1948.
38