Algorithm Search⌘K

Proofs: Lagrange-Gauss reduction

These are the human proofs of Lagrange-Gauss reduction, at full length.

Lagrange-Gauss reduction returns a basis of the same lattice whose vectors reach the two minima, after a logarithmic number of iterations full

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

Setting. The input is two linearly independent vectors b1,b2∈Qmb_1, b_2 \in \mathbb{Q}^m. We write LL for the lattice they generate, ⟨⋅,⋅⟩\langle \cdot, \cdot \rangle for the inner product and N(v)=⟨v,v⟩N(v) = \langle v, v \rangle. The nearest integer ⌈x⌋=⌊x+1/2⌋\lceil x \rfloor = \lfloor x + 1/2 \rfloor satisfies ∣x−⌈x⌋∣≤1/2|x - \lceil x \rfloor| \le 1/2. We call a pair (u,v)(u, v) reduced if N(u)≤N(v)N(u) \le N(v) and 2∣⟨u,v⟩∣≤N(u)2 |\langle u, v \rangle| \le N(u).

Lemma 1 (the pair stays a basis). At every moment, (u,v)(u, v), the current values of the two variables, is a basis of LL.

Proof. At the start (u,v)(u, v) is (b1,b2)(b_1, b_2) or (b2,b1)(b_2, b_1). Line L4 replaces vv by v−quv - q u with q∈Zq \in \mathbb{Z}, which is the unimodular matrix (10−q1)\begin{pmatrix} 1 & 0 \\ -q & 1 \end{pmatrix} applied to the pair, and lines L1 and L6 apply (0110)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. Both matrices are integer with determinant ±1\pm 1, so the new pair generates the same lattice and is again independent. □\square

In particular u≠0u \ne 0 at line L3, so the division is defined.

Lemma 2 (the output is reduced). When line L5 returns, (u,v)(u, v) is reduced.

Proof. Let uu and vv be the values before line L4, and μ=⟨u,v⟩/N(u)\mu = \langle u, v \rangle / N(u), q=⌈μ⌋q = \lceil \mu \rfloor. After line L4, ⟨u,v−qu⟩/N(u)=μ−q\langle u, v - q u \rangle / N(u) = \mu - q, which has absolute value at most 1/21/2. Line L5 returns only if N(v−qu)≥N(u)N(v - q u) \ge N(u). These are the two conditions. □\square

Lemma 3 (a reduced pair reaches the minima). If (u,v)(u, v) is a reduced basis of LL, then N(u)=λ1(L)2N(u) = \lambda_1(L)^2 and N(v)=λ2(L)2N(v) = \lambda_2(L)^2.

Proof. Let w=xu+yvw = x u + y v with integers (x,y)≠(0,0)(x, y) \ne (0, 0). Then

N(w)=x2N(u)+2xy⟨u,v⟩+y2N(v)≥x2N(u)−∣xy∣N(u)+y2N(v)=(x2−∣xy∣+y2)N(u)+y2(N(v)−N(u)),N(w) = x^2 N(u) + 2 x y \langle u, v \rangle + y^2 N(v) \ge x^2 N(u) - |x y| N(u) + y^2 N(v) = (x^2 - |xy| + y^2) N(u) + y^2 (N(v) - N(u)),

using 2∣⟨u,v⟩∣≤N(u)2 |\langle u, v \rangle| \le N(u). For integers not both zero, x2−∣xy∣+y2≥1x^2 - |xy| + y^2 \ge 1: if ∣x∣≥∣y∣|x| \ge |y|, then x2−∣xy∣+y2=∣x∣(∣x∣−∣y∣)+y2x^2 - |xy| + y^2 = |x|(|x| - |y|) + y^2, which is a positive integer unless x=y=0x = y = 0; the other case is symmetric. The last term is at least 0 because N(v)≥N(u)N(v) \ge N(u). Hence N(w)≥N(u)N(w) \ge N(u), so uu is a shortest nonzero vector and N(u)=λ12N(u) = \lambda_1^2.

For λ2\lambda_2: a vector ww independent of uu has y≠0y \ne 0, so y2(N(v)−N(u))≥N(v)−N(u)y^2 (N(v) - N(u)) \ge N(v) - N(u), and N(w)≥N(u)+N(v)−N(u)=N(v)N(w) \ge N(u) + N(v) - N(u) = N(v). Any two independent lattice vectors include one that is independent of uu, so the longer of them has squared norm at least N(v)N(v); and the pair (u,v)(u, v) itself reaches N(v)N(v). So N(v)=λ22N(v) = \lambda_2^2. □\square

Lemma 4 (the norms fall geometrically). Number the iterations of the loop of line L2 by k=1,2,…,Tk = 1, 2, \ldots, T, and let rk=N(u)r_k = N(u) at the start of iteration kk. Then r1>r2>⋯>rTr_1 > r_2 > \cdots > r_T, and for every iteration kk with 2≤k<T2 \le k < T,

rk+1<rk−1/3.r_{k+1} < r_{k-1} / 3.

Proof. An iteration that does not return ends at line L6 with the new uu equal to v−quv - qu, and N(v−qu)<N(u)N(v - qu) < N(u) by line L5. So rk+1<rkr_{k+1} < r_k.

Fix kk with 2≤k<T2 \le k < T, and let u,vu, v be the values at the start of iteration kk, with r=N(u)=rkr = N(u) = r_k and s=N(v)=rk−1s = N(v) = r_{k-1}, so s>rs > r. The vector uu was produced by line L4 of iteration k−1k - 1 as the reduction of the old vv against the old uu, which is now vv; by the computation in Lemma 2, c=⟨u,v⟩c = \langle u, v \rangle satisfies ∣c∣≤s/2|c| \le s/2. Let q=⌈c/r⌋q = \lceil c / r \rfloor and t=N(v−qu)=s−2qc+q2rt = N(v - q u) = s - 2 q c + q^2 r. Iteration kk does not return, so t<rt < r.

  • If q=0q = 0, then t=s>rt = s > r, a contradiction.
  • If q=1q = 1, then c/r≥1/2>0c / r \ge 1/2 > 0, and t=s−2c+r≥s−s+r=rt = s - 2c + r \ge s - s + r = r, a contradiction. The case q=−1q = -1 is the same with −c-c.

So ∣q∣≥2|q| \ge 2. Write c/r=q+ec / r = q + e with ∣e∣≤1/2|e| \le 1/2; then qc=(q2+qe)r≥(q2−∣q∣/2)rq c = (q^2 + q e) r \ge (q^2 - |q|/2) r, and

t=s−2qc+q2r≤s−(2q2−∣q∣)r+q2r=s−(q2−∣q∣)r≤s−2r.t = s - 2 q c + q^2 r \le s - (2 q^2 - |q|) r + q^2 r = s - (q^2 - |q|) r \le s - 2 r.

Thus t<rt < r and t≤s−2rt \le s - 2r. If r≤s/3r \le s/3 then t<r≤s/3t < r \le s/3; otherwise t≤s−2r<s/3t \le s - 2r < s/3. In both cases rk+1=t<s/3=rk−1/3r_{k+1} = t < s/3 = r_{k-1}/3. □\square

Theorem. On linearly independent b1,b2∈Qmb_1, b_2 \in \mathbb{Q}^m, the algorithm terminates after

T≤2+2log⁡3min⁡(N(b1),N(b2))λ1(L)2T \le 2 + 2 \log_3 \frac{\min(N(b_1), N(b_2))}{\lambda_1(L)^2}

iterations, and returns a basis (u,v)(u, v) of LL with ∥u∥=λ1(L)\|u\| = \lambda_1(L), ∥v∥=λ2(L)\|v\| = \lambda_2(L) and ∣⟨u,v⟩∣≤∥u∥2/2|\langle u, v \rangle| \le \|u\|^2 / 2.

Proof. First, termination. The values rkr_k are squared norms of nonzero lattice vectors (Lemma 1), so rk≥λ12>0r_k \ge \lambda_1^2 > 0. If the loop ran for at least 2j+12j + 1 iterations with j≥1j \ge 1, Lemma 4 applied to k=2,4,…,2jk = 2, 4, \ldots, 2j gives r2j+1<r1/3jr_{2j+1} < r_1 / 3^j. Since also r2j+1≥λ12r_{2j+1} \ge \lambda_1^2, we get 3j<r1/λ123^j < r_1 / \lambda_1^2. So the number of such jj is finite and the loop ends. With j=⌊(T−1)/2⌋j = \lfloor (T - 1)/2 \rfloor this reads T≤2j+2<2+2log⁡3(r1/λ12)T \le 2j + 2 < 2 + 2 \log_3(r_1 / \lambda_1^2) when T≥3T \ge 3, and the bound holds trivially when T≤2T \le 2. Line L1 makes r1=min⁡(N(b1),N(b2))r_1 = \min(N(b_1), N(b_2)).

The output is a basis of LL by Lemma 1, reduced by Lemma 2, and reaches the two minima by Lemma 3. ■\blacksquare

Cost. Each iteration does three inner products and one vector update, O(m)O(m) arithmetic operations. For an integer input with entries of absolute value below 2β2^\beta, λ1≥1\lambda_1 \ge 1 and r1≤m 22βr_1 \le m\, 2^{2\beta}, so T=O(β+log⁡m)T = O(\beta + \log m). Every vector that appears has squared norm at most max⁡(N(b1),N(b2))+r1/4\max(N(b_1), N(b_2)) + r_1 / 4: the returned vv has N(v)≤N(vold∗)+N(u)/4N(v) \le N(v_{\text{old}}^*) + N(u)/4 where vold∗v_{\text{old}}^* is the component orthogonal to uu, and all other vectors are shorter than an earlier one. So all numbers have O(β+log⁡m)O(\beta + \log m) binary digits, and with schoolbook multiplication the total is O(m(β+log⁡m)3)O(m (\beta + \log m)^3) bit operations.

Back to Lagrange-Gauss reduction