Dixon lifting returns the rational solution full
This proof shows: correctness, termination.
Let A be an n×n integer matrix with columns a1,…,an, let b∈Zn, and let ∥v∥ be the Euclidean norm. Put H=∏j∥aj∥, D=⌊H⌋+1 and N=⌊H∥b∥⌋+1, the bounds of line L2. The case n=0 is trivial (the empty vector), so let n≥1.
Claim. If detA=0 and line L1 finds a prime p with p∤detA, then DIXON(A,b) stops and returns the unique x∈Qn with Ax=b. If line L1 finds that detA≡0 modulo primes whose product exceeds D, then detA=0 and the answer NONE is correct.
Line L1. Over the field Z/pZ, the matrix Amodp is invertible exactly when detA≡0(modp), so Gauss-Jordan elimination modulo p either returns C with CA≡AC≡I(modp) or reports that p∣detA. By the Hadamard bound, ∣detA∣≤H<D. If distinct primes q1,…,qs all divide detA and q1⋯qs>D, then their product divides detA and exceeds ∣detA∣, so detA=0. Conversely, if detA=0, it has finitely many prime factors, so the search over an infinite set of primes stops.
Termination. Line L3 picks the least k with pk>2ND, which exists since p≥2. The loops of lines L5 and L9 have k and n steps, and the Euclidean algorithm inside line L10 stops because the remainders decrease.
Lifting invariant. Let r0=b, let yi and ri+1 be the values computed in step i, and let xˉi=∑t<iytpt, the value of xˉ before step i. Then for 0≤i≤k, ri is an integer vector and
Axˉi+piri=b.(∗) For i=0 this reads 0+r0=b. Assume (∗) for i. Line L6 sets yi≡Cri(modp), so Ayi≡ACri≡ri(modp). Hence ri−Ayi is divisible by p in every entry, and line L8 gives an integer vector ri+1 with pri+1=ri−Ayi. Then
Axˉi+1+pi+1ri+1=Axˉi+piAyi+pi(ri−Ayi)=Axˉi+piri=b. At the end, with xˉ=xˉk, (∗) gives Axˉ≡b(modpk).
The residues are those of the solution. Let d=detA=0 and let x be the rational solution. By Cramer's rule, xj=detAj(b)/d, where Aj(b) is A with column j replaced by b. By the Hadamard bound applied to the columns of Aj(b), ∣detAj(b)∣≤∥b∥∏i=j∥ai∥≤H∥b∥<N; the middle step uses ∥aj∥≥1, which holds because a zero column would make d=0. Write xj=sj/tj in lowest terms with tj>0. Then tj∣d, so ∣sj∣<N and 0<tj≤∣d∣<D. Since p∤d, d and tj are units modulo pk. Multiply Axˉ≡b by adj(A): dxˉ≡adj(A)b=dx(modpk), so xˉj≡detAj(b)d−1≡sjtj−1, that is,
sj≡tjxˉj(modpk),∣sj∣≤N,0<tj≤D,2ND<pk.(∗∗) Rational reconstruction. Fix j and write m=pk and u=xˉjmodm. The extended Euclidean algorithm on (m,u) produces r0=m, r1=u, t0=0, t1=1 (and σ0=1, σ1=0), and ri+1=ri−1−qiri, ti+1=ti−1−qiti, σi+1=σi−1−qiσi with qi=⌊ri−1/ri⌋, until rℓ=0. Standard facts, each by induction on i:
- (a) σim+tiu=ri.
- (b) σiti+1−σi+1ti=±1.
- (c) For i≥1 the ti alternate in sign, and 1=∣t1∣≤∣t2∣≤⋯. Indeed ti+1=ti−1−qiti with qi≥1, and if ti−1 and ti have opposite signs (or ti−1=0), then ∣ti+1∣=∣ti−1∣+qi∣ti∣≥∣ti∣ with the sign opposite to ti.
Lemma. Let σ,t be integers with t=0, and let j≥1 be the largest index with ∣tj∣≤∣t∣. Then ∣σm+tu∣≥rj.
Proof. If j=ℓ, then rj=0 and there is nothing to prove. Otherwise ∣tj+1∣>∣t∣. By (b), the integer matrix with rows (σj,tj) and (σj+1,tj+1) has determinant ±1, so (σ,t)=α(σj,tj)+β(σj+1,tj+1) for integers α,β, and by (a), σm+tu=αrj+βrj+1. If α=0, then t=βtj+1 with β=0, so ∣t∣≥∣tj+1∣, which is false. If α and β are both nonzero with opposite signs, then αtj and βtj+1 have the same sign by (c), so ∣t∣=∣α∣∣tj∣+∣β∣∣tj+1∣≥∣tj+1∣, false again. So α=0, and β is 0 or has the sign of α. Since rj,rj+1≥0, ∣αrj+βrj+1∣=∣α∣rj+∣β∣rj+1≥rj. □
Now apply the lemma to (∗∗): sj=σm+tju for some integer σ, so with J the largest index such that ∣tJ∣≤tj, we get rJ≤∣sj∣≤N. Line L10 stops at the first index i with ri≤N. Since r0=m>2ND≥N, i≥1, and since rJ≤N, i≤J. By (c), 1≤∣ti∣≤∣tJ∣≤tj≤D, so the test ∣ti∣≤D passes. Finally, by (a), ri≡tiu and sj≡tju(modm), so
sjti−tjri≡tjuti−tjtiu=0(modm),∣sjti−tjri∣≤ND+DN=2ND<m. So sjti=tjri, and the returned fraction ri/ti equals sj/tj=xj.
End. Line L10 recovers every xj, so line L11 returns the solution x, which is unique because detA=0. ■
Remark. The bounds N and D in the proof are the only place where the size of the answer enters. Any valid bounds work; smaller ones shorten the lifting, and the early-termination variant replaces them by a check Ax=b.