Multiplying in the Exponent
Here, we explain a fairly simple mathematical idea that underpins our multiplication technique. We fix a number of MUL constraints; we recall the constraint arrays , , and . Each of these arrays is of length and contains 64-bit words.
For each , and are in . We're interested in . Recall that we work throughout with binary fields. This means that we can't use typical prime-field ideas (like breaking our numbers into limbs so small that their products don't overflow the characteristic, using range checks, and so on).
The Exponentiation Identity
The idea is to use the basic identity . This is true in all rings, but we have to be careful about reduction in the exponent.
We recall that the multiplicative group of units is cyclic; we fix a generator . Thus, the multiplicative order of in is .
For each , the array elements , , and are all elements of . Our goal is to check whether
holds as integers. By the basic properties of rings, we know that
holds if and only if ; in our case, we conclude that
holds in in if and only if
Controlling Wraparound
If holds as integers, then it definitely also holds modulo . The converse is not quite true, as we now explain. Since
can't wrap around modulo . On the other hand, since
can wrap around only in the case of a direct equality . This equality happens if and only if and are both ; and indeed, by choosing at least one of and to be zero, the prover could get a case in which holds modulo but not over the integers.
In this latter case, is even, while is odd. To eliminate it, it thus suffices to ensure to boot that
This latter equality is easy to check, since it only depends on the least-significant bits of , and . One simple way to do this is to use AND constraints. It's enough to add 3 new witness words, say , , and , and to constrain that
as well as that , , and . The total cost for this is 3 new witness components and 4 new AND constraints (we note that MUL is already much costlier than AND, on a per-constraint basis).
Putting it Together
Assuming that the above issue has been separately resolved, we see that the MUL constraint
holds over the integers if and only if
holds in . We spend the rest of this site section explaining how to check the exponent condition above.