Proofs: Elliptic curve factorization method
These are the human proofs of Elliptic curve factorization method, at full length.
Correctness of the elliptic curve method full
This proof shows: correctness, termination.
Throughout, with , and a curve with is fixed, as after line L3. For a prime , and , so the curve modulo is an elliptic curve and its points form the group under the chord and tangent rules, with zero . For a point modulo write , and reduces to .
The addition of the algorithm is: and ; otherwise (case 1) if , the slope with ; (case 2) if and , the sum ; (case 3) otherwise the slope with . In cases 1 and 3 the addition fails if , and otherwise returns modulo .
Lemma 1 (reduction). Let be a prime factor of , and let be or pairs modulo such that and are in . If the addition does not fail, then in .
Proof. If or is this is the rule for the zero. Case 1: is invertible modulo , hence modulo , so , and the group law in uses the chord slope , which is ; the formulas for and reduce to those of the group law. Case 2: and , so and the sum is . Case 3: is invertible modulo , hence . Both reduced points lie on the curve modulo and , so , and gives . So with , and the group law uses the tangent slope . The formulas for again reduce to those of the group law.
Lemma 2 (multiples). Let be a point modulo with for every prime . If the computation of by double and add (or of as a chain of additions of earlier computed multiples, as in stage two) does not fail, then its result satisfies in for every prime .
Proof. By induction over the additions of the chain. Every intermediate point is a sum of two earlier points of the chain, each of which reduces modulo to the corresponding multiple of , which is in . Lemma 1 then shows that the sum reduces to the sum of the multiples. Double and add computes from and from and , so the final point reduces to .
The point of line L2 satisfies the curve equation modulo by the choice of , so modulo each as well, and Lemma 2 applies to it and to all its computed multiples.
Lemma 3 (detection). Let be a prime factor of and let be a multiplier that the algorithm computes, in stage one or with in stage two. If the order of in divides , then the computation of fails, or it gives the point modulo , or an earlier step does one of these.
Proof. Suppose no step fails and the result is a pair . By Lemma 2, , as the order divides . But the reduction of a pair is a pair, not . This contradiction shows that a step fails or .
Lemma 4 (a failure gives a proper factor). If an addition fails, then .
Proof. A failure means . In case 1, by the case condition, so and . In case 3, , since would be case 2, so again . The test of line L6 is therefore a safeguard that never rejects.
Theorem. ECM stops, and it returns or a proper factor of . If for some curve and some prime the order of divides , or divides for a prime , then that curve ends in a failure that returns a proper factor, or with a point modulo .
Proof. Termination. There are curves. For each, line L4 does multiplications with additions each, and line L5 builds a table of at most points and does one addition per prime in , so each curve does finitely many additions, each of finitely many operations modulo .
Correctness. Line L3 returns only if . Line L6 returns only if , and a gcd with divides . So any value returned other than is a proper factor. A prime has none, so then the output is .
Detection. Stage one computes of the current point for each prime power step, so its last point is ; stage two computes by the chain , , and so on, where each table entry is a chain of additions of . By Lemma 3, if the order of divides or , a failure or the point happens no later than that multiple. By Lemma 4, a failure returns a proper factor.