Proofs: Number field sieve for discrete logarithms
These are the human proofs of Number field sieve for discrete logarithms, at full length.
Correctness of the quadratic number field sieve for discrete logarithms full
This proof shows: correctness, termination.
We prove the version of the main pseudocode, with such that is the ring of integers of an imaginary quadratic field of class number , and with and . Let be prime, , cyclic of order , let have order and let . Let be the generator of line L3 and the logarithm of to base . Let over the prime powers with ; then . The bound satisfies . For with we write for the logarithm of . For termination we treat the exponents of lines L9 and L13 and the column of line L9 as independent and uniform.
Lemma 1 (membership and the trivial target). Line L1 returns NONE exactly when , and line L2 is correct.
Proof. is cyclic, so its only subgroup of order is , which is . If , then .
From now on with , unique because has order , and , so and .
Lemma 2 (the two maps). Let . Then , the map , , is a ring map, and for all integers .
Proof. , and , so is a unit modulo and . Since and is a root of in , the evaluation defines a ring map. Finally .
Lemma 3 (the factor bases). Every column has a nonzero image in , so its logarithm is defined: , the primes , the unit generator , every listed generator , and . Every nonzero that is a product of prime ideals of norm at most is for unique and exponents .
Proof. A prime and are not divisible by , and . Units map to units. For a generator with norm , we have , so . The ring is a principal ideal domain, hence has unique factorization into primes up to units. The list holds exactly one generator for each prime ideal of norm at most : the implementation enumerates all elements of norm at most , keeps those of prime norm and the inert rational primes with , which are all the prime elements of norm at most , and keeps one canonical associate of each. The unit group is finite and cyclic, generated by , so the unit factor is .
Lemma 4 (relations). Every row of satisfies , where and are the logarithms of the images under .
Proof. A row from line L7 has , , and . By Lemma 2, , which is nonzero modulo . Applying and to both factorizations gives , which is the row with , the negated , and right side . A row from line L10 has , where is the image of column and is absent if is none; the balanced residue is congruent to . Applying gives , which is the row with in column and right side .
Lemma 5 (SOLVE). Let with prime and . If SOLVE returns a vector , then equals the vector of true logarithms of the columns modulo .
Proof. By Lemma 4, the true vector modulo satisfies every row modulo , because . Lines L19 and L20 swap two rows, multiply a row by a unit modulo (an entry not divisible by is coprime to ), or subtract a multiple of one row from another. Each operation is invertible, so the set of solutions modulo is unchanged, and is still a solution afterwards. After column has been processed, row has a in column and every other row has there, and later steps keep this. When all columns are processed, row reads (right side of row ), so the returned equals .
Lemma 6 (scale). After line L11, is the vector of true logarithms of the columns modulo .
Proof. Line L11 is passed only when every SOLVE succeeded, so Lemma 5 applies to each . The moduli are pairwise coprime, and the Chinese remainder theorem gives a unique residue modulo with these reductions.
Lemma 7 (medium primes). If line L14 assigns a value to , the value is the true .
Proof. is a prime factor of a nonzero residue with , so and is defined. Line L14 accepts only if , with , and . As in Lemma 4, , and so modulo . Since is a unit modulo , solving for and replacing the column logarithms by , by Lemma 6, gives the value of line L14.
Lemma 8 (individual logarithms). For , the value of line L16 is the true .
Proof. Line L15 is passed only when the balanced residue of equals and every got a value. Then , where the sign is the first entry of the rational exponent vector. Reducing modulo and using Lemmas 6 and 7 gives line L16.
Lemma 9 (conversion). With , the residue is for an integer coprime to , the residue is divisible by , and .
Proof. Since has order and has order , . For each prime with and , the -adic valuation of , taken in , is exactly , which is the valuation of at , and has no other prime factors. Reducing modulo does not change a valuation below , so with coprime to . Next, gives , so , and multiplying by gives .
Correctness. By Lemmas 8 and 9, line L18 returns . With Lemma 1, the algorithm returns if and NONE otherwise.
Termination. The loop of lines L5 to L7 runs over a finite set of pairs. For the loop of lines L8 to L11, we exhibit for each column a row whose only nonzero entry is in that column, and which line L10 appends with positive probability in each trial. For a prime , take = none and : since , the balanced residue is itself, and the row is . For , take = none and : the balanced residue is , and the row has and nothing else. For an algebraic column , take : then , and the row has in column only. With probability , every column eventually gets such a row, and eventually has at least rows. Once these rows are present, every SOLVE succeeds: the row with its only nonzero entry in column has entry in every earlier column, so it is never a pivot for an earlier column and is never changed by the clearing steps, which subtract multiples of a pivot row only from rows with a nonzero entry in the pivot column; swaps at a column move it only among positions at least , so it is still available when column is processed, and its entry is a unit pivot. The implementation retries SOLVE after each new row of line L10. For the loop of lines L13 to L15, each trial has with probability ; then there are no , and line L15 is passed. Each search of line L14 is over a finite set. Hence the algorithm stops with probability .