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≥1 linearly independent rows b1,…,bn∈Qm of a matrix B, and a target t∈Qm. We write L=L(B), G=BBT for the Gram matrix, and D=G−1B for the dual basis, with rows d1,…,dn. They lie in span(L) and satisfy ⟨bi,dj⟩=[i=j], because BDT=BBTG−1=I. The nearest integer is ⌈z⌋=⌊z+1/2⌋, so −1/2≤z−⌈z⌋<1/2, and ⌈k+z⌋=k+⌈z⌋ for every integer k.
Lemma 1 (the coordinates). The vector y computed at line L2 is yi=⟨t,di⟩. The point p=∑iyibi is the orthogonal projection of t onto span(L).
Proof. Line L2 solves Gy=Bt. Since G is a Gram matrix of independent vectors it is nonsingular, and y=G−1Bt=Dt, that is yi=⟨di,t⟩. For each j, ⟨t−p,bj⟩=⟨t,bj⟩−(Gy)j=0, so t−p is orthogonal to the span, and p lies in it. □
Lemma 2 (the output is a lattice vector). The output v lies in L, and x is its coefficient vector.
Proof. Line L3 makes every xi an integer, and line L4 sets v=∑ixibi=xB. □
Lemma 3 (decoding). Let t=u+e with u=zB∈L and ∣⟨e,di⟩∣<1/2 for all i. Then the algorithm returns x=z and v=u.
Proof. By Lemma 1, yi=⟨zB,di⟩+⟨e,di⟩=zi+εi with εi=⟨e,di⟩, since ⟨bk,di⟩=[k=i]. As ∣εi∣<1/2, ⌈εi⌋=0, so xi=⌈zi+εi⌋=zi. □
By Cauchy-Schwarz, ∣⟨e,di⟩∣≤∥e∥∥di∥, so Lemma 3 applies whenever ∥e∥<1/(2maxi∥di∥).
Lemma 4 (approximation). Let u be a lattice vector closest to t. Then
∥t−v∥≤(1+2i=1∑n∥bi∥∥di∥)∥t−u∥. Proof. Write u=zB and e=t−u, and let εi=⟨e,di⟩. As in Lemma 3, yi=zi+εi and xi=zi+⌈εi⌋. Hence t−v=e−∑i⌈εi⌋bi. We claim ∣⌈ε⌋∣≤2∣ε∣ for every rational ε. If −1/2≤ε<1/2, then ⌈ε⌋=0. If ε=1/2, then ⌈ε⌋=1=2ε. Otherwise ∣ε∣>1/2, and ∣⌈ε⌋∣≤∣ε∣+1/2<2∣ε∣. So, with the triangle inequality and Cauchy-Schwarz,
∥t−v∥≤∥e∥+i∑2∣εi∣∥bi∥≤∥e∥+2i∑∥e∥∥di∥∥bi∥, which is the claim. □
Lemma 5 (distance from the projection). With p as in Lemma 1, ∥t−v∥2=∥t−p∥2+∥p−v∥2 and ∥p−v∥≤21∑i∥bi∥.
Proof. t−p is orthogonal to the span and p−v lies in it, which gives the first identity. Also p−v=∑i(yi−xi)bi with ∣yi−xi∣≤1/2, and the triangle inequality gives the bound. □
Termination and cost. The algorithm has no loop beyond the fixed loops over indices, so it terminates. Line L1 computes n2 inner products of length m, which is O(n2m) arithmetic operations. Line L2 forms Bt in O(nm) operations and solves an n×n system by Gauss-Jordan elimination in O(n3) operations. Line L3 takes O(n) and line L4 takes O(nm). The total is O(n2m+n3) arithmetic operations on rationals, and O(nm) per further target once D is stored.
Theorem. On every valid input the algorithm returns x∈Zn and v=xB∈L (Lemma 2). It returns the lattice vector u whenever t−u lies inside the box ∣⟨t−u,di⟩∣<1/2 (Lemma 3), and in all cases ∥t−v∥ is within the factor 1+2∑i∥bi∥∥di∥ of the distance from t to L (Lemma 4). It uses O(n2m+n3) arithmetic operations. ■
Remark (reduced bases). For a basis that is LLL-reduced with δ=3/4, Babai (1986) proved that the factor can be bounded by 1+2n(9/2)n/2, a bound that depends only on n. That bound is cited, not proved here; the bound of Lemma 4 holds for every basis, and is small exactly when every bi is short compared with the inverse of the matching dual vector, that is, when the basis is close to orthogonal.