Proofs: Cylindrical algebraic decomposition
These are the human proofs of Cylindrical algebraic decomposition, at full length.
The plane CAD is cylindrical, sign-invariant and computed exactly, and it stops full
This proof shows: correctness, termination.
Let . View each as a polynomial in over . Its content is the gcd of its coefficients and its primitive part is . Let , and let be the primitive squarefree part of , made primitive. Let and let be the squarefree part of , where is the leading coefficient in . These are the objects of line L1. By Gauss's lemma, has exactly the irreducible factors of that involve , each once, and it has no factor in alone. Since is squarefree over , it has no common factor with , so when .
Lemma 1 (where vanishes). Let be nonzero, and suppose at a real point. Then or . Moreover, is never the zero polynomial.
Proof. If then . Every irreducible factor of divides and therefore , so divides for some . Hence . The coefficients of have gcd 1 in , so they have no common complex root, and .
Lemma 2 (delineability). Let , and let be an open interval on which and have no zero. Then there are and continuous functions on such that, for every , the real roots of are exactly .
Proof. For , has degree , and its derivative has degree with leading coefficient . So the resultant specializes: . Then has distinct complex roots. Fix and choose disjoint closed discs around these roots, each disc symmetric under complex conjugation when its center is real, and not meeting the real axis when its center is not real. The roots of a polynomial of constant degree depend continuously on its coefficients. So for near each disc contains exactly one root of . A disc that misses the real axis contains no real root. A symmetric disc contains a real root: if its only root were not real, then would be a second root in the same disc. So the number of real roots is locally constant, hence constant on the connected set , and each ordered real root stays in its disc, which makes it continuous. Distinct roots never meet, so the order is strict on all of .
Lemma 3 (sign-invariance over an open column). Let be a connected component of minus the real roots of . Then for every , has a constant sign on each sector (with , ) and on each section .
Proof. Every root of , and is a root of , so none of these vanishes on , and Lemma 2 applies (with when ). By Lemma 1, the zeros of over lie on the graphs of the . A sector is connected, being homeomorphic to times an open interval through the continuous . Since is continuous with no zero on a sector, its sign is constant there.
For a section, write with distinct irreducible . At each , the root is simple, so it is a root of exactly one . The sets are closed in , disjoint and cover , so by connectedness a single vanishes along the whole section. If divides , then is zero on the section. Otherwise suppose at some . Since , some irreducible factor of vanishes there. That factor is one of the , which contradicts uniqueness. So has no zero on the section, which is connected, and its sign is constant.
Lemma 4 (stacks over a point). For a real , let be the real roots of . Then each has a constant sign on each open interval and on each point .
Proof. If , then and its sign is everywhere on the line. Otherwise, by Lemma 1, every real zero of is some , so has no zero on the open intervals and keeps its sign on each.
Lemma 5 (exact computation). The implementation computes the roots, the stacks and the sign vectors exactly.
Proof. (a) Isolation. For a squarefree , every real root lies in with (Cauchy). Sturm's theorem counts the distinct roots in at non-root endpoints. Bisection keeps the endpoints off the roots, since a midpoint that is a root is moved. It stops: once the intervals are shorter than the smallest gap between roots, each holds at most one root. The output is sorted, disjoint and complete, with one root per interval.
(b) Real algebraic numbers. A number is held as a squarefree with and an interval that contains no other root of , with , or as an exact rational. For a section column, is the smallest squarefree factor of a projection polynomial that changes sign on the isolating interval of . Its roots are roots of , so its only root there is . Refinement halves the interval by the sign of at the midpoint and keeps the invariant. Then is_zero(q) returns true exactly when . If the interval enclosure of on misses , then . Otherwise let . Since , we have if and only if , and , a divisor of the squarefree , has at most one root in , a simple one. So exactly when changes sign on . Then is replaced by or by , whichever vanishes at , and the invariant holds. If , the enclosures shrink to as the interval shrinks, so sign_of stops with the right sign.
(c) Arithmetic in . Reduction modulo commutes with evaluation at , since defines a ring homomorphism . The decisions taken (is a leading coefficient zero at ?) are exact by (b). An inverse is taken only for with . Removing from keeps as a root, because . Then the extended Euclidean algorithm gives with , so . So the trimmed polynomials, remainders, monic gcds and derivatives computed over evaluate at to those of the evaluated inputs in . In particular, the stack polynomial evaluates to the monic squarefree part of , and the Sturm sequence built from is the Sturm sequence of the real polynomial . Dividing by a monic multiple of leaves the remainder unchanged.
(d) Sections. As a polynomial in with coefficients in , has leading coefficient exactly . With monic, Poisson's formula gives . This is a product of monic polynomials in , so it is nonzero, has degree , and is recovered exactly by interpolation at that many points plus one. Every root of is a root of this norm. Its squarefree part is isolated by (a). In each interval, which holds one root of and has endpoints that are not roots of , the Sturm count of is or . Keeping the intervals with count gives exactly the real roots of , in increasing order, with rational sector samples between them. For a rational , the squarefree part of is isolated directly.
(e) Signs. At a rational , the sign of is sign_of of a polynomial in , which is exact by (b). At a section , the unique root of and of in : if and only if has a root in . divides a squarefree polynomial, so its Sturm count decides this. Otherwise , and the box enclosures of shrink to it: is refined by (b), and is refined by bisection of , whose only root in the interval is . So the loop stops with the correct sign.
Theorem. cad(F) terminates and returns a cylindrical decomposition of into connected cells, each with the correct sign vector of , and every has a constant sign on every cell.
Proof. Columns. By Lemma 5(a), lines L2 and L3 find all real roots of . Each sector sample is the midpoint between the right end of one isolating interval and the left end of the next, or a point beyond the extreme intervals. It lies strictly between consecutive roots and is not a root. So the x-cells, the points and the open intervals between them, partition .
Open columns. Let be an open x-cell with sample . Lemma 2 gives continuous root functions on . By Lemma 5(d), the stack computed at has exactly sections, so the sections and sectors over correspond one to one to the cells of the stack at . By Lemma 3, each has a constant sign on each of these cells. By Lemma 5(e), the sign at the sample is computed exactly, so it is the sign on the whole cell.
Point columns. Over , the stack consists of the real roots of and the open intervals between them (Lemma 5(d)). Signs are constant on them by Lemma 4 and computed exactly by Lemma 5(e).
Partition and cylindricity. Every vertical line is partitioned by the stack over its x-cell, so the cells partition . Their projections are exactly the x-cells, which makes the decomposition cylindrical. Each cell is connected, being a point, an interval, the graph of a continuous function over an interval, or the region between two such graphs.
Termination. Every loop either decreases a degree (the Euclidean and Sturm sequences, division), runs over a finite list (columns, cells, polynomials), or is a refinement loop. The refinement loops stop by Lemma 5(a), (b) and (e).