Algorithm Search⌘K

Proofs: Babai nearest plane algorithm

These are the human proofs of Babai nearest plane algorithm, at full length.

The nearest plane method returns a lattice vector whose error has Gram-Schmidt coordinates at most one half, decodes within half the shortest Gram-Schmidt vector, and approximates CVP within 2^(n/2) on LLL-reduced bases full

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

Setting. The input is n≥1n \ge 1 linearly independent rows b1,…,bn∈Qmb_1, \ldots, b_n \in \mathbb{Q}^m and a target t∈Qmt \in \mathbb{Q}^m. We write LL for the lattice they generate, b1∗,…,bn∗b_1^*, \ldots, b_n^* for the Gram-Schmidt vectors, Ni=∥bi∗∥2>0N_i = \|b_i^*\|^2 > 0, and μij=⟨bi,bj∗⟩/Nj\mu_{ij} = \langle b_i, b_j^* \rangle / N_j. Then bi=bi∗+∑j<iμijbj∗b_i = b_i^* + \sum_{j < i} \mu_{ij} b_j^*, so ⟨bi,bj∗⟩=0\langle b_i, b_j^* \rangle = 0 for i<ji < j and ⟨bi,bi∗⟩=Ni\langle b_i, b_i^* \rangle = N_i. The nearest integer is ⌈z⌋=⌊z+1/2⌋\lceil z \rfloor = \lfloor z + 1/2 \rfloor, so −1/2≤z−⌈z⌋<1/2-1/2 \le z - \lceil z \rfloor < 1/2. Indices in the loop at line L3 run i=n,n−1,…,1i = n, n - 1, \ldots, 1; w(i)w^{(i)} denotes the value of ww after the iteration for ii, and w(n+1)=tw^{(n+1)} = t.

Lemma 1 (invariant). For every ii, w(i)=t−∑j≥ixjbjw^{(i)} = t - \sum_{j \ge i} x_j b_j with integers xjx_j. Hence the output v=t−w(1)=∑jxjbjv = t - w^{(1)} = \sum_j x_j b_j lies in LL, with coefficients xx.

Proof. Line L2 sets w=tw = t, and each pass of line L5 subtracts xibix_i b_i with the integer xix_i of line L4. □\square

Lemma 2 (the error). Write t−v=o+∑i=1ncibi∗t - v = o + \sum_{i=1}^n c_i b_i^* with oo orthogonal to span⁡(L)\operatorname{span}(L). Then −1/2≤ci<1/2-1/2 \le c_i < 1/2 for every ii. In particular ∥t−v∥2≤∥o∥2+14∑iNi\|t - v\|^2 \le \|o\|^2 + \tfrac14 \sum_i N_i.

Proof. Fix ii. Line L4 sets xi=⌈⟨w(i+1),bi∗⟩/Ni⌋x_i = \lceil \langle w^{(i+1)}, b_i^* \rangle / N_i \rfloor, and line L5 gives ⟨w(i),bi∗⟩/Ni=⟨w(i+1),bi∗⟩/Ni−xi\langle w^{(i)}, b_i^* \rangle / N_i = \langle w^{(i+1)}, b_i^* \rangle / N_i - x_i, which lies in [−1/2,1/2)[-1/2, 1/2). The later iterations subtract multiples of bjb_j with j<ij < i, and ⟨bj,bi∗⟩=0\langle b_j, b_i^* \rangle = 0, so ⟨w(1),bi∗⟩=⟨w(i),bi∗⟩\langle w^{(1)}, b_i^* \rangle = \langle w^{(i)}, b_i^* \rangle. Since w(1)=t−vw^{(1)} = t - v and the bk∗b_k^* are orthogonal, ci=⟨t−v,bi∗⟩/Ni∈[−1/2,1/2)c_i = \langle t - v, b_i^* \rangle / N_i \in [-1/2, 1/2). The bound follows from Pythagoras. □\square

Lemma 3 (the first wrong coefficient). Let u=∑izibiu = \sum_i z_i b_i be any lattice vector and e=t−ue = t - u. If x≠zx \ne z, let kk be the largest index with xk≠zkx_k \ne z_k. Then ∥e∥≥12∥bk∗∥\|e\| \ge \tfrac12 \|b_k^*\|.

Proof. For j>kj > k, xj=zjx_j = z_j, so w(k+1)=t−∑j>kzjbj=e+∑j≤kzjbjw^{(k+1)} = t - \sum_{j > k} z_j b_j = e + \sum_{j \le k} z_j b_j. Taking the inner product with bk∗b_k^* and dividing by NkN_k gives zk+εz_k + \varepsilon with ε=⟨e,bk∗⟩/Nk\varepsilon = \langle e, b_k^* \rangle / N_k, because ⟨bj,bk∗⟩=0\langle b_j, b_k^* \rangle = 0 for j<kj < k. Line L4 rounds zk+εz_k + \varepsilon to zk+⌈ε⌋z_k + \lceil \varepsilon \rfloor, and this differs from zkz_k, so ⌈ε⌋≠0\lceil \varepsilon \rfloor \ne 0 and ∣ε∣≥1/2|\varepsilon| \ge 1/2. By Cauchy-Schwarz ∥e∥≥∣⟨e,bk∗⟩∣/∥bk∗∥=∣ε∣∥bk∗∥≥12∥bk∗∥\|e\| \ge |\langle e, b_k^* \rangle| / \|b_k^*\| = |\varepsilon| \|b_k^*\| \ge \tfrac12 \|b_k^*\|. □\square

Lemma 4 (decoding). If some u∈Lu \in L satisfies ∥t−u∥<12min⁡i∥bi∗∥\|t - u\| < \tfrac12 \min_i \|b_i^*\|, then v=uv = u.

Proof. Otherwise Lemma 3 gives an index kk with ∥t−u∥≥12∥bk∗∥≥12min⁡i∥bi∗∥\|t - u\| \ge \tfrac12 \|b_k^*\| \ge \tfrac12 \min_i \|b_i^*\|. □\square

Lemma 5 (approximation). Let uu be a closest lattice vector to tt. Then

∥t−v∥2≤(1+max⁡1≤k≤n∑i≤kNiNk)∥t−u∥2.\|t - v\|^2 \le \Big(1 + \max_{1 \le k \le n} \sum_{i \le k} \frac{N_i}{N_k}\Big) \|t - u\|^2.

Proof. If v=uv = u there is nothing to prove. Otherwise let kk be as in Lemma 3, e=t−ue = t - u. The difference v−u=∑j≤k(xj−zj)bjv - u = \sum_{j \le k} (x_j - z_j) b_j lies in span⁡(b1,…,bk)=span⁡(b1∗,…,bk∗)\operatorname{span}(b_1, \ldots, b_k) = \operatorname{span}(b_1^*, \ldots, b_k^*). So t−vt - v and ee have the same component oo orthogonal to span⁡(L)\operatorname{span}(L) and the same coordinates along bi∗b_i^* for i>ki > k. With Lemma 2 for the coordinates i≤ki \le k,

∥t−v∥2=∥o∥2+∑i>k⟨e,bi∗⟩2Ni+∑i≤kci2Ni≤∥e∥2+14∑i≤kNi.\|t - v\|^2 = \|o\|^2 + \sum_{i > k} \frac{\langle e, b_i^* \rangle^2}{N_i} + \sum_{i \le k} c_i^2 N_i \le \|e\|^2 + \frac14 \sum_{i \le k} N_i.

Lemma 3 gives 14Nk≤∥e∥2\tfrac14 N_k \le \|e\|^2, so 14∑i≤kNi≤∥e∥2∑i≤kNi/Nk\tfrac14 \sum_{i \le k} N_i \le \|e\|^2 \sum_{i \le k} N_i / N_k, and the claim follows. □\square

Corollary (LLL-reduced bases). If the basis is LLL-reduced with parameter δ∈(1/4,1]\delta \in (1/4, 1] and α=1/(δ−1/4)\alpha = 1/(\delta - 1/4), then ∥t−v∥2≤(1+αn−1α−1)dist⁡(t,L)2\|t - v\|^2 \le \big(1 + \frac{\alpha^n - 1}{\alpha - 1}\big) \operatorname{dist}(t, L)^2. For δ=3/4\delta = 3/4, α=2\alpha = 2 and ∥t−v∥≤2n/2dist⁡(t,L)\|t - v\| \le 2^{n/2} \operatorname{dist}(t, L).

Proof. The Lovász condition and ∣μi+1,i∣≤1/2|\mu_{i+1,i}| \le 1/2 give Ni+1≥(δ−μi+1,i2)Ni≥Ni/αN_{i+1} \ge (\delta - \mu_{i+1,i}^2) N_i \ge N_i / \alpha, so Ni≤αk−iNkN_i \le \alpha^{k - i} N_k for i≤ki \le k. Then ∑i≤kNi/Nk≤∑j=0k−1αj=(αk−1)/(α−1)\sum_{i \le k} N_i / N_k \le \sum_{j=0}^{k-1} \alpha^j = (\alpha^k - 1)/(\alpha - 1), which is largest at k=nk = n. Insert this into Lemma 5. For α=2\alpha = 2 the factor is 1+2n−1=2n1 + 2^n - 1 = 2^n. □\square

Termination and cost. Line L1 computes Gram-Schmidt in O(n2m)O(n^2 m) arithmetic operations. The loop at line L3 runs nn times; line L4 is one inner product, O(m)O(m), and line L5 is O(m)O(m), so the loop costs O(nm)O(n m). The total is O(n2m)O(n^2 m) arithmetic operations, and the algorithm terminates.

Theorem. On every valid input the algorithm returns x∈Znx \in \mathbb{Z}^n and v=xB∈Lv = x B \in L (Lemma 1) such that the Gram-Schmidt coordinates of t−vt - v lie in [−1/2,1/2)[-1/2, 1/2) (Lemma 2). It returns a closest vector whenever dist⁡(t,L)<12min⁡i∥bi∗∥\operatorname{dist}(t, L) < \tfrac12 \min_i \|b_i^*\| (Lemma 4), it is within the factor of Lemma 5 of the optimum on every basis and within 2n/22^{n/2} on bases that are LLL-reduced with δ=3/4\delta = 3/4, and it uses O(n2m)O(n^2 m) arithmetic operations. ■\blacksquare

Back to Babai nearest plane algorithm