FAST-MULTIPOINT-EVAL returns f(u_0), ..., f(u_{n-1}) in O(M(n) log n) operations full
This proof shows: correctness.
Let R be a commutative ring with 1, f∈R[x], n≥1, and u0,…,un−1∈R. For a node (j,k) of the subproduct tree, let Sj,k be the set of indices i of the leaves below it, so that mj,k=∏i∈Sj,k(x−ui).
Lemma 1 (the tree). For each level j, the sets Sj,0,Sj,1,… are consecutive blocks that partition {0,…,n−1} in order. For each node, mj,k=∏i∈Sj,k(x−ui) is monic of degree ∣Sj,k∣. If j≥1, then Sj,k=Sj−1,2k∪Sj−1,2k+1, where the second set is empty if node 2k+1 does not exist at level j−1. The top level h=⌈log2n⌉ has one node, with Sh,0={0,…,n−1}.
Proof. At level 0 the blocks are the single indices, and m0,i=x−ui. If the claim holds at level j−1 with c nodes, then level j has ⌈c/2⌉ nodes, node k is the product of nodes 2k and 2k+1, or a copy of node 2k if 2k+1=c, and the union of two consecutive blocks is a block. A product of monic polynomials is monic and its degree is the sum of the degrees. The number of nodes ⌈n/2j⌉ is 1 exactly when j≥⌈log2n⌉. □
Lemma 2 (remainders keep values). Let m be monic, let g∈R[x], and let u∈R with m(u)=0. Then (gmodm)(u)=g(u).
Proof. Division by a monic polynomial is defined over any commutative ring: g=qm+(gmodm). Evaluation at u is a ring homomorphism, so g(u)=q(u)m(u)+(gmodm)(u)=(gmodm)(u). □
Theorem (correctness). FAST-MULTIPOINT-EVAL returns the list f(u0),…,f(un−1).
Proof. If n=0, line L1 returns the empty list. Let n≥1. We show by downward induction on j the invariant: after the remainders for level j are computed, the list r has one entry rj,k per node of level j, with degrj,k<degmj,k and rj,k(ui)=f(ui) for all i∈Sj,k.
Level h. Line L3 sets rh,0=fmodmh,0, which has degree less than degmh,0=n. Each ui is a root of mh,0, so rh,0(ui)=f(ui) by Lemma 2.
From level j+1 to level j. Line L7 sets rj,k=rj+1,⌊k/2⌋modmj,k, which has degree less than degmj,k. By Lemma 1, Sj,k⊆Sj+1,⌊k/2⌋. For i∈Sj,k, ui is a root of mj,k, so by Lemma 2 and the invariant at level j+1, rj,k(ui)=rj+1,⌊k/2⌋(ui)=f(ui).
Level 0. Node k is x−uk with S0,k={k}, and r0,k has degree less than 1, so it is a constant c (the zero polynomial gives c=0). By the invariant, c=r0,k(uk)=f(uk). Line L9 returns these constants in the order of the leaves, which is the order of the points. □
Theorem (cost). Assume that multiplying a polynomial with a coefficients by one with at most a coefficients costs at most M(a) ring operations, that M(a)/a is nondecreasing, and that M(2a)≤4M(a). If degf<n, then FAST-MULTIPOINT-EVAL uses at most 11M(n)⌈log2n⌉+O(nlogn) ring operations.
Proof. From M(a)/a nondecreasing, M is nondecreasing and superadditive: M(a)+M(b)≤M(a+b), because M(a)≤a+baM(a+b) and M(b)≤a+bbM(a+b). Hence ∑vM(av)≤M(∑vav) for any finite family.
The tree. A node v of level j≥1 with Dv=degmv that is a product costs at most M(Dv+1), since both factors have at most Dv+1 coefficients. A node that is copied costs nothing. At level j≥1 there are ⌈n/2j⌉≤n nodes, and ∑vDv=n by Lemma 1, so ∑v(Dv+1)≤2n and the level costs at most M(2n)≤4M(n). There are h=⌈log2n⌉ levels above the leaves.
The descent. At line L3, degf<n=degmh,0, so fmodmh,0=f costs O(n). Consider a node v of level j+1 with degmv=D and the remainder rv of degree less than D. If v is a copy of one child, that child's remainder is rv itself, because degrv<D and the child is mv; this costs O(D). Otherwise its children have degrees d1+d2=D with d1,d2≥1. Dividing rv by the child of degree d1 is either trivial, if degrv<d1, or a division with a quotient of k=degrv−d1+1≤d2 coefficients. By the cost theorem for fast division, it costs at most 4M(k)+M(d1)+2⌈log2k⌉M(k)/k+O(D). Since 2⌈log2k⌉≤2k for k≥1 and M is nondecreasing, this is at most 6M(d2)+M(d1)+O(D). In the same way, the other child costs at most 6M(d1)+M(d2)+O(D). Together, 7(M(d1)+M(d2))+O(D)≤7M(D)+O(D). Summing over the nodes of level j+1, whose degrees sum to n, a level of the descent costs at most 7M(n)+O(n). Line L9 costs O(n).
Adding 4M(n)+7M(n)+O(n) over h=⌈log2n⌉ levels gives the bound. ■