Algorithm Search⌘K

Proofs: Babai rounding

These are the human proofs of Babai rounding, at full length.

Babai rounding returns a lattice vector, decodes every error inside the dual box, and stays within a basis-dependent factor of the closest vector 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 of a matrix BB, and a target t∈Qmt \in \mathbb{Q}^m. We write L=L(B)L = L(B), G=BBTG = B B^T for the Gram matrix, and D=G−1BD = G^{-1} B for the dual basis, with rows d1,…,dnd_1, \ldots, d_n. They lie in span⁡(L)\operatorname{span}(L) and satisfy ⟨bi,dj⟩=[i=j]\langle b_i, d_j \rangle = [i = j], because BDT=BBTG−1=IB D^T = B B^T G^{-1} = 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, and ⌈k+z⌋=k+⌈z⌋\lceil k + z \rfloor = k + \lceil z \rfloor for every integer kk.

Lemma 1 (the coordinates). The vector yy computed at line L2 is yi=⟨t,di⟩y_i = \langle t, d_i \rangle. The point p=∑iyibip = \sum_i y_i b_i is the orthogonal projection of tt onto span⁡(L)\operatorname{span}(L).

Proof. Line L2 solves Gy=BtG y = B t. Since GG is a Gram matrix of independent vectors it is nonsingular, and y=G−1Bt=Dty = G^{-1} B t = D t, that is yi=⟨di,t⟩y_i = \langle d_i, t \rangle. For each jj, ⟨t−p,bj⟩=⟨t,bj⟩−(Gy)j=0\langle t - p, b_j \rangle = \langle t, b_j \rangle - (G y)_j = 0, so t−pt - p is orthogonal to the span, and pp lies in it. □\square

Lemma 2 (the output is a lattice vector). The output vv lies in LL, and xx is its coefficient vector.

Proof. Line L3 makes every xix_i an integer, and line L4 sets v=∑ixibi=xBv = \sum_i x_i b_i = x B. □\square

Lemma 3 (decoding). Let t=u+et = u + e with u=zB∈Lu = z B \in L and ∣⟨e,di⟩∣<1/2|\langle e, d_i \rangle| < 1/2 for all ii. Then the algorithm returns x=zx = z and v=uv = u.

Proof. By Lemma 1, yi=⟨zB,di⟩+⟨e,di⟩=zi+εiy_i = \langle z B, d_i \rangle + \langle e, d_i \rangle = z_i + \varepsilon_i with εi=⟨e,di⟩\varepsilon_i = \langle e, d_i \rangle, since ⟨bk,di⟩=[k=i]\langle b_k, d_i \rangle = [k = i]. As ∣εi∣<1/2|\varepsilon_i| < 1/2, ⌈εi⌋=0\lceil \varepsilon_i \rfloor = 0, so xi=⌈zi+εi⌋=zix_i = \lceil z_i + \varepsilon_i \rfloor = z_i. □\square

By Cauchy-Schwarz, ∣⟨e,di⟩∣≤∥e∥∥di∥|\langle e, d_i \rangle| \le \|e\| \|d_i\|, so Lemma 3 applies whenever ∥e∥<1/(2max⁡i∥di∥)\|e\| < 1 / (2 \max_i \|d_i\|).

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

∥t−v∥≤(1+2∑i=1n∥bi∥∥di∥)∥t−u∥.\|t - v\| \le \Big(1 + 2 \sum_{i=1}^n \|b_i\| \|d_i\|\Big) \|t - u\|.

Proof. Write u=zBu = z B and e=t−ue = t - u, and let εi=⟨e,di⟩\varepsilon_i = \langle e, d_i \rangle. As in Lemma 3, yi=zi+εiy_i = z_i + \varepsilon_i and xi=zi+⌈εi⌋x_i = z_i + \lceil \varepsilon_i \rfloor. Hence t−v=e−∑i⌈εi⌋bit - v = e - \sum_i \lceil \varepsilon_i \rfloor b_i. We claim ∣⌈ε⌋∣≤2∣ε∣|\lceil \varepsilon \rfloor| \le 2 |\varepsilon| for every rational ε\varepsilon. If −1/2≤ε<1/2-1/2 \le \varepsilon < 1/2, then ⌈ε⌋=0\lceil \varepsilon \rfloor = 0. If ε=1/2\varepsilon = 1/2, then ⌈ε⌋=1=2ε\lceil \varepsilon \rfloor = 1 = 2 \varepsilon. Otherwise ∣ε∣>1/2|\varepsilon| > 1/2, and ∣⌈ε⌋∣≤∣ε∣+1/2<2∣ε∣|\lceil \varepsilon \rfloor| \le |\varepsilon| + 1/2 < 2 |\varepsilon|. So, with the triangle inequality and Cauchy-Schwarz,

∥t−v∥≤∥e∥+∑i2∣εi∣∥bi∥≤∥e∥+2∑i∥e∥∥di∥∥bi∥,\|t - v\| \le \|e\| + \sum_i 2 |\varepsilon_i| \|b_i\| \le \|e\| + 2 \sum_i \|e\| \|d_i\| \|b_i\|,

which is the claim. □\square

Lemma 5 (distance from the projection). With pp as in Lemma 1, ∥t−v∥2=∥t−p∥2+∥p−v∥2\|t - v\|^2 = \|t - p\|^2 + \|p - v\|^2 and ∥p−v∥≤12∑i∥bi∥\|p - v\| \le \tfrac12 \sum_i \|b_i\|.

Proof. t−pt - p is orthogonal to the span and p−vp - v lies in it, which gives the first identity. Also p−v=∑i(yi−xi)bip - v = \sum_i (y_i - x_i) b_i with ∣yi−xi∣≤1/2|y_i - x_i| \le 1/2, and the triangle inequality gives the bound. □\square

Termination and cost. The algorithm has no loop beyond the fixed loops over indices, so it terminates. Line L1 computes n2n^2 inner products of length mm, which is O(n2m)O(n^2 m) arithmetic operations. Line L2 forms BtB t in O(nm)O(n m) operations and solves an n×nn \times n system by Gauss-Jordan elimination in O(n3)O(n^3) operations. Line L3 takes O(n)O(n) and line L4 takes O(nm)O(n m). The total is O(n2m+n3)O(n^2 m + n^3) arithmetic operations on rationals, and O(nm)O(n m) per further target once DD is stored.

Theorem. On every valid input the algorithm returns x∈Znx \in \mathbb{Z}^n and v=xB∈Lv = x B \in L (Lemma 2). It returns the lattice vector uu whenever t−ut - u lies inside the box ∣⟨t−u,di⟩∣<1/2|\langle t - u, d_i \rangle| < 1/2 (Lemma 3), and in all cases ∥t−v∥\|t - v\| is within the factor 1+2∑i∥bi∥∥di∥1 + 2 \sum_i \|b_i\| \|d_i\| of the distance from tt to LL (Lemma 4). It uses O(n2m+n3)O(n^2 m + n^3) arithmetic operations. ■\blacksquare

Remark (reduced bases). For a basis that is LLL-reduced with δ=3/4\delta = 3/4, Babai (1986) proved that the factor can be bounded by 1+2n(9/2)n/21 + 2n (9/2)^{n/2}, a bound that depends only on nn. That bound is cited, not proved here; the bound of Lemma 4 holds for every basis, and is small exactly when every bib_i is short compared with the inverse of the matching dual vector, that is, when the basis is close to orthogonal.

Back to Babai rounding