Algorithm Search⌘K

Proofs: Schnorr-Euchner enumeration

These are the human proofs of Schnorr-Euchner enumeration, at full length.

Schnorr-Euchner enumeration returns a shortest nonzero vector after a bounded number of nodes full

This proof shows: correctness, termination, time.worst.

Setting. The input is a list of linearly independent rows b1,…,bn∈Qmb_1, \ldots, b_n \in \mathbb{Q}^m. We write bi∗b_i^* for their Gram-Schmidt vectors, Bi=∥bi∗∥2>0B_i = \|b_i^*\|^2 > 0, μij=⟨bi,bj∗⟩/Bj\mu_{ij} = \langle b_i, b_j^* \rangle / B_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 integers x1,…,xnx_1, \ldots, x_n, let ck(x)=−∑j>kxjμjkc_k(x) = -\sum_{j > k} x_j \mu_{jk} and ℓk(x)=∑i≥k(xi−ci(x))2Bi\ell_k(x) = \sum_{i \ge k} (x_i - c_i(x))^2 B_i, with ℓn+1=0\ell_{n+1} = 0. Both depend only on xk,…,xnx_k, \ldots, x_n (and ckc_k only on xk+1,…,xnx_{k+1}, \ldots, x_n). The line numbers refer to the main block of the page.

Lemma 1 (the identity). For v=∑ixibiv = \sum_i x_i b_i, ∥πk(v)∥2=ℓk(x)\|\pi_k(v)\|^2 = \ell_k(x); in particular ∥v∥2=ℓ1(x)\|v\|^2 = \ell_1(x).

Proof. Substitute bi=bi∗+∑j<iμijbj∗b_i = b_i^* + \sum_{j < i} \mu_{ij} b_j^*:

v=∑ixibi∗+∑i∑j<ixiμijbj∗=∑k(xk+∑j>kxjμjk)bk∗=∑k(xk−ck(x))bk∗.v = \sum_i x_i b_i^* + \sum_i \sum_{j < i} x_i \mu_{ij} b_j^* = \sum_k \Big( x_k + \sum_{j > k} x_j \mu_{jk} \Big) b_k^* = \sum_k (x_k - c_k(x)) b_k^*.

The projection πk\pi_k keeps the terms with index at least kk and removes the others, and the bi∗b_i^* are pairwise orthogonal, so ∥πk(v)∥2=∑i≥k(xi−ci)2Bi\|\pi_k(v)\|^2 = \sum_{i \ge k} (x_i - c_i)^2 B_i. □\square

Lemma 2 (the order at one level). Fix xk+1,…,xnx_{k+1}, \ldots, x_n, so c=ckc = c_k is fixed. The values produced at level kk, starting from ⌈c⌋\lceil c \rfloor at line L7 (or 00 at line L3) and continuing by line L12, are distinct integers in order of nondecreasing ∣xk−c∣|x_k - c|, and so of nondecreasing ℓk\ell_k. In the symmetric case (all of xk+1,…,xnx_{k+1}, \ldots, x_n zero, so c=0c = 0) they are 0,1,2,…0, 1, 2, \ldots, which is every integer z≥0z \ge 0 in order of nondecreasing ∣z−c∣|z - c|.

Proof. Let z0=⌈c⌋z_0 = \lceil c \rfloor, so ∣c−z0∣≤1/2|c - z_0| \le 1/2, and let s=+1s = +1 if c≥z0c \ge z_0 and s=−1s = -1 otherwise. Then cc lies between z0z_0 and z0+s/2z_0 + s/2. The sequence is z0,z0+s,z0−s,z0+2s,z0−2s,…z_0, z_0 + s, z_0 - s, z_0 + 2s, z_0 - 2s, \ldots. Write d=∣c−z0∣≤1/2d = |c - z_0| \le 1/2. The distances are d,1−d,1+d,2−d,2+d,…d, 1 - d, 1 + d, 2 - d, 2 + d, \ldots, that is j−dj - d and j+dj + d for the values z0+jsz_0 + js and z0−jsz_0 - js; since 0≤d≤1/20 \le d \le 1/2, j+d≤(j+1)−dj + d \le (j + 1) - d, so the sequence of distances is nondecreasing. It lists every integer once. Finally ℓk=ℓk+1+(xk−c)2Bk\ell_k = \ell_{k+1} + (x_k - c)^2 B_k with Bk>0B_k > 0 and ℓk+1\ell_{k+1} fixed. In the symmetric case line L12 adds 1 each time and c=0c = 0. □\square

Lemma 3 (the invariant of the result). At every moment, the pair (best, R2R^2) satisfies best ≠0\ne 0 and ∥∑ibestibi∥2=R2\|\sum_i \text{best}_i b_i\|^2 = R^2. Moreover R2R^2 never increases.

Proof. At line L2, best =e1= e_1 and R2=B1=∥b1∥2R^2 = B_1 = \|b_1\|^2. Line L9 is the only line that changes them; it runs at a leaf with x≠0x \ne 0 and ℓ1<R2\ell_1 < R^2, and sets best =x= x and R2=ℓ1(x)=∥∑ixibi∥2R^2 = \ell_1(x) = \|\sum_i x_i b_i\|^2 by Lemma 1, which is smaller than before. □\square

Lemma 4 (the shape of the search). The loop is a depth-first search of the tree whose nodes at level kk are the tuples (xk,…,xn)(x_k, \ldots, x_n) it produces. At a node of level k>1k > 1 that passes the test at line L6, the search descends to level k−1k - 1, tries values there in the order of Lemma 2 (with xk,…,xnx_k, \ldots, x_n fixed), processing the subtree of each value that passes, and returns to level kk exactly when a value at level k−1k - 1 fails. At level 1, a passing value is a leaf, after which the next value is tried.

Proof. Line L7 descends and sets the first value; line L5 evaluates the node. If it passes and k>1k > 1, line L7 descends again. If it passes at k=1k = 1, lines L8 and L9 handle the leaf and line L12 moves to the next value at the same level. If it fails, line L10 goes up one level and line L12 moves to the next value there. The variables xjx_j for jj above the current level are not changed while the search is below them, so they stay fixed during a subtree. □\square

Theorem 1 (termination). The loop terminates.

Proof. At a fixed level with fixed higher coordinates, the values xkx_k tried are distinct (Lemma 2), so ∣xk−ck∣→∞|x_k - c_k| \to \infty along them and ℓk≥(xk−ck)2Bk→∞\ell_k \ge (x_k - c_k)^2 B_k \to \infty; since R2≤B1R^2 \le B_1 by Lemma 3, a failing value comes after finitely many values. So each node has finitely many children that pass, plus one that fails. The depth is nn. By König's lemma for this finitely branching tree of finite depth, the tree is finite, and the depth-first search of Lemma 4 visits each node once; it ends when the level nn fails and kk becomes n+1n + 1 at line L11. □\square

Theorem 2 (correctness). The returned best is a nonzero vector of minimal length: ∥∑ibestibi∥=λ1(L)\|\sum_i \text{best}_i b_i\| = \lambda_1(L).

Proof. By Lemma 3, the output is a nonzero lattice vector of squared length Rf2R_f^2, the final radius. Suppose a nonzero u=∑iyibiu = \sum_i y_i b_i had ∥u∥2<Rf2\|u\|^2 < R_f^2. Let tt be the largest index with yt≠0y_t \ne 0; replacing uu by −u-u we may assume yt>0y_t > 0. By Lemma 1, ℓk(y)=∥πk(u)∥2≤∥u∥2<Rf2≤R2\ell_k(y) = \|\pi_k(u)\|^2 \le \|u\|^2 < R_f^2 \le R^2 for every kk and every moment, by Lemma 3.

We show by induction on k=n,n−1,…,1k = n, n - 1, \ldots, 1 that the search visits the node (yk,…,yn)(y_k, \ldots, y_n) and that this node passes. At level nn, the values are tried in the order of Lemma 2 (symmetric case, 0,1,2,…0, 1, 2, \ldots, and yn≥0y_n \ge 0 because either t=nt = n and yn>0y_n > 0 or yn=0y_n = 0). Level nn is left only after a value zz fails, that is ℓn(z)≥R2>ℓn(y)\ell_n(z) \ge R^2 > \ell_n(y); so ∣z−cn∣>∣yn−cn∣|z - c_n| > |y_n - c_n|, and by the nondecreasing order yny_n was tried before zz. When it was tried it passed, since ℓn(y)<R2\ell_n(y) < R^2. The step from kk to k−1k - 1 is the same: after the node (yk,…,yn)(y_k, \ldots, y_n) passes, by Lemma 4 the search tries values at level k−1k - 1 with xk,…,xn=yk,…,ynx_k, \ldots, x_n = y_k, \ldots, y_n until one fails. If k−1<tk - 1 < t, the higher coordinates are not all zero, so the full zig-zag order of Lemma 2 is used and contains yk−1y_{k-1}; if k−1≥tk - 1 \ge t, the symmetric order 0,1,2,…0, 1, 2, \ldots is used, and yk−1≥0y_{k-1} \ge 0 (it is 00 above tt and positive at tt). In both cases the failing value has ℓk−1≥R2>ℓk−1(y)\ell_{k-1} \ge R^2 > \ell_{k-1}(y), so it comes after yk−1y_{k-1}, which was tried and passed.

So the leaf yy is reached and passes, with y≠0y \ne 0, and line L9 sets R2=∥u∥2<Rf2R^2 = \|u\|^2 < R_f^2. Since R2R^2 never increases, the final radius is at most ∥u∥2\|u\|^2, a contradiction. □\square

Theorem 3 (CVP). With the centers ck=τk−∑j>kxjμjkc_k = \tau_k - \sum_{j > k} x_j \mu_{jk}, where τk=⟨t,bk∗⟩/Bk\tau_k = \langle t, b_k^* \rangle / B_k, without the symmetry rule and the test x≠0x \ne 0, and started from Babai's vector xBx^B with R2=ℓ1(xB)R^2 = \ell_1(x^B), the search returns xx minimizing ∥t−∑ixibi∥\|t - \sum_i x_i b_i\|.

Proof. Write t=t⊥+∑kτkbk∗t = t_\perp + \sum_k \tau_k b_k^* with t⊥t_\perp orthogonal to span⁡(L)\operatorname{span}(L). As in Lemma 1, t−∑ixibi=t⊥+∑k(ck−xk)bk∗t - \sum_i x_i b_i = t_\perp + \sum_k (c_k - x_k) b_k^*, so ∥t−v∥2=∥t⊥∥2+ℓ1(x)\|t - v\|^2 = \|t_\perp\|^2 + \ell_1(x) and the partial sums ℓk\ell_k are nondecreasing as kk decreases. Lemmas 2 to 4 and Theorem 1 hold unchanged, using the full zig-zag order at every level. If some yy had ℓ1(y)<Rf2\ell_1(y) < R_f^2, the induction of Theorem 2 (without the sign normalization) shows that its leaf is reached and passes, and line L9 would lower R2R^2 below Rf2R_f^2; so the result, which is xBx^B or a later leaf, minimizes ℓ1\ell_1, hence the distance. □\square

Theorem 4 (the number of nodes). The number NN of executions of line L5 satisfies

N≤1+2P,P≤∑k=1n∏i=kn(2B1/Bi+1),N \le 1 + 2 P, \qquad P \le \sum_{k=1}^n \prod_{i=k}^n \Big( 2 \sqrt{B_1 / B_i} + 1 \Big),

where PP is the number of passing nodes. If the basis is δ\delta-LLL-reduced with 1/4<δ≤11/4 < \delta \le 1 and α=1/(δ−1/4)\alpha = 1 / (\delta - 1/4), then N≤1+2n 3nαn(n−1)/4N \le 1 + 2 n \, 3^n \alpha^{n(n-1)/4}, and the total cost is O(n2m+nN)O(n^2 m + n N) arithmetic operations.

Proof. Every node either passes or fails. By Lemma 4, a failing node at level k<nk < n ends the trial of values below a passing node of level k+1k + 1, and each passing node of level k+1≥2k + 1 \ge 2 has exactly one failing child; at level nn exactly one node fails, the last one. So the number of failing nodes is at most P+1P + 1, and N≤2P+1N \le 2P + 1.

A passing node (xk,…,xn)(x_k, \ldots, x_n) has ℓk(x)<R2≤B1\ell_k(x) < R^2 \le B_1, by Lemma 3. Given xk+1,…,xnx_{k+1}, \ldots, x_n, the number of integers xkx_k with (xk−ck)2Bk<B1(x_k - c_k)^2 B_k < B_1 is at most 2B1/Bk+12 \sqrt{B_1 / B_k} + 1, as they lie in an open interval of length 2B1/Bk2 \sqrt{B_1 / B_k}. Multiplying over the levels i=n,…,ki = n, \ldots, k bounds the passing nodes at level kk by ∏i≥k(2B1/Bi+1)\prod_{i \ge k} (2 \sqrt{B_1 / B_i} + 1), and summing over kk bounds PP.

For a δ\delta-LLL-reduced basis, B1≤αi−1BiB_1 \le \alpha^{i-1} B_i (consequence (a) on LLL-reduced basis), so each factor is at most 2α(i−1)/2+1≤3α(i−1)/22 \alpha^{(i-1)/2} + 1 \le 3 \alpha^{(i-1)/2}, as α≥1\alpha \ge 1. The product over i=k,…,ni = k, \ldots, n is at most 3nα∑i=1n(i−1)/2=3nαn(n−1)/43^n \alpha^{\sum_{i=1}^n (i-1)/2} = 3^n \alpha^{n(n-1)/4}, and there are nn values of kk.

For the cost: line L1 takes O(n2m)O(n^2 m) operations; at each node line L5 takes O(1)O(1) operations, the center at line L7 takes O(n)O(n), and lines L9 and L12 take O(n)O(n) (copying best, testing x≠0x \ne 0 and the symmetric case, which an implementation can also maintain in O(1)O(1) by tracking the highest nonzero index). So the search takes O(nN)O(n N). □\square

Back to Schnorr-Euchner enumeration