Algorithm Search⌘K

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 n≥1n \ge 1 linearly independent rows b1,…,bn∈Qmb_1, \ldots, b_n \in \mathbb{Q}^m, a block size β≥2\beta \ge 2 and a parameter δ\delta with 1/4<δ≤11/4 < \delta \le 1. We write bi∗b_i^* for the Gram-Schmidt vectors, Ni=∥bi∗∥2N_i = \|b_i^*\|^2, μij=⟨bi,bj∗⟩/Nj\mu_{ij} = \langle b_i, b_j^* \rangle / N_j for j<ij < i, and πk\pi_k for the orthogonal projection onto span⁡(b1,…,bk−1)⊥\operatorname{span}(b_1, \ldots, b_{k-1})^\perp. For 1≤k≤n1 \le k \le n let h(k)=min⁡(k+β−1,n)h(k) = \min(k + \beta - 1, n) and let

L[k]=πk(L(bk,…,bh(k)))L_{[k]} = \pi_k\big(L(b_k, \ldots, b_{h(k)})\big)

be the projected block lattice, with basis πk(bk),…,πk(bh(k))\pi_k(b_k), \ldots, \pi_k(b_{h(k)}). Indices are 1,…,n1, \ldots, n here; the implementation counts from 0. Write Dj=N1⋯NjD_j = N_1 \cdots N_j, the Gram determinant of b1,…,bjb_1, \ldots, b_j.

A basis is BKZ-reduced with block size β\beta and parameter δ\delta if it is LLL-reduced with parameter δ\delta (size-reduced, ∣μij∣≤1/2|\mu_{ij}| \le 1/2, and Nk+1+μk+1,k2Nk≥δNkN_{k+1} + \mu_{k+1,k}^2 N_k \ge \delta N_k) and

δNk≤λ1(L[k])2for k=1,…,n.(1)\delta N_k \le \lambda_1(L_{[k]})^2 \qquad \text{for } k = 1, \ldots, n. \tag{1}

For k=nk = n the block lattice is Zbn∗\mathbb{Z} b_n^*, so (1) holds for every basis; only k≤n−1k \le n - 1 needs checking.

Lemma 1 (the block coordinates). For a coefficient vector x∈Zdx \in \mathbb{Z}^d, d=h−k+1d = h - k + 1, write v=∑j=0d−1xjbk+jv = \sum_{j=0}^{d-1} x_j b_{k+j}. Then

∥πk(v)∥2=∑j=0d−1(xj−cj)2Nk+j,cj=−∑i=j+1d−1xiμk+i,k+j,\|\pi_k(v)\|^2 = \sum_{j=0}^{d-1} (x_j - c_j)^2 N_{k+j}, \qquad c_j = -\sum_{i = j+1}^{d-1} x_i \mu_{k+i, k+j},

and πk(v)=0\pi_k(v) = 0 only for x=0x = 0.

Proof. Each bk+i=bk+i∗+∑l<k+iμk+i,lbl∗b_{k+i} = b_{k+i}^* + \sum_{l < k+i} \mu_{k+i, l} b_l^*, and πk\pi_k removes the terms with l<kl < k. Collecting the coefficient of bk+j∗b_{k+j}^* gives xj+∑i>jxiμk+i,k+j=xj−cjx_j + \sum_{i > j} x_i \mu_{k+i,k+j} = x_j - c_j. The bl∗b_l^* are pairwise orthogonal, so the squared length is the weighted sum. If it is 0, then xd−1=cd−1=0x_{d-1} = c_{d-1} = 0, then xd−2=cd−2=0x_{d-2} = c_{d-2} = 0, and so on down to x0=0x_0 = 0. □\square

Lemma 2 (the block oracle is exact). On line L4, the enumeration returns a nonzero x∈Zdx \in \mathbb{Z}^d with ∥πk(∑jxjbk+j)∥2=λ1(L[k])2\|\pi_k(\sum_j x_j b_{k+j})\|^2 = \lambda_1(L_{[k]})^2, and the value it returns is this squared length.

Proof. The search keeps a value best\mathit{best}, initially NkN_k, the squared length for x=(1,0,…,0)x = (1, 0, \ldots, 0), so best\mathit{best} is always the squared length of some nonzero vector of L[k]L_{[k]} and never increases. It fixes xd−1,xd−2,…,x0x_{d-1}, x_{d-2}, \ldots, x_0 in this order. With xj+1,…,xd−1x_{j+1}, \ldots, x_{d-1} fixed, let ρj+1=∑i>j(xi−ci)2Nk+i\rho_{j+1} = \sum_{i > j} (x_i - c_i)^2 N_{k+i}; by Lemma 1 every completion has squared length at least ρj+1+(xj−cj)2Nk+j\rho_{j+1} + (x_j - c_j)^2 N_{k+j}. Call xjx_j feasible when this partial value is at most best\mathit{best}.

At a new level the scan starts at xj=⌊cj⌋−⌊⌊q⌋⌋−1x_j = \lfloor c_j \rfloor - \lfloor \sqrt{\lfloor q \rfloor} \rfloor - 1 with q=max⁡(best−ρj+1,0)/Nk+jq = \max(\mathit{best} - \rho_{j+1}, 0) / N_{k+j}. Every integer x≤x \le this start has cj−x≥⌊⌊q⌋⌋+1>qc_j - x \ge \lfloor \sqrt{\lfloor q \rfloor} \rfloor + 1 > \sqrt q, because (⌊⌊q⌋⌋+1)2(\lfloor \sqrt{\lfloor q \rfloor} \rfloor + 1)^2 is an integer above ⌊q⌋\lfloor q \rfloor, so it is at least ⌊q⌋+1>q\lfloor q \rfloor + 1 > q. Hence (x−cj)2Nk+j>best−ρj+1(x - c_j)^2 N_{k+j} > \mathit{best} - \rho_{j+1}, and no value below the start is feasible. The scan then raises xjx_j by 1 while xjx_j is infeasible and xj≤cjx_j \le c_j. If it stops at an infeasible xj>cjx_j > c_j, every larger integer is further from cjc_j and also infeasible, so the level is finished. Otherwise xjx_j is feasible, and the search descends; when it comes back, it continues with xj+1x_j + 1. Because best\mathit{best} 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 best\mathit{best} is reached; at a leaf j=0j = 0, the search replaces best\mathit{best} when the value is smaller and x≠0x \ne 0.

Every level scans a bounded interval of integers, of length at most 2Nk/Nk+j+32 \sqrt{N_k / N_{k+j}} + 3, so the search ends. At the end, best\mathit{best} is at most the squared length of every nonzero xx, and it is attained by the stored xx. □\square

Lemma 3 (the inserted vector is primitive). If line L5 succeeds, the coefficient vector xx has gcd⁡(x0,…,xd−1)=1\gcd(x_0, \ldots, x_{d-1}) = 1.

Proof. The map x↦πk(∑jxjbk+j)x \mapsto \pi_k(\sum_j x_j b_{k+j}) is linear and injective by Lemma 1. If g=gcd⁡(x)>1g = \gcd(x) > 1, then x/gx / g is a nonzero integer vector whose image has squared length ∥πk(v)∥2/g2<∥πk(v)∥2\|\pi_k(v)\|^2 / g^2 < \|\pi_k(v)\|^2, which contradicts the minimality from Lemma 2. □\square

Lemma 4 (the insertion). On line L6, with gcd⁡(x)=1\gcd(x) = 1, the procedure replaces bk,…,bhb_k, \ldots, b_h by vectors bk′,…,bh′b_k', \ldots, b_h' that generate the same lattice as bk,…,bhb_k, \ldots, b_h, with bk′=∑jxjbk+jb_k' = \sum_j x_j b_{k+j}. The rows outside positions k,…,hk, \ldots, h do not change.

Proof. The procedure runs j=d−2,…,0j = d-2, \ldots, 0 and keeps a coefficient vector yy, initially xx, with the invariant that ∑jyjbk+j\sum_j y_j b_{k+j} (with the current rows) equals the original v=∑jxjbk+jv = \sum_j x_j b_{k+j} and that yj+1,…,yd−1y_{j+1}, \ldots, y_{d-1} are 0 after step jj. At step jj, if yj=yj+1=0y_j = y_{j+1} = 0 nothing happens. Otherwise let g=gcd⁡(yj,yj+1)>0g = \gcd(y_j, y_{j+1}) > 0 and syj+tyj+1=gs y_j + t y_{j+1} = g, and put p=yj/gp = y_j / g, q=yj+1/gq = y_{j+1} / g. The rows u=bk+ju = b_{k+j}, w=bk+j+1w = b_{k+j+1} become u′=pu+qwu' = p u + q w and w′=−tu+sww' = -t u + s w. The matrix (pq−ts)\begin{pmatrix} p & q \\ -t & s \end{pmatrix} has determinant (syj+tyj+1)/g=1(s y_j + t y_{j+1}) / g = 1, so the two rows generate the same lattice as before, and yju+yj+1w=gu′+0⋅w′y_j u + y_{j+1} w = g u' + 0 \cdot w', so the invariant holds with yj←gy_j \leftarrow g, yj+1←0y_{j+1} \leftarrow 0. After step jj, yjy_j is the gcd of xj,…,xd−1x_j, \ldots, x_{d-1}, up to the case where all of them are 0. After step 0, y=(gcd⁡(x),0,…,0)=(1,0,…,0)y = (\gcd(x), 0, \ldots, 0) = (1, 0, \ldots, 0), so bk′=vb_k' = v. Each step is unimodular on two adjacent rows of the block. □\square

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 DjD_j 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 bi∗b_i^*. A swap of bk−1b_{k-1} and bkb_k is a permutation. By the standard invariant, the rows before the current index are LLL-reduced, so when the index passes nn the basis is LLL-reduced. A swap happens when Nk+μk,k−12Nk−1<δNk−1N_k + \mu_{k,k-1}^2 N_{k-1} < \delta N_{k-1}; the left side is the new Nk−1N_{k-1}, so Dk−1D_{k-1} drops by a factor less than δ≤1\delta \le 1, and DjD_j for j≠k−1j \ne k - 1 is the Gram determinant of the same set of rows, so it is unchanged. Let ss be a common denominator of the input entries; all rows stay in 1sZm\frac1s \mathbb{Z}^m, so s2jDjs^{2j} D_j is a positive integer. The positive integer ∑js2jDj\sum_j s^{2j} D_j decreases at each swap, and between swaps the index rises at most n−1n - 1 times, so the subroutine ends. □\square

Lemma 6 (the loop invariant). At each test of line L2:

  1. the current basis generates the input lattice and is LLL-reduced;
  2. the last zz steps made no insertion, the basis has not changed during them, and condition (1) holds for the zz indices they examined, which are zz consecutive values of kk in the cyclic order 1,2,…,n−1,1,…1, 2, \ldots, n-1, 1, \ldots

Proof. Before the first test, line L1 makes the basis LLL-reduced (Lemma 5) and z=0z = 0. Consider one step at index kk. If line L5 fails, line L4 computed λ1(L[k])2\lambda_1(L_{[k]})^2 exactly (Lemma 2) and found it at least δNk\delta N_k, which is (1) for kk; the basis is unchanged, zz grows by 1, and the next index is the cyclic successor of kk, 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 zz becomes 0, so part 2 holds trivially. □\square

Lemma 7 (termination). The loop ends after at most (I+1)(n−1)(I + 1)(n - 1) steps, where II is the number of insertions, and II is finite.

Proof. Consider an insertion at index kk. Rows b1,…,bk−1b_1, \ldots, b_{k-1} do not change, so D1,…,Dk−1D_1, \ldots, D_{k-1} do not change. The new bk∗b_k^* is πk(v)\pi_k(v), so the new NkN_k is the value from line L4, which is less than δNk≤Nk\delta N_k \le N_k; hence DkD_k strictly decreases. The swaps of the following LLL call each strictly decrease one DjD_j and keep the others. So the tuple T=(s2D1,s4D2,…,s2nDn)T = (s^2 D_1, s^4 D_2, \ldots, s^{2n} D_n) of positive integers strictly decreases in lexicographic order at each insertion and at each swap, even when Dk+1,…D_{k+1}, \ldots grow. The lexicographic order on nn-tuples of positive integers is a well-order, so there are finitely many insertions. A step without insertion raises zz by 1, so at most n−2n - 2 such steps lie between two insertions and at most n−1n - 1 come after the last one, when zz reaches n−1n - 1. Each step terminates, by Lemmas 2 and 5. □\square

Theorem. The procedure terminates and returns a BKZ-reduced basis, with block size β\beta and parameter δ\delta, of the input lattice.

Proof. By Lemma 7 the loop ends, and it ends when z=n−1z = n - 1. By Lemma 6 the basis then generates the input lattice and is LLL-reduced, and the last n−1n - 1 steps examined n−1n - 1 consecutive indices in a cyclic order of length n−1n - 1, which are all of 1,…,n−11, \ldots, n-1, on the same basis. So (1) holds for k≤n−1k \le n - 1, and for k=nk = n it always holds. For n=1n = 1 the loop does not run, and the single row is trivially BKZ-reduced. ■\blacksquare

Back to BKZ algorithm