    We present an algorithm for computation of cell adjacencies for well-based cylindrical algebraic decomposition. Cell adjacency information can be used to compute topological operations e.g. closure, boundary, connected components, and topological properties e.g. homology groups. Other applications include visualization and path planning. Our algorithm determines cell adjacency information using validated numerical methods similar to those used in CAD construction, thus computing CAD with adjacency information in time comparable to that of computing CAD without adjacency information. We report on implementation of the algorithm and present empirical data.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1. Introduction

A semialgebraic set is a subset of which is a solution set of a system of polynomial equations and inequalities. Computation with semialgebraic sets is one of the core subjects in computer algebra and real algebraic geometry. A variety of algorithms have been developed for real system solving, satisfiability checking, quantifier elimination, optimization and other basic problems concerning semialgebraic sets [7, 3, 5, 9, 10, 11, 13, 19, 24, 25]. Every semialgebraic set can be represented as a finite union of disjoint cells bounded by graphs of semialgebraic functions. The Cylindrical Algebraic Decomposition (CAD) algorithm [7, 5, 21] can be used to compute a cell decomposition of any semialgebraic set presented by a quantified system of polynomial equations and inequalities. Alternative methods of computing cell decompositions are given in [6, 22, 23]. For solving certain problems, for instance computing topological properties or visualization, it is not sufficient to know a cell decomposition of the set, but it is also necessary to know how the cells are connected together.

###### Example 1.

The CAD algorithm applied to the equation gives four one-dimensional cells and three zero-dimensional cells shown in Figure 1.1. To find the connected components of the solution set it is sufficient to know which one-dimensional cells are adjacent to which zero-dimensional cells.

In this paper we present a new algorithm which computes cell adjacencies for well-based CAD. The algorithm uses validated numerical methods similar to those used in  for construction of CAD cell sample points. The method is based on computation of approximations of polynomial roots and increasing the precision of computations until validation criteria are satisfied. Unlike the previously known algorithms, it does not require polynomial computations over algebraic number fields or computation with fractional power series representations of polynomial roots. Also, unlike the CAD construction algorithm given in , the algorithm never needs to revert to exact algebraic number computations. We have implemented the algorithm as an extension to the CAD implementation in Mathematica. Empirical results show that computation of CAD with cell adjacency data takes time comparable to computation of CAD without cell adjacency data.

The general idea of the algorithm is as follows. It starts, similarly as the CAD algorithm, with computing a sample point in each cell in for all . The sample point of a cell in extends the sample point of the projection of the cell on . Then for each pair of adjacent CAD cells and in with the algorithm constructs a point that is “sufficiently close” to the sample point of . Here “sufficiently close” means that computing approximations of roots of projection polynomials at and is sufficient to identify which roots over tend to which roots over and to continue the construction to pairs of adjacent CAD cells in . The construction gives all pairs of adjacent cells in whose dimensions differ by one. For well-based CAD this is sufficient to determine all cell adjacencies.

## 2. Preliminaries

A system of polynomial equations and inequalities in variables is a formula

 S(x1,…,xn)=⋁1≤i≤l⋀1≤j≤mifi,j(x1,…,xn)ρi,j0

where , and each is one of or .

A subset of is semialgebraic if it is a solution set of a system of polynomial equations and inequalities.

A quantified system of real polynomial equations and inequalities in free variables and quantified variables is a formula

 (2.1) Q1xm+1…Qn−mxnS(x1,…,xn)

Where is or , and is a system of real polynomial equations and inequalities in .

By Tarski’s theorem (see ), solution sets of quantified systems of real polynomial equations and inequalities are semialgebraic.

###### Notation 2.

For , let denote a -tuple of real numbers and let denote a -tuple of variables.

Every semialgebraic set can be represented as a finite union of disjoint cells (see ), defined recursively as follows.

1. A cell in is a point or an open interval.

2. A cell in has one of the two forms

 {(¯¯¯a,ak+1):¯¯¯a∈Ck∧ak+1=r(¯¯¯a)} {(¯¯¯a,ak+1):¯¯¯a∈Ck∧r1(¯¯¯a)

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

For a cell let , for , denote the projection of on . A finite collection of cells in is cylindrically arranged if for any and any and are either disjoint or identical.

A cylindrical algebraic decomposition (CAD) of is a finite collection of pairwise disjoint cylindrically arranged cells in such that .

Let be a finite set of polynomials. A CAD of is P-invariant if each element of has a constant sign on each cell of .

Let be a semialgebraic set. A CAD of is consistent with if for some .

Let . and are adjacent if and is connected.

For a semialgebraic set presented by a quantified system of polynomial equations and inequalities (2.1), the CAD algorithm can be used to find a CAD of consistent with . The CAD is represented by a cylindrical algebraic formula (CAF). A CAF describes each cell by giving explicit semialgebraic function bounds and the Boolean structure of a CAF reflects the cylindrical arrangement of cells. Before we give a formal definition of a CAF, let us first introduce some terminology.

Let and let , where . A semialgebraic function given by the defining polynomial and a root number is the function

 (2.2) Rooty,λf:Rk∋¯¯¯a⟶Rooty,λf(¯¯¯a)∈R

where is the -th real root of . The function is defined for those values of for which has at least real roots. The real roots are ordered by the increasing value and counted with multiplicities. A real algebraic number given by a defining polynomial and a root number is the -th real root of .

Let be a connected subset of . The function is regular on if it is continuous on , for all , and there exists such that for any is a root of of multiplicity .

The polynomial is degree-invariant on if there exists such that for all .

A set of polynomials is delineable on if all elements of are degree-invariant on and for

 f−1i(0)∩(C×R)={ri,1,…,ri,li}

where are disjoint regular semialgebraic functions and for and are either disjoint or equal. Functions are root functions of over .

Let be delineable on , let be all root functions of elements of over , and let and . For , the -th -section over is the set

 {(¯¯¯a,ak+1):¯¯¯a∈C∧ak+1=ri(¯¯¯a)}

For , the -th -sector over is the set

 {(¯¯¯a,ak+1):¯¯¯a∈C∧ri−1(¯¯¯a)

-stack over is the set of all -sections and -sectors over .

A formula is an algebraic constraint with bounds if it is a level- equational or inequality constraint with defined as follows.

1. A level- equational constraint has the form , where is a real algebraic number, and .

2. A level- inequality constraint has the form , where and are real algebraic numbers, , or , and .

3. A level- equational constraint has the form , where is a semialgebraic function, and .

4. A level- inequality constraint has the form , where and are semialgebraic functions, , or , and .

A level- algebraic constraint is regular on a connected set if all elements of are regular on and, if is an inequality constraint, on .

###### Definition 3.

An atomic cylindrical algebraic formula (CAF) in has the form , where is a level- algebraic constraint for and is regular on the solution set of for .

Level- cylindrical formulas in are defined recursively as follows

1. A level- cylindrical formula is or a disjunction of level- algebraic constraints.

2. A level- cylindrical formula, with , is or has the form

 (F1∧G1)∨…∨(Fm∧Gm)

where are level- algebraic constraints and are level- cylindrical formulas.

A cylindrical algebraic formula (CAF) is a level- cylindrical formula such that distributing conjunction over disjunction in gives

 DNF(F)=F1∨…∨Fl

where each is an atomic CAF. Let denote the solution set of and let . The bound polynomials of is a finite set which consists of all polynomials such that for some and a level- algebraic constraint that appears in .

Note that is a cell and is a finite collection of pairwise disjoint cylindrically arranged cells.

For a CAF in , let denote the CAF in obtained from by removing all level- subformulas. Then

 D(Πk(F))={Πk(C):C∈D(F)}

Following the terminology of , we define a well-based CAF as follows.

###### Definition 4.

A CAF is well-based if is a -invariant CAD of and for any if then for any is not identically zero.

In a CAD corresponding to a well-based CAF a closure of a cell is a union of cells and the only cells from other stacks adjacent to a given section are sections defined by the same polynomial. Moreover, any two adjacent cells have different dimensions and are connected through a chain of adjacent cells with dimensions increasing by one, and hence to determine all cell adjacencies it is sufficient to find all pairs of adjacent cells whose dimensions differ by one. These properties, stated precisely in Proposition 5, are essential for our algorithm.

###### Proposition 5.

Let be a well-based CAF.

1. If then there exits cells such that .

2. Let be a section

 C={(¯¯¯a,an):¯¯¯a∈Πn−1(C)∧an=Rootxn,λf(¯¯¯a)}

and let be a cell adjacent to with . Then either is equal to a section

 {(¯¯¯a,an):¯¯¯a∈C′∧an=Rootxn,λ′f(¯¯¯a)}

for some , or for any

 lim¯b∈Πn−1(C),¯b→¯¯¯aRootxn,λf(¯¯¯a)=−∞

or for any

 lim¯b∈Πn−1(C),¯b→¯¯¯aRootxn,λf(¯¯¯a)=∞
3. Let be adjacent cells such that and . Then and if then there exist cells such that and for .

###### Proof.

Part is Lemma 1 of . To prove first note that, by , . By Lemma 2 of , there exists a unique continuous function extending . Moreover, is either infinite or a root of . Since is delineable on and is connected, either is a root of on , or on , or on .

We will prove by induction on . Note that by it is sufficient to find cells such that and and are adjacent for . If then dimensions of any pair of adjacent cells differ by one, hence is true. To prove for we will use induction on . If then is true. Suppose . Let and , where and . If is a section, then, by Lemma 2 of , there exists a continuous function such that and is infinite or a root of an element of . In this case set . Similarly, if is a sector, then, by Lemma 2 of , there exists continuous functions such that and and are infinite or roots of elements of . Since , . Suppose first that . Since , is a section and is a sector. If , where or , then is finite on , is adjacent to , and is adjacent to . Since , is true. Otherwise, let be the sector directly below . Then , and hence is adjacent to . Again, since , is true. Now suppose that . is well-based, hence, by the inductive hypothesis on , there exist cells such that and for . Let and . Then . Since is adjacent to , there exist a sequence such that and . Put . Then . The set

 S={(x,y):x∈C′l′−1∧y∈R∧r(x)≤y≤s(x)}

is a union of a finite number of cells, , and . Hence, there exists a cell such that contains infinitely many elements of the sequence . Therefore, is adjacent to both and . Since and , is true by the inductive hypothesis on . ∎

For a given semialgebraic set a well-based CAF such that is consistent with may not exist in a given system of coordinates. However, as shown in , there always exists a linear change of variables after which a well-based CAF such that is consistent with does exist.

###### Example 6.

If is the real solution set of then a well-based CAF such that is consistent with does not exist for any order of variables. A CAD computed using McCallum’s projection operator  includes cells

 C1 = {(x,y,z):x>0∧y>−x∧z=−xyx+y} C2 = {(x,y,z):x=0∧y=0}

is not a union of cells, since , and section is adjacent to a sector from a different stack. After the linear change of variables is transformed to the solution set of . The following CAF is well-based and is consistent with the transformed .

 F = (x<0∧G1)∨(x=0∧((yRooty,1g∧G1)))∨(x>0∧G1)

where

 f = z2+z(y+2x)+xy g = y2+4x2 G1 = zRootz,2f G2 = zRootz,1f

## 3. Root isolation algorithms

In this section we describe root isolation algorithms we will use in the algorithm computing cell adjacencies. Let us first introduce some notations and subalgorithms.

Let denote a disk in the complex plane, let denote the set of dyadic rational numbers, and let denote the set of discs in the complex plane with dyadic Gaussian rational centers and dyadic rational radii. For a disc , let and denote the center and the radius of , let and denote the minimum and maximum of absolute values of elements of , let denote the disc that consists of complex conjugates of elements of , and let and . When we refer to interval arithmetic operations we mean circular complex interval (disc) arithmetic (see e.g. ).

###### Proposition 7.

There exists an algorithm (ApproximateRoots) that takes as input a polynomial

 g=bNxN+…+b0∈Q2[ı][x]

and and outputs such that for any polynomial

 f=aNxN+…+a0=aN(x−σ1)⋯(x−σN)∈C[x]

and any there exits such that if and, for all ,

 ∣bi−ai∣≤2−pmax0≤i≤N|ai|

then, after a suitable reordering of roots, for all .

###### Proof.

The algorithm described in  satisfies Proposition 7. ∎

Let us now describe a subalgorithm computing roots of polynomials with complex disc coefficients. The algorithm is based on the following proposition (, Proposition 4.1).

###### Proposition 8.

Let be a polynomial of degree , , , and let . Suppose that

 max0≤i

Then has exactly roots, multiplicities counted, in the disc .

The following is an extended version of Algorithm 4.2 from . The key difference is that this version does not assume that the leading coefficient does not contain zero and provides a lower bound on the absolute value of roots that tend to infinity when the leading coefficients that contain zero vanish.

###### Algorithm 9.

(IntervalRoots)
Input: .
Output: , positive integers , and a positive radius , such that for any and any the polynomial has exactly roots in the disc , multiplicities counted, and has no roots in . Moreover, for any , , and . The other possible output is .

1. If for all return . Otherwise let be the maximal such that .

2. Put

 R:=mind

If

 R≤max0≤i

return .

3. Set , where for , and set

 p=−max0≤i≤dlogρ(Zi)
4. Compute .

5. Let . For each and use complex disc arithmetic to compute .

6. For each let be the smallest such that and

 rj:=max0≤i

If there is no satisfying the condition return .

7. Find the connected components of the union of . Let be the sets of indices corresponding to the connected components.

8. For each , let . If for some return . Otherwise pick with the minimal value of , and set .

9. If for some return .

10. Return , , and .

To show correctness of Algorithm 9, suppose that the algorithm returned , , and . Let and . By Proposition 8, and because the algorithm did not fail in step , has exactly roots in . The condition in step and Proposition 8 imply that has exactly roots in the disc . Since the algorithm did not fail in step , , and hence has no roots in . Step guarantees that for any , . Step ensures that .

Computation of sample points in CAD cells requires a representation of vectors with algebraic number coordinates. The following gives a recursive definition of root isolation data and of representation of real algebraic vectors. Note that root isolation data provides information about roots of

not only at , but also in a neighbourhood of (point of the definition). This property is crucial for computing cell adjacencies.

###### Definition 10.

is root isolation data for at if

1. , , and ,

2. has a root of multiplicity in , for , and has no other roots,

3. for any ,

4. for any and if then ,

5. if is the isolating disc of for , and then has exactly roots in , multiplicities counted, and has no roots in .

A real algebraic vector is represented by

 Ωk=(Ωk−1,fk,Wk,Θk)

where

• represents the real algebraic vector ,

• is a defining polynomial of ,

• is an isolating disc of ,

• is root isolation data for at , for some , and .

Define .

To complete the recursive definition let be the representation of the only element of .

We will say that