Algorithm Search⌘K

Proofs: Zeilberger's algorithm

These are the human proofs of Zeilberger's algorithm, at full length.

Zeilberger's algorithm returns a telescoper of least order full

This proof shows: correctness.

Setting. KK is a field of characteristic 00 (in the code, K=QK = \mathbb{Q}), and F=K(n)\mathbb{F} = K(n). The summand is

F(n,k)=poly(n,k) xk∏i(ain+bik+ci)!eiF(n, k) = \mathrm{poly}(n, k)\, x^k \prod_i (a_i n + b_i k + c_i)!^{e_i}

with poly∈K[n,k]\mathrm{poly} \in K[n, k], x∈K∗x \in K^*, integers ai,bi,cia_i, b_i, c_i and ei=±1e_i = \pm 1. A telescoper of order JJ with rational certificate is a vector (α0,…,αJ)∈FJ+1(\alpha_0, \ldots, \alpha_J) \in \mathbb{F}^{J+1}, not all zero, together with R∈K(n,k)R \in K(n, k), such that

∑j=0JαjF(n+j,k)=G(n,k+1)−G(n,k),G=RF.(1)\sum_{j=0}^{J} \alpha_j F(n + j, k) = G(n, k + 1) - G(n, k), \qquad G = R F. \tag{1}

Identity (1) is an identity of hypergeometric terms: after division by F(n,k)F(n, k) it is an identity of rational functions in nn and kk.

Theorem. (a) If the algorithm returns (J,a0,…,aJ,R)(J, a_0, \ldots, a_J, R), then the aja_j are polynomials in nn, not all zero, and (1) holds. (b) JJ is the least order for which a telescoper with rational certificate exists. (c) If the summand is 00, the output is J=0J = 0, a0=1a_0 = 1 and G=0G = 0.

Part (c) is the first line of the code. From now on poly≠0\mathrm{poly} \ne 0.

Lemma 1 (step L2)

For 0≤j≤J0 \le j \le J, F(n+j,k)=H(k) φj(k)F(n + j, k) = H(k)\, \varphi_j(k) with φj∈K[n][k]\varphi_j \in K[n][k], where H(k)=xk∏i(ain+bik+ci′)!eiH(k) = x^k \prod_i (a_i n + b_i k + c_i')!^{e_i} with ci′=ci+min⁡(0,aiJ)c_i' = c_i + \min(0, a_i J) if ei=1e_i = 1 and ci′=ci+max⁡(0,aiJ)c_i' = c_i + \max(0, a_i J) if ei=−1e_i = -1. Also H(k+1)/H(k)=num(k)/den(k)H(k + 1) / H(k) = \mathrm{num}(k) / \mathrm{den}(k), where num and den are a constant times a product of monic linear factors k+u(n)k + u(n), with uu of degree at most 11 in nn.

Proof. Write L=ain+bikL = a_i n + b_i k. If ei=1e_i = 1, then ci+aij≥ci′c_i + a_i j \ge c_i', and (L+ci+aij)!=(L+ci′)!∏l=ci′+1ci+aij(L+l)(L + c_i + a_i j)! = (L + c_i')! \prod_{l = c_i' + 1}^{c_i + a_i j} (L + l). If ei=−1e_i = -1, then ci+aij≤ci′c_i + a_i j \le c_i', and 1/(L+ci+aij)!=(1/(L+ci′)!)∏l=ci+aij+1ci′(L+l)1 / (L + c_i + a_i j)! = \bigl(1 / (L + c_i')!\bigr) \prod_{l = c_i + a_i j + 1}^{c_i'} (L + l). In both cases the extra factor is a polynomial, and φj\varphi_j is poly(n+j,k)\mathrm{poly}(n + j, k) times these products. For the ratio, (L+bi+c)!/(L+c)!(L + b_i + c)! / (L + c)! is ∏l=1bi(L+c+l)\prod_{l=1}^{b_i} (L + c + l) if bi>0b_i > 0, the inverse of ∏l=0−bi−1(L+c−l)\prod_{l=0}^{-b_i - 1} (L + c - l) if bi<0b_i < 0, and 11 if bi=0b_i = 0. Each factor ain+bik+ca_i n + b_i k + c with bi≠0b_i \ne 0 is bi(k+u)b_i (k + u) with u=(ain+c)/biu = (a_i n + c) / b_i. For ei=−1e_i = -1 the factor moves to the other side. □\square

Lemma 2 (step L3)

The output q,r,cq, r, c of the Gosper-Petkovšek step satisfies

H(k+1)H(k)=q(k)r(k+1)⋅c(k+1)c(k),(2)\frac{H(k + 1)}{H(k)} = \frac{q(k)}{r(k + 1)} \cdot \frac{c(k + 1)}{c(k)}, \tag{2}

with q,r,c∈K[n][k]q, r, c \in K[n][k], and gcd⁡(q(k),r(k+h))=1\gcd(q(k), r(k + h)) = 1 in F[k]\mathbb{F}[k] for every integer h≥1h \ge 1.

Proof. Start with q=numq = \mathrm{num}, r(k)=den(k−1)r(k) = \mathrm{den}(k - 1) and c=1c = 1. Then (2) holds. A step removes a factor k+uk + u from qq and a factor k+wk + w from rr with u−w=hu - w = h, an integer h≥1h \ge 1, and multiplies cc by C(k)=∏i=1h−1(k+u−i)C(k) = \prod_{i=1}^{h-1} (k + u - i). The removed part of q(k)/r(k+1)q(k)/r(k+1) is (k+u)/(k+1+u−h)(k + u)/(k + 1 + u - h). A direct computation gives

C(k+1)C(k)=∏i=1h−1(k+u+1−i)∏i=1h−1(k+u−i)=k+uk+u+1−h,\frac{C(k + 1)}{C(k)} = \frac{\prod_{i=1}^{h-1} (k + u + 1 - i)}{\prod_{i=1}^{h-1} (k + u - i)} = \frac{k + u}{k + u + 1 - h},

so (2) still holds. Each step removes two factors, so the loop stops. When it stops, no pair u,wu, w has u−w∈{1,2,…}u - w \in \{1, 2, \ldots\}. Over F\mathbb{F}, q(k)q(k) and r(k+h)r(k + h) are products of monic linear factors k+uk + u and k+w+hk + w + h. They have a common factor exactly when some u=w+hu = w + h, that is, u−w=hu - w = h. So the gcd condition holds. □\square

Lemma 3 (steps L4 to L6, the parametrized Gosper equation)

Fix α∈FJ+1\alpha \in \mathbb{F}^{J+1}, let t(k)=∑jαjF(n+j,k)t(k) = \sum_j \alpha_j F(n + j, k) and P(k)=c(k)∑jαjφj(k)P(k) = c(k) \sum_j \alpha_j \varphi_j(k). If f∈F[k]f \in \mathbb{F}[k] satisfies

q(k)f(k+1)−r(k)f(k)=P(k),(3)q(k) f(k + 1) - r(k) f(k) = P(k), \tag{3}

then G=RFG = R F with R=r(k)f(k)/(c(k)φ0(k))R = r(k) f(k) / (c(k) \varphi_0(k)) satisfies (1). Conversely, if (1) holds for α\alpha with some rational RR, then (3) has a polynomial solution of degree at most the bound DD of L5.

Proof. By Lemma 1, t=H⋅P/ct = H \cdot P / c. If P=0P = 0, then t=0t = 0 and f=0f = 0 solves (3), and R=0R = 0 satisfies (1). Let P≠0P \ne 0. By (2), t(k+1)/t(k)=(P(k+1)/P(k))⋅q(k)/r(k+1)t(k + 1) / t(k) = \bigl(P(k + 1) / P(k)\bigr) \cdot q(k) / r(k + 1). Put z(k)=r(k)f(k)t(k)/P(k)z(k) = r(k) f(k) t(k) / P(k). Then

z(k+1)−z(k)=t(k)P(k)(r(k+1)f(k+1)P(k) t(k+1)P(k+1) t(k)−r(k)f(k))=t(k)P(k)(q(k)f(k+1)−r(k)f(k))=t(k).z(k + 1) - z(k) = \frac{t(k)}{P(k)} \Bigl( r(k + 1) f(k + 1) \frac{P(k)\, t(k + 1)}{P(k + 1)\, t(k)} - r(k) f(k) \Bigr) = \frac{t(k)}{P(k)} \bigl( q(k) f(k + 1) - r(k) f(k) \bigr) = t(k).

Also z=rfH/c=RFz = r f H / c = R F, since F=Hφ0F = H \varphi_0. This proves the first claim.

For the converse, (1) says that tt has the antidifference G=RFG = R F, a rational multiple of tt when t≠0t \ne 0. With the representation of tt's ratio above and the gcd condition of Lemma 2, Gosper's theorem says that then (3) has a polynomial solution ff, of degree deg⁡P−max⁡(deg⁡q,deg⁡r)\deg P - \max(\deg q, \deg r) if deg⁡q≠deg⁡r\deg q \ne \deg r or LC(q)≠LC(r)\mathrm{LC}(q) \ne \mathrm{LC}(r), and otherwise of degree deg⁡P−deg⁡q+1\deg P - \deg q + 1 or s=(rd−1−qd−1)/LC(q)s = (r_{d-1} - q_{d-1}) / \mathrm{LC}(q), where rd−1r_{d-1} and qd−1q_{d-1} are the coefficients of kd−1k^{d-1}. The second option is possible only if ss is a nonnegative integer. The proof is the comparison of the two top coefficients of (3) (Petkovšek, Wilf and Zeilberger, A = B, Chapter 5, and the page on Gosper's algorithm). Here the leading coefficients of qq and rr lie in KK, and s∈Fs \in \mathbb{F} is an integer only if it is a constant. L5 uses deg⁡P≤max⁡jdeg⁡(cφj)\deg P \le \max_j \deg(c \varphi_j), and the bound is increasing in deg⁡P\deg P, so the true degree is at most DD. If D<0D < 0, only f=0f = 0 is possible, and the code then allows no ff unknowns. □\square

Lemma 4 (step L7)

The vectors returned by the fraction-free elimination form a basis of the kernel over F\mathbb{F} of the coefficient matrix of (3), with unknowns (α0,…,αJ,f0,…,fD)(\alpha_0, \ldots, \alpha_J, f_0, \ldots, f_D).

Proof. Row ii is replaced by p⋅rowi−m⋅rowrp \cdot \mathrm{row}_i - m \cdot \mathrm{row}_r with the pivot p≠0p \ne 0, and then divided by a nonzero polynomial. Both operations are invertible over F\mathbb{F}, and they keep the row space and so the kernel. Swaps also keep it. At the end, every pivot column has a single nonzero entry Mi,ciM_{i, c_i} in its row ii, and the rows below are zero. For a free column, the vector with 11 there, 00 in the other free columns and −Mi,free/Mi,ci-M_{i, \mathrm{free}} / M_{i, c_i} in pivot column cic_i satisfies every row. These vectors are independent, one for each free column, and the kernel has dimension equal to the number of free columns. □\square

Proof of the theorem

(a) The equations of L6 are the coefficients in kk of (3), and they are linear in the unknowns. A kernel vector with some αj≠0\alpha_j \ne 0 gives, by Lemma 3, a solution of (1) with R=rf/(cφ0)R = r f / (c \varphi_0). The code multiplies the vector by a common denominator L(n)L(n) and then divides the α\alpha part by its content g(n)g(n). This multiplies the whole vector by L/g∈F∗L / g \in \mathbb{F}^*, and (3) and (1) are linear, so they still hold with ff replaced by f/gf / g. That is why gg appears in the denominator of RR. A final scaling by a nonzero rational number does not change this. So the aja_j are polynomials, not all zero, and (1) holds.

(b) Suppose some order J′<JJ' < J has a telescoper with rational certificate. By the converse in Lemma 3 at order J′J', (3) has a solution with deg⁡f≤D\deg f \le D, so the system of L6 at order J′J' has a kernel vector with α≠0\alpha \ne 0, and by Lemma 4 the basis of L7 contains a vector with a nonzero α\alpha part (the kernel vectors with α=0\alpha = 0 form a subspace, and a basis of the whole kernel cannot lie in it). So the algorithm would have stopped at order J′J', a contradiction. ■\blacksquare

Termination. For a proper hypergeometric term, a telescoper with rational certificate exists. This is the fundamental theorem of Wilf and Zeilberger (Inventiones 1992; A = B, Chapter 4 and Chapter 6), which gives a kk-free recurrence for FF, and a kk-free recurrence yields a telescoper. By (b) the algorithm then stops at an order at most that bound. The parameter max_order only cuts the search short. The code returns None when it is reached, and that says nothing about larger orders.

Back to Zeilberger's algorithm