The q + 2 approximate products compute the Coppersmith-Winograd bilinear map full
This proof shows: correctness, termination.
Let R be a ring with subtraction: an additive abelian group with an associative multiplication that distributes over addition on both sides. Commutativity of R is not used. Let ε be an indeterminate that commutes with every element of R, and work in the polynomial ring R[ε]. In every product the x factor is on the left and the y factor on the right.
Fix q≥0 and x,y∈Rq+2, indexed from 0 to q+1. The target is
φ0=i=1∑qxiyi+x0yq+1+xq+1y0,φi=x0yi+xiy0 (1≤i≤q),φq+1=x0y0. The products
By distributivity, and since ε commutes with R,
PiPq+1Pq+2=(x0+εxi)(y0+εyi)=x0y0+ε(x0yi+xiy0)+ε2xiyi(1≤i≤q),=(x0+ε2X)(y0+ε2Y)=x0y0+ε2(x0Y+Xy0)+ε4XY,=(x0+ε3xq+1)(y0+ε3yq+1)=x0y0+ε3(x0yq+1+xq+1y0)+ε6xq+1yq+1, where X=∑i=1qxi and Y=∑i=1qyi as in line L2. Also x0Y+Xy0=∑i=1q(x0yi+xiy0) by distributivity.
The outputs
Write [εk]f for the coefficient of εk in f∈R[ε].
Output 0 (line L5). c0=ε∑iPi−Pq+1+Pq+2−qεPq+2. Its coefficients up to ε3 are:
- [ε0]: 0−x0y0+x0y0−0=0;
- [ε1]: qx0y0−0+0−qx0y0=0;
- [ε2]: ∑i(x0yi+xiy0)−(x0Y+Xy0)+0−0=0;
- [ε3]: ∑ixiyi−0+(x0yq+1+xq+1y0)−q[ε2]Pq+2=φ0, since [ε2]Pq+2=0.
Outputs 1 to q (line L6). Pi−Pq+1=ε(x0yi+xiy0)+ε2(xiyi−x0Y−Xy0)−ε4XY has zero constant term, so ci=ε2(Pi−Pq+1) has [ε0]ci=[ε1]ci=[ε2]ci=0 and [ε3]ci=x0yi+xiy0=φi.
Output q + 1 (line L7). cq+1=ε3Pq+2, so its coefficients below ε3 are 0 and [ε3]cq+1=[ε0]Pq+2=x0y0=φq+1.
So line L8 returns (φ0,…,φq+1). The case q=0 is included: the sums over i are empty, X=Y=0, and the same computation applies.
The computation also shows that ck=ε3φk+O(ε4) for every k. In trilinear form, with Z=∑i=1qzi, this is
i=1∑qε(x0+εxi)(y0+εyi)(z0+εzi)−(x0+ε2X)(y0+ε2Y)(z0+ε2Z)+(1−qε)(x0+ε3xq+1)(y0+ε3yq+1)(z0+ε3zq+1)=ε3Tq+O(ε4), because the coefficient of zk on the left is ck, up to the term −qε4Pq+2zq+1, which is O(ε4). Hence R(Tq)≤q+2 with error degree 3.
The exact version by interpolation
Let c~k be ck as written in lines L5 to L7, a polynomial in ε. Each Pr has degree at most 6 and each multiplier in L5 to L7 has degree at most 3, so c~k has degree at most 9, and by the above its coefficients of ε0,ε1,ε2 are zero. So fk(ε)=c~k(ε)/ε3 is a polynomial of degree at most 6 with fk(0)=φk. Over Q, or over a field with at least 8 elements, the values of fk at the 7 distinct nonzero points 1,…,7 determine fk, and Lagrange interpolation gives
φk=fk(0)=t=1∑7fk(t)s=t∏t−s−s. Each fk(t) is computed from the q+2 products at ε=t, divided by t3, so the exact version uses 7(q+2) products and divides only by the nonzero constants t3 and t−s. The implementation requires a prime modulus larger than 7, so that 1,…,7 are distinct and nonzero.
Termination
Lines L1 and L6 are loops over i=1,…,q, and every other line is a single step. Each step is a finite operation on polynomials of degree at most 9 in ε. So the algorithm stops after O(q) steps. The interpolation version makes 7 such runs and a fixed number of further operations per output.