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∈Qm. We write L for the lattice they generate, ⟨⋅,⋅⟩ for the inner product and N(v)=⟨v,v⟩. The nearest integer ⌈x⌋=⌊x+1/2⌋ satisfies ∣x−⌈x⌋∣≤1/2. We call a pair (u,v) reduced if N(u)≤N(v) and 2∣⟨u,v⟩∣≤N(u).
Lemma 1 (the pair stays a basis). At every moment, (u,v), the current values of the two variables, is a basis of L.
Proof. At the start (u,v) is (b1,b2) or (b2,b1). Line L4 replaces v by v−qu with q∈Z, which is the unimodular matrix (1−q01) applied to the pair, and lines L1 and L6 apply (0110). Both matrices are integer with determinant ±1, so the new pair generates the same lattice and is again independent. □
In particular u=0 at line L3, so the division is defined.
Lemma 2 (the output is reduced). When line L5 returns, (u,v) is reduced.
Proof. Let u and v be the values before line L4, and μ=⟨u,v⟩/N(u), q=⌈μ⌋. After line L4, ⟨u,v−qu⟩/N(u)=μ−q, which has absolute value at most 1/2. Line L5 returns only if N(v−qu)≥N(u). These are the two conditions. □
Lemma 3 (a reduced pair reaches the minima). If (u,v) is a reduced basis of L, then N(u)=λ1(L)2 and N(v)=λ2(L)2.
Proof. Let w=xu+yv with integers (x,y)=(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)), using 2∣⟨u,v⟩∣≤N(u). For integers not both zero, x2−∣xy∣+y2≥1: if ∣x∣≥∣y∣, then x2−∣xy∣+y2=∣x∣(∣x∣−∣y∣)+y2, which is a positive integer unless x=y=0; the other case is symmetric. The last term is at least 0 because N(v)≥N(u). Hence N(w)≥N(u), so u is a shortest nonzero vector and N(u)=λ12.
For λ2: a vector w independent of u has y=0, so y2(N(v)−N(u))≥N(v)−N(u), and N(w)≥N(u)+N(v)−N(u)=N(v). Any two independent lattice vectors include one that is independent of u, so the longer of them has squared norm at least N(v); and the pair (u,v) itself reaches N(v). So N(v)=λ22. □
Lemma 4 (the norms fall geometrically). Number the iterations of the loop of line L2 by k=1,2,…,T, and let rk=N(u) at the start of iteration k. Then r1>r2>⋯>rT, and for every iteration k with 2≤k<T,
rk+1<rk−1/3. Proof. An iteration that does not return ends at line L6 with the new u equal to v−qu, and N(v−qu)<N(u) by line L5. So rk+1<rk.
Fix k with 2≤k<T, and let u,v be the values at the start of iteration k, with r=N(u)=rk and s=N(v)=rk−1, so s>r. The vector u was produced by line L4 of iteration k−1 as the reduction of the old v against the old u, which is now v; by the computation in Lemma 2, c=⟨u,v⟩ satisfies ∣c∣≤s/2. Let q=⌈c/r⌋ and t=N(v−qu)=s−2qc+q2r. Iteration k does not return, so t<r.
- If q=0, then t=s>r, a contradiction.
- If q=1, then c/r≥1/2>0, and t=s−2c+r≥s−s+r=r, a contradiction. The case q=−1 is the same with −c.
So ∣q∣≥2. Write c/r=q+e with ∣e∣≤1/2; then qc=(q2+qe)r≥(q2−∣q∣/2)r, and
t=s−2qc+q2r≤s−(2q2−∣q∣)r+q2r=s−(q2−∣q∣)r≤s−2r. Thus t<r and t≤s−2r. If r≤s/3 then t<r≤s/3; otherwise t≤s−2r<s/3. In both cases rk+1=t<s/3=rk−1/3. □
Theorem. On linearly independent b1,b2∈Qm, the algorithm terminates after
T≤2+2log3λ1(L)2min(N(b1),N(b2)) iterations, and returns a basis (u,v) of L with ∥u∥=λ1(L), ∥v∥=λ2(L) and ∣⟨u,v⟩∣≤∥u∥2/2.
Proof. First, termination. The values rk are squared norms of nonzero lattice vectors (Lemma 1), so rk≥λ12>0. If the loop ran for at least 2j+1 iterations with j≥1, Lemma 4 applied to k=2,4,…,2j gives r2j+1<r1/3j. Since also r2j+1≥λ12, we get 3j<r1/λ12. So the number of such j is finite and the loop ends. With j=⌊(T−1)/2⌋ this reads T≤2j+2<2+2log3(r1/λ12) when T≥3, and the bound holds trivially when T≤2. Line L1 makes r1=min(N(b1),N(b2)).
The output is a basis of L by Lemma 1, reduced by Lemma 2, and reaches the two minima by Lemma 3. ■
Cost. Each iteration does three inner products and one vector update, O(m) arithmetic operations. For an integer input with entries of absolute value below 2β, λ1≥1 and r1≤m22β, so T=O(β+logm). Every vector that appears has squared norm at most max(N(b1),N(b2))+r1/4: the returned v has N(v)≤N(vold∗)+N(u)/4 where vold∗ is the component orthogonal to u, and all other vectors are shorter than an earlier one. So all numbers have O(β+logm) binary digits, and with schoolbook multiplication the total is O(m(β+logm)3) bit operations.