Proofs: Deep LLL
These are the human proofs of Deep LLL, at full length.
LLL with deep insertions terminates and returns a size-reduced, deep-reduced basis of the same lattice full
This proof shows: correctness, termination.
Setting. The input is linearly independent rows and a parameter with . We write for the Gram-Schmidt vectors, , , and for the orthogonal projection onto , so that and
Indices are here; the implementation counts from 0. A basis is deep-reduced with parameter if it is size-reduced, for all , and for all .
Lemma 1 (the lattice is preserved). Every step replaces the basis by another basis of the same lattice.
Proof. Line L3 replaces by with and , an elementary unimodular operation. Line L6 moves to position and shifts up by one, a permutation of the rows. Both are integer matrices with determinant .
Lemma 2 (size reduction). After line L3, for every , and the Gram-Schmidt vectors are unchanged.
Proof. Subtracting from does not change or the component of orthogonal to it, so no changes. It changes by for , by for , and not at all for . The loop runs and chooses as the nearest integer to the current , so afterwards , and later iterations (with smaller ) do not touch again.
Lemma 3 (the running value). At line L6 with index , the variable equals .
Proof. Line L4 sets , and line L7 subtracts , which is the difference by the formula above.
Lemma 4 (invariant). Whenever the loop at line L2 tests its condition, the first vectors form a deep-reduced basis of the lattice they generate.
Proof. Initially , and one vector is deep-reduced. Suppose the invariant holds and a pass runs. Line L3 changes only . If no insertion happens, then by Lemma 3 for every , and by Lemma 2 is size-reduced, so the first vectors are deep-reduced, and line L8 increments . If an insertion at position happens, the vectors are unchanged, and so are their Gram-Schmidt data; the new is , and the first vectors are either or, when , the single new vector . In both cases they are deep-reduced.
Lemma 5 (an insertion decreases the Gram determinants lexicographically). Let be the Gram determinant of . An insertion at position leaves unchanged and replaces by a value less than . Size reduction changes no .
Proof. The first vectors are unchanged. The new -th Gram-Schmidt vector is the component of orthogonal to , which is , and the insertion happens only if (Lemma 3). So the new is . Size reduction changes no (Lemma 2).
Termination. Let be a common denominator of the input entries. Every basis in the run generates the same lattice (Lemma 1), so every vector has entries in , and each , a Gram determinant of such vectors, lies in . So the tuple is a tuple of positive integers, and by Lemma 5 it strictly decreases in the lexicographic order at every insertion. The lexicographic order on is a well-order, so there are finitely many insertions. Between two insertions, only increases, so at most passes occur. Hence the algorithm terminates.
Correctness. When the loop exits, , and by Lemma 4 the whole basis is deep-reduced; by Lemma 1 it generates the input lattice. Taking in the deep condition gives , the Lovász condition, so the output is also LLL-reduced with parameter , and the LLL bounds apply: with , .
Theorem. For , the algorithm terminates on every valid input and returns a basis of the same lattice that is size-reduced and deep-reduced with parameter , hence also LLL-reduced. Each pass of the main loop costs arithmetic operations when Gram-Schmidt is recomputed, as in the implementation. The number of passes is finite but is not bounded here by a polynomial; no such bound is known for unrestricted deep insertions.