Proofs: BKZ algorithm
These are the human proofs of BKZ algorithm, at full length.
BKZ with an exact block oracle terminates and returns a BKZ-reduced basis of the same lattice full
This proof shows: correctness, termination.
Setting. The input is linearly independent rows , a block size and a parameter with . We write for the Gram-Schmidt vectors, , for , and for the orthogonal projection onto . For let and let
be the projected block lattice, with basis . Indices are here; the implementation counts from 0. Write , the Gram determinant of .
A basis is BKZ-reduced with block size and parameter if it is LLL-reduced with parameter (size-reduced, , and ) and
For the block lattice is , so (1) holds for every basis; only needs checking.
Lemma 1 (the block coordinates). For a coefficient vector , , write . Then
and only for .
Proof. Each , and removes the terms with . Collecting the coefficient of gives . The are pairwise orthogonal, so the squared length is the weighted sum. If it is 0, then , then , and so on down to .
Lemma 2 (the block oracle is exact). On line L4, the enumeration returns a nonzero with , and the value it returns is this squared length.
Proof. The search keeps a value , initially , the squared length for , so is always the squared length of some nonzero vector of and never increases. It fixes in this order. With fixed, let ; by Lemma 1 every completion has squared length at least . Call feasible when this partial value is at most .
At a new level the scan starts at with . Every integer this start has , because is an integer above , so it is at least . Hence , and no value below the start is feasible. The scan then raises by 1 while is infeasible and . If it stops at an infeasible , every larger integer is further from and also infeasible, so the level is finished. Otherwise is feasible, and the search descends; when it comes back, it continues with . Because only decreases, a value that was infeasible when it was skipped stays infeasible. So every feasible prefix is visited, and every leaf with squared length at most the final is reached; at a leaf , the search replaces when the value is smaller and .
Every level scans a bounded interval of integers, of length at most , so the search ends. At the end, is at most the squared length of every nonzero , and it is attained by the stored .
Lemma 3 (the inserted vector is primitive). If line L5 succeeds, the coefficient vector has .
Proof. The map is linear and injective by Lemma 1. If , then is a nonzero integer vector whose image has squared length , which contradicts the minimality from Lemma 2.
Lemma 4 (the insertion). On line L6, with , the procedure replaces by vectors that generate the same lattice as , with . The rows outside positions do not change.
Proof. The procedure runs and keeps a coefficient vector , initially , with the invariant that (with the current rows) equals the original and that are 0 after step . At step , if nothing happens. Otherwise let and , and put , . The rows , become and . The matrix has determinant , so the two rows generate the same lattice as before, and , so the invariant holds with , . After step , is the gcd of , up to the case where all of them are 0. After step 0, , so . Each step is unimodular on two adjacent rows of the block.
Lemma 5 (the LLL subroutine). Lines L1 and L7 terminate and return an LLL-reduced basis of the same lattice, and each swap they make strictly decreases one and keeps the others.
Proof. The subroutine is LLL with size reduction against all earlier rows. Size reduction subtracts integer multiples of earlier rows, which is unimodular and keeps every . A swap of and is a permutation. By the standard invariant, the rows before the current index are LLL-reduced, so when the index passes the basis is LLL-reduced. A swap happens when ; the left side is the new , so drops by a factor less than , and for is the Gram determinant of the same set of rows, so it is unchanged. Let be a common denominator of the input entries; all rows stay in , so is a positive integer. The positive integer decreases at each swap, and between swaps the index rises at most times, so the subroutine ends.
Lemma 6 (the loop invariant). At each test of line L2:
- the current basis generates the input lattice and is LLL-reduced;
- the last steps made no insertion, the basis has not changed during them, and condition (1) holds for the indices they examined, which are consecutive values of in the cyclic order
Proof. Before the first test, line L1 makes the basis LLL-reduced (Lemma 5) and . Consider one step at index . If line L5 fails, line L4 computed exactly (Lemma 2) and found it at least , which is (1) for ; the basis is unchanged, grows by 1, and the next index is the cyclic successor of , so part 2 holds. If line L5 succeeds, lines L6 and L7 replace the basis by another basis of the same lattice (Lemmas 3, 4 and 5) that is LLL-reduced, and becomes 0, so part 2 holds trivially.
Lemma 7 (termination). The loop ends after at most steps, where is the number of insertions, and is finite.
Proof. Consider an insertion at index . Rows do not change, so do not change. The new is , so the new is the value from line L4, which is less than ; hence strictly decreases. The swaps of the following LLL call each strictly decrease one and keep the others. So the tuple of positive integers strictly decreases in lexicographic order at each insertion and at each swap, even when grow. The lexicographic order on -tuples of positive integers is a well-order, so there are finitely many insertions. A step without insertion raises by 1, so at most such steps lie between two insertions and at most come after the last one, when reaches . Each step terminates, by Lemmas 2 and 5.
Theorem. The procedure terminates and returns a BKZ-reduced basis, with block size and parameter , of the input lattice.
Proof. By Lemma 7 the loop ends, and it ends when . By Lemma 6 the basis then generates the input lattice and is LLL-reduced, and the last steps examined consecutive indices in a cyclic order of length , which are all of , on the same basis. So (1) holds for , and for it always holds. For the loop does not run, and the single row is trivially BKZ-reduced.