<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Towards Incremental Cylindrical Algebraic Decomposition in Maple</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Alexander I. Cowen-Rivers</string-name>
          <email>a.cowen-rivers.17@ucl.ac.uk</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matthew England</string-name>
          <email>Matthew.England@coventry.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Coventry University</institution>
          ,
          <addr-line>Coventry</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University College London</institution>
          ,
          <addr-line>London</addr-line>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <fpage>3</fpage>
      <lpage>18</lpage>
      <abstract>
        <p>Cylindrical Algebraic Decomposition (CAD) is an important tool within computational real algebraic geometry, capable of solving many problems for polynomial systems over the reals. It has long been studied by the Symbolic Computation community and has found recent interest in the Satis ability Checking community. The present report describes a proof of concept implementation of an Incremental CAD algorithm in Maple, where CADs are built and then re ned as additional polynomial constraints are added. The aim is to make CAD suitable for use as a theory solver for SMT tools who search for solutions by continually reformulating logical formula and querying whether a logical solution is admissible. We describe experiments for the proof of concept, which clearly display the computational advantages compared to iterated re-computation. In addition, the project implemented this work under the recently veri ed Lazard projection scheme (with corresponding Lazard valuation).</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        We aim to adapt Cylindrical Algebraic Decomposition (CAD) for use with
SMTsolvers [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], as part of the SC2 Project which seeks to build collaborations between
researchers in Symbolic Computation and Satis ability Solving [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. We report
on an implementation of incremental CAD in Maple which can build a CAD
and then re ne it by incrementally adding polynomials. The implementation is
restricted to Open CAD (full dimensional cells) and the addition of constraints
(an SMT solver would also want the ability to remove them). While a proof of
concept implementation, experiments show clear savings on o er.
Another minor contribution of the present work is an implementation of the
Lazard projection operator (and corresponding valuation for lifting). The
operator was proposed in 1994 [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], but shortly after a aw was found in its proof of
correctness (see [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] for details). However, recent work [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] has given an
alternative proof (which necessitates some changes to the lifting stage). It is now the
smallest known complete CAD projection operator.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Terminology</title>
      <p>We work over n-dimension real space Rn in which there is a variable ordering.
De nition 1 A decomposition of the space X
disjoint regions, called cells, whose union is X .</p>
      <p>Rn is a
nite collection of
De nition 2 A set is semi-algebraic if it can be constructed by nitely many
applications of union, intersection and complementation operations on sets of
the form fx 2 Rn j f (x) 0g where f 2 R[x1; ; xn].</p>
      <p>De nition 3 A decomposition D is algebraic if each of its components x 2 D
is a semi-algebraic set.</p>
      <p>De nition 4 A nite partition of D of Rn is called a cylindrical decomposition
of Rn if the projections of any two cells onto any lower dimensional coordinate
space with respect to the variable ordering are either equal or disjoint.
Thus a cylindrical algebraic decomposition (CAD) satis es De nitions 1
4.</p>
      <p>
        De nition 5 A CAD is sign-invariant with respect to a set of input polynomials
if each polynomial has a constant sign (positive, negative or zero) on each cell.
CADs may be produced with other invariant properties (see for example [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ])
but we assume sign-invariance in the present work. Each CAD cell is equipped
with: a cell index which is a list of integers that de nes the position of a cell
in the decomposition; and a sample point of the cell. The cells we produce also
come with a cell description: a cylindrical formula, that is, a description of the
cell as a sequence of conditions on ordered variables of the form `(x1; : : : ; xk) &lt;
xk+1 &lt; u(x1; : : : ; xk), where ` and u may be 1.
      </p>
      <p>
        CADs are traditionally produced through a two-stage process: rst projection
identi es polynomials of importance for the invariance property and then lifting
incrementally builds CADs of Rk for k = 1; : : : ; n according to these polynomials.
Decompositions are performed by working at a sample point of a cell, reducing
multivariate polynomials to univariate and then decomposing according to the
output of real root isolation. For a fuller introduction see the lecture notes [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
1.2
      </p>
    </sec>
    <sec id="sec-3">
      <title>Example</title>
      <p>
        We give a visual example3. The gingerbread face in Figure 1 is formed by four
closed curves, each of which de ned by a bi-variate polynomial equation. A
corresponding sign-invariant CAD of R2 is visualised in Figure 2. We label the
37 open cells (those of two dimensions). There are a further 28 partially open
(1-dimensional line segments) and 28 closed cells (isolated points) giving 93
CAD cells in total. Of course, in many industrial and SMT applications the
polynomials will not form such aesthetically pleasing geometric shapes.
3 Inspired by http://planning.cs.uiuc.edu/node296.html
We aim to work with CADs that change incrementally by constraint. I.e. given a
CAD of Rn sign-invariant for polynomials ff1; : : : ; fmg we aim to adapt this to
one sign-invariant for ff1; : : : ; fm; fm+1g or ff1; : : : ; fm 1g. The present report
deals only with the rst problem. Such incrementality is needed to use CAD in
SMT, and could also bene t CAD directly as a way of reducing the search space.
We proceed by considering the changes required in Projection (Section 2) and
Lifting (Section 3) alongside the issues in using the Lazard projection operator.
We nish with a summary and plans for future work in Section 4. A larger report
with additional details we do not have room for here is available on arXiv [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <sec id="sec-3-1">
        <title>Projection</title>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Lazard projection</title>
      <p>
        The present project built upon code from the ProjectionCAD package [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] for
Maple. This implemented the McCallum family of projection operators [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]
and our rst step was to adapt this for the Lazard projection scheme. All
projection operators take a set of polynomials and produce another set in one less
variable. The Lazard operator is essentially a subset of the McCallum
operator. Both take discriminants and cross-resultants of the input polynomials. The
Lazard operator then takes in addition leading and trailing coe cients while
the McCallum operator takes all coe cients. Thus adaptations to the projection
algorithms were fairly minimal here (see [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] for algorithms). The main
computational di erences occur in the lifting stage as discussed later.
      </p>
    </sec>
    <sec id="sec-5">
      <title>Worked example</title>
      <p>We describe a worked example to illustrate what projection does and to use later
to illustrate incremental projection. We work with a system of two polynomials
F1 and seek a sign-invariant CAD:
Since the problem involves only two variables, we need only a single projection
(which we do with respect to x2). The leading coe cients are constant, but the
trailing coe cients clearly identify the points on the x1 line at 0 and 1. The
discriminants do not identify anything more but the resultant</p>
      <p>Resultant(f1; f2; x2) = (x13 + x21
1)2
identi es 1 = 0:75494. Thus the real line is decomposed into 11 cells
according to these 5 points.
We will compute all the projection polynomials discussed above and some
additional ones. The discriminant and leading coe cient of f3 are constant, and the
trailing coe cient identi es x1 = 0 which was already present from the trailing
coe cient of f2. Similarly, the resultant of f2 and f3 is x12(x1 1) identi es two
more roots we saw already. However Resultant(f1; f3; x2) = 2x21 1 identi es
two new points, 2 = 1=p2 0:7071.
4 We give a decimal approximation but emphasise that CAD would use the full
algebraic number representation: that 1 is the sole real root of (2) in (0; 1).</p>
      <p>
        We developed Algorithms 1 and 2 to implement such an incremental projection.
The pseudo code is closely linked to the Maple implementation. The former
computes all the projection polynomials via calls to the latter which performs one
projection. The adjustments (highlighted in blue) required to make the original
projection code (see [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]) incremental were:
1. To output from ProjectionPolysAdd the full table of projection polynomials
organised by the main variable and re-input this with incremental calls.
2. The process and pass polynomials separately into ProjectionAdd.
3. To calculate only the new projection polynomials and store appropriately.
2.4
      </p>
    </sec>
    <sec id="sec-6">
      <title>Incremental projection experimental results</title>
      <p>There were seven elements of the projection set to calculate in the original
projection system ProjL(F1) and after the addition of the extra polynomial ProjL(F2)
had 12. By avoiding full recomputation, we had to compute only the extra ve.
At the cell level the savings are more signi cant: on the real line there were 5
original roots (11 cells), and two new ones (making 15 cells).</p>
      <p>We performed experiments to see how such savings transferred into computation
time. We created examples using the random polynomial function randpoly in
Maple. Testing was conducted through an external bash script creating new
Maple instances to avoid any result caching. The testing code is available
online5.
5 https://github.com/acr42/InCAD.git</p>
      <sec id="sec-6-1">
        <title>Algorithm 1 ProjectionPolysAdd</title>
        <p>1: Input: Set of calculated projection polynomials prev 2 R[xn; : : : ; x1] and
set of new polynomials new 2 R[xn; : : : ; x1] (Adjustment 1)
2: Output: All projection polynomials 2 R[xn; : : : ; x1]
3: Procedure ProjectionPolysAdd (Compute all projection polynomials)
4: dim</p>
        <p>Number of variables +1
5: pset[0] = table()
10: for i from 1 to dim-1 do
17: end for
18: pset[dim
19: ret
pset[[dim
20: return pset (Adjustment 1)
6: pset[0]</p>
      </sec>
      <sec id="sec-6-2">
        <title>Remove constant multiples from pset[[dim</title>
        <p>Bivariate polynomials We created 60 pairs of bivariate polynomials,
considered rst nding the projection of one and then incrementing the projection by
including the other. On average it was 16% faster to increment compared to
computing the projection for both polynomials together. However, there was a
large variance: the cases which were faster were on average 55% faster, while a
small number of cases were slower, by as much as 87%.</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Projection</title>
    </sec>
    <sec id="sec-8">
      <title>Results</title>
    </sec>
    <sec id="sec-9">
      <title>Classical Incremental</title>
      <p>Variance 0.0004660s 0.0006425s
Mean 0.03743s 0.0315s
Lower Quartile 0.024s 0.008s
Median 0.0285s 0.015s
Upper Quartile 0.03675s 0.05525s</p>
      <sec id="sec-9-1">
        <title>Algorithm 2 ProjectionAdd</title>
        <p>1: Input: Sets of polynomials new = ff1; : : : ; fmg 2 R[xn; : : : ; x1], old 2</p>
        <p>R[xn 1; : : : ; x1], and variable ordering (Adjustment 2)
2: Output: Set of polynomials P set = fp1; : : : ; pqg 2 R[xn 1; : : : ; x1]
3: Procedure ProjectionAdd
4: P olys Primitive set from new, wrt variable xn (Adjustment 2)
5: Cont Content set from new, wrt variable xn (Adjustment 2)
6: P olys Square free basis set from P olys, wrt variable xn
7: P set1 = table() :
8: for i from 1 to number of elements of P olys do
9: P ol P olys[i]
10: clist Lazard coe cient set from P ol, wrt to xn
11: temp Discriminant set from P ol, wrt xn
12: temp Remove constant multiples from temp
13: P set1[i] union temp &amp; clist
14: end for
15: P set2 = table() :
16: for i from 1 to number of P olys do
17: for j from i+1 to number of P olys do
18: P set2[i; j] Resultant of P olys[i] and P olys[j], wrt to variable var
19: P set2[i; j] Remove constant multiples from P set2[i; j]
20: end for
21: end for
22: oldset old
23: P set3 = table() :
24: for i from 1 to number of P olys do
25: for j from 1 to size(oldset) do
26: P set3[i; j] Resultant of P olys[i] and oldset[j], wrt to variable var
27: P set3[i; j] Remove constant multiples from P set3[i; j]
28: end for
29: end for(Adjustment 3)
30: P set union (cont; P set1; P set2; P set3)
31: P set Remove constant multiples from P set
32: return P set
Trivariate polynomials We next created 80 further examples with pairs of
trivariate polynomials, in this case restricting to 4 terms per polynomial. Here
there were greater savings, on average 29% faster to increment than to compute
altogether. There was also a smaller variance in the timings of the example set,
although it was still the case that a few examples were slower to increment than
recompute.</p>
      </sec>
    </sec>
    <sec id="sec-10">
      <title>Projection Results Classical Incremental</title>
      <p>We suggest that the extra overheads of the incremental approach will become
less important in comparison to the savings as the number of variables increase:
indeed, this follows from the well-known complexity results on CAD.</p>
      <sec id="sec-10-1">
        <title>Lifting</title>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>Lifting after Lazard projection</title>
      <p>
        We had to make changes to the lifting code in ProjectionCAD, not just to
allow for incrementality but also to validate the use of the Lazard projection
operator [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. The McCallum projection operator [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] is known to be incomplete
if it occurs that a projection polynomial is nulli ed over the sample point of
a cell. For example, the polynomial (y2 2)w + z(y x2 + x + 2) is nulli ed
over a cell in (x; y; z)-space with sample point (p2; p2; 1). When lifting after
McCallum projection, one must check for this situation and warn the user that
above the cell in question we are not guaranteed sign-invariance.
With the Lazard operator (as proved valid in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]) we can avoid such checks
and warnings but we must do some additional work during lifting to recover
information lost by nulli cation, as outlined in Algorithm 3. With the previous
example we would rst substitute for x = p2 to get (y2 2)w + z(y + p2); but
then before substituting for y we must divide by y + p2 to give (y p2)w + z.
We can only then substitute for y to give 2p2w + z and nally z to give
2p2w + 1. We thus must lift with respect to this univariate polynomial in w,
creating necessary cell divisions that would have been lost by nulli cation.
This process is di cult when involving irrational sample points. However, since
our prototype implementation lifts only over open cells, we have avoided such
di culties for now. Our implementation produces Open CADs, avoiding costly
algebraic number calculations, but still getting a good understanding of the
solution set.
De nition 6 An Open-CAD is produced by lifting over open intervals only6.
Algorithm 3 Lazard valuation
1: Input: A polynomial f 2 R[x1; : : : ; xd], and sp = [r1; : : : ; rd 1] 2 Rd 1.
2: Output: List of roots.
3: Procedure LazardValuation:
4: Set roots to be an empty list
5: for j from 1 to d
      </p>
      <p>1 do
6:
7:
8:
9:
while f (r1; : : : ; rj ) = 0 do
f
f =(xj</p>
      <p>rj )
substitute xj = rj into f .</p>
      <p>end while
10: end for
11: return f:
We will now discuss our approach for incremental lifting, which can be thought
of graphically as a form of acyclic tree merge, as shown later.
3.2</p>
    </sec>
    <sec id="sec-12">
      <title>Worked example</title>
      <p>
        We will describe lifting the projection polynomial system de ned previously
ProjL(F1). Recall that we identi ed four points on the real line: f 1; 0; 1; 1g.
Thus, we need to choose a sample value from the 9 cells in the decomposition:
a1 = fx1 &lt; 1g; a2 = fx1 = 1g;
a4 = fx1 = 0g; a5 = f0 &lt; x1 &lt;
a7 = f 1 &lt; x1 &lt; 1g; a8 = fx1 = 1g;
a3 = f 1 &lt; x1 &lt; 0g;
1g; a6 = fx1 = 1g;
a9 = f1 &lt; x1g
(4)
We are forced to pick non-rational sample points for cell a6 but the others can
be rational. We choose sample points: ( 2; 1; 21 ; 0; 12 ; 1; 190 ; 1; 2):
We lift over each cell at the designated sample point by isolating real roots of
the univariate polynomials in x2 we get by from the Lazard valuation at the
sample point in x1. Below, pi;j denotes the polynomial acquired after applying
the Lazard valuation method to the i'th sample point, on the j'th polynomial
from F1. For example, if we use sample point 21 for cell a3 then polynomial f1
becomes 41 + x22 1 which has two real roots at 0 = p3=2 0:8660. We
proceed this way to generate our CAD cells in R2. The structure is as shown in
Figure 5. For a full list of the new cell descriptions see [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
6 Not actually a decomposition of Rn as missing boundaries of the n-dimensional cells.
The general concept of how we solved this stage of the problem was to think of it
as solving a graph (tree) attachment/detachment problem. One should think of
the old CAD as having a tree structure which we save: where nodes are cells; and
branches link a cell to its parent (cell it projects onto), or child (decomposition
in a cylinder above) cells. At each depth of the CAD/tree, say depth p, are all
the cells within Rp before we lifted to Rp+1. We go through a worked example.
We perform an incremental lift on the polynomial system F1, incremented by a
new polynomial f4 = x31 + x22, forming the new system (5).
The new system is symmetrical about the y axis as you can see in Figure 8.
      </p>
      <p>We skip the projection steps7. The addition polynomials identify one further
point on the real line: 1. The decomposition of the real line is now:
a1 = fx1 &lt; 1g; a2 = fx1 = 1g; a3 = f 1 &lt; x1 &lt; 1g;
a4 = fx1 = 1g; a5 = f 1 &lt; x1 &lt; 0g; a6 = fx1 = 0g; a7 = f0 &lt; x1 &lt; 1g;
a8 = fx1 = 1g; a9 = f 1 &lt; x1 &lt; 1g; a10 = fx1 = 1g; a11 = f1 &lt; x1g
and our sample points are: 2; 1; 190 ;
1; 12 ; 0; 12 ; 1; 190 ; 1; 2.</p>
      <p>
        We rst test whether each sample point leads to new roots when lifting with f4.
If so we must re ne the decomposition in the cylinder above. For example, on a2
we have sample point x1 = 1, and the Lazard valuation of f4 is x22 1 with real
roots at 1. However, we had already identi ed these from other polynomials,
sxo22 no18chaanndgweeis rnedqutiwreodn. eHwowreeavlerro,ootns.aW5ewitthhussarmepnlee pthoeindteco12m, pfo4seitviaolnuaatbeosvteo.
We then lift over the new sample points with respect to all polynomials creating
new decompositions. For example, at x1 = 190 we have two roots from the
valuation of f1 and another two from f4 (so decomposition above into 9 cells). Figures
10-12 show the new CAD tree structure and its split into new and unchanged
cells, illustrating potential savings. Full cell descriptions are in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
7 See "Worked Examples" worksheet in: https://github.com/acr42/InCAD.git
The two new algorithms created for incremental lifting were LiftSetupAdd
(Algorithm 4) concentrating on the base phase (CAD of the real line) and LiftAdd
(Algorithm 5) which deals with the rest of the CAD. The non-incremental
versions can be found in the report [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>When incrementing the lift stage, we can think of it as starting at the root node
of the old CAD tree and working our way down it, one depth level at a time,
until we reach the leaves. In the process of working down the old tree, we will
be creating subtrees, which will later be reconnected to the unchanged tree, to
form the new incremented CAD tree.</p>
      <p>One tree (UnchangedCells) is a strict subset of the old trees nodes and edges,
discovered through analysing the old structure down and Lazard valuating on
each cell not marked as new, at each depth p with new projection polynomials
in Rp+1. Then, if there are new real roots discovered, we prune inspected cells
children, and the cell is sent to the NewCells set for full re-computation. In the
NewCells set, we will then use this cell to form a subtree, to later be reconnected
with the UnchangedCells tree. Each cell in the NewCells list is a subtree, to
later be reconnected via source indices.</p>
      <p>When going through the old CAD tree structure, we have only two cases:
CASE 1: When a node has new children:
New real roots have been acquired from one of the new projection polynomials.
We start by pruning all of the child branches in the old tree structure, by labelling
them as new, then performing a full lift onto the set of all projection polynomials
from Rk; : : : ; Rn, where k is the depth the new root was discovered. When we
label a cell as new, e ectively that halts tree growth in the UnchangedCells
structure, so that later on we can attach the branch extensions, gained from the
incremental lift. Such cells have an updated source index, as its source cell would
now be saved in a new tree structure with a new index.</p>
      <p>CASE 2: When a node has no new children.</p>
      <p>The new ag is passed down to children from parents. Cells which are not new
are stored in UnchangedCells. Cells here only have Lazard valuation at the new
projection polynomial (rather than all projection polynomials). If this leads to
a new root, we move it over to the NewCells structure. Otherwise, we continue
with its child cells.</p>
      <p>When moving cells into UnchangedCells, we make sure that the indexing of each
cell does not clash with that of the indexing in NewCells at each depth level in
the tree. We then merge the NewCells and UnchangedCells trees, forming the
full incremented CAD tree. At each stage of the lift, we merge-sort the list.</p>
    </sec>
    <sec id="sec-13">
      <title>3.5 Incremental lifting experimental results</title>
      <p>We conducted testing for the incremental lift method on the same examples used
to test the incremental projection earlier.</p>
      <p>Bivariate polynomials On average 30% faster than recomputing.
Trivariate polynomials On average only 7% faster; one example 28% slower.</p>
    </sec>
    <sec id="sec-14">
      <title>Lift</title>
    </sec>
    <sec id="sec-15">
      <title>Results</title>
    </sec>
    <sec id="sec-16">
      <title>Classical Incremental</title>
      <p>Variance 0.003734s 0.002903s
Mean 0.1778s 0.1240s
Lower Quartile 0.1328s 0.089s
Median 0.163s 0.1255s
Upper Quartile 0.226s 0.163s
28.63% Smaller
30.25% Faster
32.96% Faster
23.01% Faster
27.87% Faster</p>
    </sec>
    <sec id="sec-17">
      <title>Lift</title>
    </sec>
    <sec id="sec-18">
      <title>Results</title>
    </sec>
    <sec id="sec-19">
      <title>Classical Incremental</title>
      <p>
        Variance 0.05541s 0.06838s
Mean 0.2880s 0.2687s
Lower Quartile 0.1275s 0.0995s
Median 0.207s 0.164s
Upper Quartile 0.3605s 0.3523s
18.96% Larger
6.707% Faster
21.96% Faster
20.77% Faster
2.29% Faster
So the lifting code shows opposite results to projection with the savings
decreasing with input size: indicating that the overheads required for the incremental
work grow faster than the savings (at least for the size of examples studied).
Of course, we can also experiment with combined projection and lifting.
Unsurprisingly the lifting costs dominate. For the bivariate polynomials incremental
code was 37% faster but for the trivariate only 12% faster (see [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] for details).
We think the reason for such drops in performance was due to poor choices of
Maple's data-structure: in particular Maple lists which are implemented as
immutable types meaning our edits of them caused separate lists to be created each
time. Further, the project may bene t from a fully object-oriented approach. It
is likely further progress could come through code re-factoring.
      </p>
      <sec id="sec-19-1">
        <title>Summary and Future Work</title>
        <p>The presented work acts as a proof of concept that incremental CAD
construction in Maple is possible with savings on o er. Care needs to be given to the
datatypes used. Beyond that the main areas of further work are moving out of
the open case (our implementation restricted lifting to open cells), considering
what happens if the new polynomial has a variable not already represented in
the system, and considering incremental reduction of constraints. To remove a
polynomial from the CAD means nding all those projection polynomials
created from only that source polynomial (or as a resultant of that with another)
and removing them and the cylinder splits their real roots caused.
Acknowledgements This work was funded by the EU's H2020 programme under
grant No H2020-FETOPEN-2015-CSA 712689 (SC2 ). We thank C. Brown for a tutorial
on the Lazard valuation; S. Timms, J.H. Davenport and S. Forrest for useful discussions;
and the organisers of the SC2 2017 Summer School where these took place.</p>
        <p>
          Algorithm 4 LiftSetupAdd
1: Input: A sets of new projection polynomials new, an oldcad, a table of sets
of all projection polynomials psetf ull, and a variable ordering
2: Output: [N ewCells; OldCad; OldRoots; U nchangedCells] where NewCells
are in the last variable Lif tIncf2 is information for the next lift, OldCad
contains the previous CAD tree, and UnchangedCells is a subset.
3: Procedure LiftSetup
4: cad table()
5: N ewRoots [ ]
6: N ewCells table()
7: U nchangedCells table()
8: Lif tIncf2 [ ]
9: for i from 1 to size(new[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) do
10: Append to N ewRoots output of RealRoots(new[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ][i])
11: N ewRoots Sort in ascending order and remove duplicates
12: end for
13: N ewCells[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]; U nchangedCells[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] = Split(OldRoots; N ewRoots; OldCad)
14: for i from 1 to size(oldcad[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) do
15: for j from 1 to size(new[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]) do
16: Add oldcad[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ][i] to N ewCells
17: end for
18: end for
19: for i from 1 to size(N ewCells[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) do
20: for j from 1 to size(psetf ull[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]) do
21: Set roots to real roots of LazardValuation(oldcad[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ][i]; new[
          <xref ref-type="bibr" rid="ref2">2</xref>
          ][j]
22: Append [[i]; [roots]] to Lif tIncf2
23: end for
24: end for
25: for i from 1 to size(oldcad[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) do
26: If cell OldCad[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ][i]'s ag is not equal to new, then add cell to
        </p>
        <p>
          U nchangedCells[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] and update index accordingly.
27: end for
28: return list of variables as in Output
Algorithm 5 LiftAdd
1: Input: A sets of new projection polynomials new, an oldcad, a table of sets
of all projection polynomials psetf ull, and a variable ordering
2: Output: Incremented CAD
3: Procedure LiftAdd
4: [N ewCells; OldCad; Lif tIncf2; U nchanged] LiftSetupAdd(pset; vars)
5: dim Number of elements in vars
6: for d from 2 to dim 1 do
7: Lif tIncfd+1 [ ]
8: N ewCells[d] Lif t(N ewCellsd 1; Lif tIncfd )
9: for i from 1 to size(OldCad[d]) do
10: for j from 1 to size(new[d + 1]) do
11: Add oldcad[d][i] to N ewCells
12: end for
13: end for
14: for i from 1 to size(N ewCells[d]) do
15: for j from 1 to size(psetf ull[d + 1]) do
16: Set roots to real roots of LazardValuation(OldCad[d][i]; new[d+1][j]
17: Append [[i]; [roots]] to Lif tIncfd+1
18: end for
19: end for
20: for i from 1 to size(OldCad[d]) do
21: If cell OldCad[d][i]'s ag is not equal to new, then add cell to
        </p>
        <p>U nchanged[d] and update index accordingly.
22: end for
23: end for
24: F inalU nchangedCells []
25: F inalU nchangedCells Union U nchanged[d][f ] for all cells f with their
corresponding ags not equal to new.
26: IncCAD F inalU nchangedCells Union N ewCells[d]
27: return IncCAD</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>E.</given-names>
            <surname>Abraham</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Abbott</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Becker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.M.</given-names>
            <surname>Bigatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Brain</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Buchberger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Cimatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.H.</given-names>
            <surname>Davenport</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>England</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Fontaine</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Forrest</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Griggio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kroening</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.M.</given-names>
            <surname>Seiler</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Sturm</surname>
          </string-name>
          . SC2:
          <article-title>Satis ability checking meets symbolic computation</article-title>
          .
          <source>In: Intelligent Computer Mathematics (LNCS 9791)</source>
          , pages
          <fpage>28</fpage>
          {
          <fpage>43</fpage>
          . Springer International Publishing,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>A.</given-names>
            <surname>Biere</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Heule</surname>
          </string-name>
          ,
          <string-name>
            <surname>H. van Maaren</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Walsh</surname>
          </string-name>
          .
          <article-title>Handbook of Satis ability (Vol. 185 Frontiers in Arti cial Intelligence and Applications)</article-title>
          . IOS Press,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>R.</given-names>
            <surname>Bradford</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.H.</given-names>
            <surname>Davenport</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>England</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>McCallum</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and D.</given-names>
            <surname>Wilson</surname>
          </string-name>
          .
          <article-title>Truth table invariant cylindrical algebraic decomposition</article-title>
          .
          <source>J. Symb. Comp.</source>
          ,
          <volume>76</volume>
          :1{
          <fpage>35</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>A.I.</given-names>
            <surname>Cowen-Rivers</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>England</surname>
          </string-name>
          .
          <article-title>Summer research report: Towards incremental Lazard cylindrical algebraic decomposition</article-title>
          . arXiv:
          <year>1804</year>
          .08564,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>M.</given-names>
            <surname>England</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bradford</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.H.</given-names>
            <surname>Davenport</surname>
          </string-name>
          .
          <article-title>Improving the use of equational constraints in cylindrical algebraic decomposition</article-title>
          .
          <source>In Proc. ISSAC '15</source>
          , pages
          <fpage>165</fpage>
          {
          <fpage>172</fpage>
          . ACM,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>M.</given-names>
            <surname>England</surname>
          </string-name>
          , D. Wilson,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bradford</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.H.</given-names>
            <surname>Davenport</surname>
          </string-name>
          .
          <article-title>Using the Regular Chains Library to build cylindrical algebraic decompositions by projecting and lifting</article-title>
          .
          <source>In Proc. ICMS '14, (LNCS 8592)</source>
          , pages
          <fpage>458</fpage>
          {
          <fpage>465</fpage>
          . Springer,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>M.</given-names>
            <surname>Jirstrand</surname>
          </string-name>
          .
          <article-title>Cylindrical algebraic decomposition: An introduction</article-title>
          . Course notes from Linkoping University,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>D.</given-names>
            <surname>Lazard</surname>
          </string-name>
          .
          <article-title>An improved projection for cylindrical algebraic decomposition</article-title>
          .
          <source>Algebraic Geometry and its Applications</source>
          , page
          <volume>467</volume>
          {
          <fpage>476</fpage>
          ,
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>S.</given-names>
            <surname>McCallum</surname>
          </string-name>
          .
          <article-title>An improved projection operation for cylindrical algebraic decomposition</article-title>
          .
          <source>In Quanti er Elimination and Cylindrical Algebraic Decomposition, Texts &amp; Monographs in Symbolic Computation</source>
          , pages
          <volume>242</volume>
          {
          <fpage>268</fpage>
          . Springer-Verlag,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>S.</given-names>
            <surname>McCallum</surname>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Hong</surname>
          </string-name>
          .
          <article-title>On using Lazard's projection in CAD construction</article-title>
          . J.
          <string-name>
            <surname>Symb</surname>
          </string-name>
          . Comp.,
          <volume>72</volume>
          :
          <fpage>65</fpage>
          {
          <fpage>81</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>S.</given-names>
            <surname>McCallum</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Parusiniski</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L.</given-names>
            <surname>Paunescu</surname>
          </string-name>
          .
          <article-title>Validity proof of Lazard's method for CAD construction</article-title>
          . In Press: J.
          <string-name>
            <surname>Symb</surname>
          </string-name>
          . Comp.,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>