Proofs: Wiedemann algorithm
These are the human proofs of Wiedemann algorithm, at full length.
Correctness of the Wiedemann solver full
This proof shows: correctness, termination.
We prove that WIEDEMANN-SOLVE returns only correct answers, that one try succeeds with probability at least where , and hence that it terminates with probability after an expected number of tries at most . Notation is as on the main page: is over a field , , has dimension , and .
Lemma 1. The vectors form a basis of , and .
Proof. Let be the least index with . Then are independent, and by induction every with lies in their span, because multiplying the relation for by expresses through . So . A monic of degree with is a dependence among , so , and the relation for gives such a of degree .
Lemma 2 (annihilators of the sequence). The set of polynomials with for all is an ideal of ; its monic generator is the minimal polynomial of , and divides .
Proof. Writing makes the sequences a -module, and the annihilator of is an ideal, generated by a monic unless it is zero. If , then for all , so is in the ideal and .
Lemma 3 (line L5). Let . The monic polynomial of least degree that annihilates the prefix , which Berlekamp-Massey returns, is . Line L5 uses .
Proof. annihilates the prefix, so the least degree satisfies . Let be monic of degree annihilating the prefix, and let be the sequence with for that generates for all . Then for all , by induction, since both obey the recurrence of there. The sequence is annihilated by , which has degree , and its first terms are zero; since a sequence annihilated by a monic polynomial of degree is determined by its first terms, . So annihilates , , and forces .
Correct outputs. If line L6 reports singularity, then , so by Lemma 2, and divides the minimal polynomial of , which therefore has the root ; so is an eigenvalue of and is singular. If line L9 returns , the test on line L8 has verified . Line L1 returns , the solution for . So every output is correct.
Lemma 4 (a good projection gives the solution). If and is nonsingular, then and the vector of line L7 satisfies .
Proof. would make singular, as above. With and , , so for . Line L7 computes this vector: the Horner loop starts with and after the step for index holds , so it ends with .
Lemma 5 (Hankel criterion). Let be the matrix with entries for . Then if and only if .
Proof. If , then by Lemma 2, and the coefficient vector of , padded with zeros to length , is a nonzero with , since row of is . Conversely, let with , and put and . Then , so by Lemma 1, and for . Since and is -invariant, divides , so every is a combination of , and hence for all . This says that annihilates , so and .
Lemma 6 (probability). If the entries of are drawn independently and uniformly from a finite , then .
Proof. Each entry of is a linear form in , so is a polynomial of total degree at most . It is not the zero polynomial: by Lemma 1 the matrix has rank , so there is with , that is for and . Then has zeros above its anti-diagonal and ones on it, so . By the Schwartz-Zippel lemma, , and Lemma 5 converts this into the claim.
Termination. Each pass of the loop is a finite computation: products on line L4, Berlekamp-Massey on terms, at most products on lines L7 and L8. The tries are independent. By Lemmas 4 and 6, when is nonsingular, each try returns with probability at least , and if this is positive, so the number of tries is geometrically distributed with mean at most and is finite with probability . Over with the success probability is positive even when : it is at least the probability that restricted to generates the dual of as a -module, which is over the distinct irreducible factors of . An implementation that bounds the number of tries reports failure after the bound, which happens with probability at most after tries.
Conclusion. Every output of WIEDEMANN-SOLVE is correct, and for nonsingular it returns the solution after an expected number of tries at most .