Algorithm Search⌘K

Proofs: Dixon p-adic lifting

These are the human proofs of Dixon p-adic lifting, at full length.

Dixon lifting returns the rational solution full

This proof shows: correctness, termination.

Let AA be an n×nn \times n integer matrix with columns a1,…,ana_1, \dots, a_n, let b∈Znb \in \mathbb{Z}^n, and let ∥v∥\|v\| be the Euclidean norm. Put H=∏j∥aj∥H = \prod_j \|a_j\|, D=⌊H⌋+1D = \lfloor H \rfloor + 1 and N=⌊H∥b∥⌋+1N = \lfloor H \|b\| \rfloor + 1, the bounds of line L2. The case n=0n = 0 is trivial (the empty vector), so let n≥1n \ge 1.

Claim. If det⁡A≠0\det A \ne 0 and line L1 finds a prime pp with p∤det⁡Ap \nmid \det A, then DIXON(A,b)(A, b) stops and returns the unique x∈Qnx \in \mathbb{Q}^n with Ax=bAx = b. If line L1 finds that det⁡A≡0\det A \equiv 0 modulo primes whose product exceeds DD, then det⁡A=0\det A = 0 and the answer NONE is correct.

Line L1. Over the field Z/pZ\mathbb{Z}/p\mathbb{Z}, the matrix A mod pA \bmod p is invertible exactly when det⁡A≢0(modp)\det A \not\equiv 0 \pmod p, so Gauss-Jordan elimination modulo pp either returns CC with CA≡AC≡I(modp)CA \equiv AC \equiv I \pmod p or reports that p∣det⁡Ap \mid \det A. By the Hadamard bound, ∣det⁡A∣≤H<D|\det A| \le H < D. If distinct primes q1,…,qsq_1, \dots, q_s all divide det⁡A\det A and q1⋯qs>Dq_1 \cdots q_s > D, then their product divides det⁡A\det A and exceeds ∣det⁡A∣|\det A|, so det⁡A=0\det A = 0. Conversely, if det⁡A≠0\det A \ne 0, it has finitely many prime factors, so the search over an infinite set of primes stops.

Termination. Line L3 picks the least kk with pk>2NDp^k > 2ND, which exists since p≥2p \ge 2. The loops of lines L5 and L9 have kk and nn steps, and the Euclidean algorithm inside line L10 stops because the remainders decrease.

Lifting invariant. Let r0=br_0 = b, let yiy_i and ri+1r_{i+1} be the values computed in step ii, and let xˉi=∑t<iytpt\bar{x}_i = \sum_{t < i} y_t p^t, the value of xˉ\bar{x} before step ii. Then for 0≤i≤k0 \le i \le k, rir_i is an integer vector and

Axˉi+piri=b.(∗)A \bar{x}_i + p^i r_i = b. \qquad (\ast)

For i=0i = 0 this reads 0+r0=b0 + r_0 = b. Assume (∗)(\ast) for ii. Line L6 sets yi≡Cri(modp)y_i \equiv C r_i \pmod p, so Ayi≡ACri≡ri(modp)A y_i \equiv A C r_i \equiv r_i \pmod p. Hence ri−Ayir_i - A y_i is divisible by pp in every entry, and line L8 gives an integer vector ri+1r_{i+1} with p ri+1=ri−Ayip\, r_{i+1} = r_i - A y_i. Then

Axˉi+1+pi+1ri+1=Axˉi+piAyi+pi(ri−Ayi)=Axˉi+piri=b.A \bar{x}_{i+1} + p^{i+1} r_{i+1} = A \bar{x}_i + p^i A y_i + p^i (r_i - A y_i) = A \bar{x}_i + p^i r_i = b.

At the end, with xˉ=xˉk\bar{x} = \bar{x}_k, (∗)(\ast) gives Axˉ≡b(modpk)A \bar{x} \equiv b \pmod{p^k}.

The residues are those of the solution. Let d=det⁡A≠0d = \det A \ne 0 and let xx be the rational solution. By Cramer's rule, xj=det⁡Aj(b)/dx_j = \det A_j(b) / d, where Aj(b)A_j(b) is AA with column jj replaced by bb. By the Hadamard bound applied to the columns of Aj(b)A_j(b), ∣det⁡Aj(b)∣≤∥b∥∏i≠j∥ai∥≤H∥b∥<N|\det A_j(b)| \le \|b\| \prod_{i \ne j} \|a_i\| \le H \|b\| < N; the middle step uses ∥aj∥≥1\|a_j\| \ge 1, which holds because a zero column would make d=0d = 0. Write xj=sj/tjx_j = s_j / t_j in lowest terms with tj>0t_j > 0. Then tj∣dt_j \mid d, so ∣sj∣<N|s_j| < N and 0<tj≤∣d∣<D0 < t_j \le |d| < D. Since p∤dp \nmid d, dd and tjt_j are units modulo pkp^k. Multiply Axˉ≡bA \bar{x} \equiv b by adj⁡(A)\operatorname{adj}(A): dxˉ≡adj⁡(A)b=dx(modpk)d \bar{x} \equiv \operatorname{adj}(A) b = d x \pmod{p^k}, so xˉj≡det⁡Aj(b)d−1≡sjtj−1\bar{x}_j \equiv \det A_j(b) d^{-1} \equiv s_j t_j^{-1}, that is,

sj≡tjxˉj(modpk),∣sj∣≤N,0<tj≤D,2ND<pk.(∗∗)s_j \equiv t_j \bar{x}_j \pmod{p^k}, \qquad |s_j| \le N, \quad 0 < t_j \le D, \quad 2ND < p^k. \qquad (\ast\ast)

Rational reconstruction. Fix jj and write m=pkm = p^k and u=xˉj mod mu = \bar{x}_j \bmod m. The extended Euclidean algorithm on (m,u)(m, u) produces r0=mr_0 = m, r1=ur_1 = u, t0=0t_0 = 0, t1=1t_1 = 1 (and σ0=1\sigma_0 = 1, σ1=0\sigma_1 = 0), and ri+1=ri−1−qirir_{i+1} = r_{i-1} - q_i r_i, ti+1=ti−1−qitit_{i+1} = t_{i-1} - q_i t_i, σi+1=σi−1−qiσi\sigma_{i+1} = \sigma_{i-1} - q_i \sigma_i with qi=⌊ri−1/ri⌋q_i = \lfloor r_{i-1} / r_i \rfloor, until rℓ=0r_\ell = 0. Standard facts, each by induction on ii:

  • (a) σim+tiu=ri\sigma_i m + t_i u = r_i.
  • (b) σiti+1−σi+1ti=±1\sigma_i t_{i+1} - \sigma_{i+1} t_i = \pm 1.
  • (c) For i≥1i \ge 1 the tit_i alternate in sign, and 1=∣t1∣≤∣t2∣≤⋯1 = |t_1| \le |t_2| \le \cdots. Indeed ti+1=ti−1−qitit_{i+1} = t_{i-1} - q_i t_i with qi≥1q_i \ge 1, and if ti−1t_{i-1} and tit_i have opposite signs (or ti−1=0t_{i-1} = 0), then ∣ti+1∣=∣ti−1∣+qi∣ti∣≥∣ti∣|t_{i+1}| = |t_{i-1}| + q_i |t_i| \ge |t_i| with the sign opposite to tit_i.

Lemma. Let σ,t\sigma, t be integers with t≠0t \ne 0, and let j≥1j \ge 1 be the largest index with ∣tj∣≤∣t∣|t_j| \le |t|. Then ∣σm+tu∣≥rj|\sigma m + t u| \ge r_j.

Proof. If j=ℓj = \ell, then rj=0r_j = 0 and there is nothing to prove. Otherwise ∣tj+1∣>∣t∣|t_{j+1}| > |t|. By (b), the integer matrix with rows (σj,tj)(\sigma_j, t_j) and (σj+1,tj+1)(\sigma_{j+1}, t_{j+1}) has determinant ±1\pm 1, so (σ,t)=α(σj,tj)+β(σj+1,tj+1)(\sigma, t) = \alpha (\sigma_j, t_j) + \beta (\sigma_{j+1}, t_{j+1}) for integers α,β\alpha, \beta, and by (a), σm+tu=αrj+βrj+1\sigma m + t u = \alpha r_j + \beta r_{j+1}. If α=0\alpha = 0, then t=βtj+1t = \beta t_{j+1} with β≠0\beta \ne 0, so ∣t∣≥∣tj+1∣|t| \ge |t_{j+1}|, which is false. If α\alpha and β\beta are both nonzero with opposite signs, then αtj\alpha t_j and βtj+1\beta t_{j+1} have the same sign by (c), so ∣t∣=∣α∣∣tj∣+∣β∣∣tj+1∣≥∣tj+1∣|t| = |\alpha| |t_j| + |\beta| |t_{j+1}| \ge |t_{j+1}|, false again. So α≠0\alpha \ne 0, and β\beta is 00 or has the sign of α\alpha. Since rj,rj+1≥0r_j, r_{j+1} \ge 0, ∣αrj+βrj+1∣=∣α∣rj+∣β∣rj+1≥rj|\alpha r_j + \beta r_{j+1}| = |\alpha| r_j + |\beta| r_{j+1} \ge r_j. □\square

Now apply the lemma to (∗∗)(\ast\ast): sj=σm+tjus_j = \sigma m + t_j u for some integer σ\sigma, so with JJ the largest index such that ∣tJ∣≤tj|t_J| \le t_j, we get rJ≤∣sj∣≤Nr_J \le |s_j| \le N. Line L10 stops at the first index ii with ri≤Nr_i \le N. Since r0=m>2ND≥Nr_0 = m > 2ND \ge N, i≥1i \ge 1, and since rJ≤Nr_J \le N, i≤Ji \le J. By (c), 1≤∣ti∣≤∣tJ∣≤tj≤D1 \le |t_i| \le |t_J| \le t_j \le D, so the test ∣ti∣≤D|t_i| \le D passes. Finally, by (a), ri≡tiur_i \equiv t_i u and sj≡tju(modm)s_j \equiv t_j u \pmod m, so

sjti−tjri≡tju ti−tjtiu=0(modm),∣sjti−tjri∣≤ND+DN=2ND<m.s_j t_i - t_j r_i \equiv t_j u\, t_i - t_j t_i u = 0 \pmod m, \qquad |s_j t_i - t_j r_i| \le N D + D N = 2ND < m.

So sjti=tjris_j t_i = t_j r_i, and the returned fraction ri/tir_i / t_i equals sj/tj=xjs_j / t_j = x_j.

End. Line L10 recovers every xjx_j, so line L11 returns the solution xx, which is unique because det⁡A≠0\det A \ne 0. ■\blacksquare

Remark. The bounds NN and DD 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=bA x = b.

Back to Dixon p-adic lifting