Proofs: Subresultant GCD algorithm
These are the human proofs of Subresultant GCD algorithm, at full length.
The subresultant algorithm returns the gcd in Z[x] full
This proof shows: correctness.
Let be a unique factorization domain with fraction field ; the case of the page is , . Gcds in are taken with a normal leading coefficient (positive over ). For let be the set of common divisors of and in .
Lemma 1 (pseudo-remainder). If , and , then in , where . This is proved on the page pseudo-division, from the uniqueness of division with remainder in .
Lemma 2 (exactness). In every pass of the loop, divides every coefficient of in line L9, and the division in line L10 is exact. Moreover and .
Source. This is the fundamental theorem of subresultants: up to sign, each new of line L9 is a subresultant of and , a polynomial whose coefficients are determinants of matrices with entries in , and each is, up to sign, a leading coefficient of a subresultant (Brown and Traub, 1971; von zur Gathen and Gerhard, Section 11.2; Cohen, Section 3.3). The leading coefficients are nonzero because they are leading coefficients of nonzero polynomials, and a product and an exact quotient of nonzero elements of a domain are nonzero. The implementation checks every division and raises an error if one leaves a remainder.
The case . After line L1, , so is the only case in which line L2 returns. Then , normalized, which is the output. If also , the output is .
Invariant. Assume . Before each test of line L4 (each pass of the loop):
- , and ;
- .
Initialization. After line L3, and . They differ from and by nonzero constants, which are units of , so part 2 holds. Part 1 holds by line L1 and since .
Maintenance. Suppose the loop does not return at lines L7 or L8, so and . By Lemma 1, with . By Lemma 2, the new is , a nonzero constant of times . A polynomial divides and exactly when it divides and , so . Also , which gives part 1.
Termination. Each pass that does not return makes strictly smaller, and in every pass after the first that continues, since line L8 returns when . So the loop returns after at most passes.
The output. Let in , and let . We use two facts that follow from Gauss's lemma, which states that a product of primitive polynomials is primitive.
(a) If , is primitive and divides in , then divides in . Write with , and with and primitive. Then is primitive, and , so up to a unit, which lies in . Hence .
(b) If is primitive and is a gcd of and in , then is a gcd of and in . By (a), divides and in , so divides and . If divides and , then divides and , by Gauss's lemma applied to , so it divides . And divides and in , so it divides in , and by (a) in . Hence divides .
Line L7. , so by Lemma 1, and divides in . Then is the set of divisors of , and by the invariant is a gcd of and in . So is its primitive part , normalized, and by (b) the output is .
Line L8. is a nonzero constant, so is a nonzero constant, and contains only constants. As above, is the set of nonzero constants, so is a gcd in , and by (b) with the output is .