Algorithm Search⌘K

Proofs: Paterson-Stockmeyer algorithm

These are the human proofs of Paterson-Stockmeyer algorithm, at full length.

PATERSON-STOCKMEYER returns f(X) with at most 2 ceil(sqrt(n + 1)) - 2 nonscalar multiplications full

This proof shows: correctness.

Let RR be a commutative ring, AA an associative RR-algebra with unit 1A1_A, X∈AX \in A, and a=[a0,…,an]a = [a_0, \ldots, a_n] with n≥0n \ge 0 and f=∑i=0naixif = \sum_{i=0}^{n} a_i x^i. Fix a block size k≥1k \ge 1, let m=⌈(n+1)/k⌉m = \lceil (n+1)/k \rceil, and set at=0a_t = 0 for t>nt > n. Let R[X]⊆AR[X] \subseteq A be the set of elements g(X)g(X) for g∈R[x]g \in R[x].

Lemma 1 (polynomials in XX commute). R[X]R[X] is a commutative subring of AA, and evaluation g↦g(X)g \mapsto g(X) is a ring homomorphism from R[x]R[x] onto R[X]R[X].

Proof. Since AA is an RR-algebra, (cP)(c′Q)=(cc′)(PQ)(c P)(c' Q) = (c c')(P Q) for c,c′∈Rc, c' \in R and P,Q∈AP, Q \in A, and XiXj=Xi+j=XjXiX^i X^j = X^{i+j} = X^j X^i by associativity. Expanding by distributivity, g(X)h(X)=(gh)(X)=(hg)(X)=h(X)g(X)g(X) h(X) = (gh)(X) = (hg)(X) = h(X) g(X), and g(X)+h(X)=(g+h)(X)g(X) + h(X) = (g + h)(X). □\square

Lemma 2 (block decomposition). With Bj=∑i=0k−1ajk+iXiB_j = \sum_{i=0}^{k-1} a_{jk+i} X^i, we have f(X)=∑j=0m−1Bj(Xk)jf(X) = \sum_{j=0}^{m-1} B_j (X^k)^j.

Proof. Division with remainder by kk maps each t∈{0,…,mk−1}t \in \{0, \ldots, mk - 1\} to a unique pair (j,i)(j, i) with t=jk+it = jk + i, 0≤j<m0 \le j < m and 0≤i<k0 \le i < k. Since n<mkn < mk, the coefficients a0,…,ana_0, \ldots, a_n all occur, and the other terms are zero. By Lemma 1, Xi(Xk)j=Xjk+iX^i (X^k)^j = X^{jk+i}, so ∑jBj(Xk)j=∑t<mkatXt=f(X)\sum_j B_j (X^k)^j = \sum_{t < mk} a_t X^t = f(X). □\square

Theorem (correctness). PATERSON-STOCKMEYER returns f(X)f(X), for every block size k≥1k \ge 1.

Proof. Lines L2 and L3. By induction on ii, Pi=XiP_i = X^i for 0≤i≤min⁡(k,n)0 \le i \le \min(k, n), with P0=1A=X0P_0 = 1_A = X^0. If m≥2m \ge 2, then k<n+1k < n + 1, so min⁡(k,n)=k\min(k, n) = k and Pk=XkP_k = X^k exists. In line L4 a term with jk+i≤njk + i \le n has i≤ni \le n and i<ki < k, so PiP_i is defined. The left-out terms have ajk+i=0a_{jk+i} = 0. So line L4 computes the BjB_j of Lemma 2.

Lines L5 to L7. We show that after line L7 runs for index jj, and after line L5 for j=m−1j = m - 1, the value is S=∑t=jm−1Bt(Xk)t−jS = \sum_{t=j}^{m-1} B_t (X^k)^{t-j}. For j=m−1j = m - 1, line L5 sets S=Bm−1S = B_{m-1}. If the claim holds for j+1j + 1, then line L7 gives S⋅Xk+Bj=∑t=j+1m−1Bt(Xk)t−j−1Xk+Bj=∑t=jm−1Bt(Xk)t−jS \cdot X^k + B_j = \sum_{t=j+1}^{m-1} B_t (X^k)^{t-j-1} X^k + B_j = \sum_{t=j}^{m-1} B_t (X^k)^{t-j}, using Lemma 1 to move XkX^k past the powers of XkX^k. For j=0j = 0 this is f(X)f(X) by Lemma 2, which line L8 returns. For m=1m = 1 the loop does not run and S=B0=f(X)S = B_0 = f(X). □\square

Theorem (cost). For n≥1n \ge 1 the algorithm does min⁡(k,n)−1+m−1\min(k, n) - 1 + m - 1 nonscalar multiplications, n+1n + 1 scalar multiplications and nn additions. With k=⌈n+1 ⌉k = \lceil \sqrt{n+1}\, \rceil, the number of nonscalar multiplications is at most 2k−2≤2n+12k - 2 \le 2\sqrt{n+1}.

Proof. Line L3 does one nonscalar product for each ii from 22 to min⁡(k,n)\min(k, n), and line L7 does one for each jj from m−2m - 2 down to 00. No other line multiplies two elements of AA: line L4 multiplies the power PiP_i by the scalar ajk+ia_{jk+i}. Line L4 does one scalar product for each t=jk+i≤nt = jk + i \le n, so n+1n + 1 in all. The additions of lines L4 and L7 each join two partial sums of the final expression ∑tatXt\sum_t a_t X^t, which has n+1n + 1 terms, so there are nn of them. For the bound, (k−1)2<n+1≤k2(k - 1)^2 < n + 1 \le k^2 by the choice of kk, so (n+1)/k≤k(n+1)/k \le k and m≤km \le k. Hence min⁡(k,n)−1+m−1≤2k−2\min(k, n) - 1 + m - 1 \le 2k - 2. Finally k<n+1+1k < \sqrt{n+1} + 1, so 2k−2<2n+12k - 2 < 2\sqrt{n+1}. ■\blacksquare

Back to Paterson-Stockmeyer algorithm