On adjusting the degree of SNARK-related polynomials to fit our needs, and why the randomness matters.
· 5 min read · SNARKs, Polynomials
Notation
We will denote by F to a finite field and F∗ to its respective multiplicative group. We will also denote as H to a subgroup of F∗. Finally, we will denote by ZH to the polynomial over F that vanishes on H and call it the vanishing polynomial.
Given a polynomial p∈F[X] and an evaluation domainH, we will denote by p~ to the polynomial resulting from the interpolation of the set of points {(h,p(h)), for h∈H}.
Statement
Let d,D∈N such that D>d and let f∈F[X]. Let g∈F[X] be the polynomial defined as:
g(X)=f(X)+XD−d⋅f(X).
Then, if f~ has degree lower than d then we have that g~ has degree lower than D (Prove it! Hint: Divide f by ZH).
In our context, it is always the case that D is a power of two and d is not. What we intend with this “degree adjustment” is to form a polynomial lower than a power of two from a polynomial for which this is not the case.
One can imagine D=8 and d=5 so that we adjust the degree to the “next” power of two.
To achieve the converse, we need to involve random coefficients α and β and define g(X) in the following way:
g(X)=α⋅f(X)+β⋅XD−d⋅f(X).
Now, we can claim that f~ has degree lower than dif and only ifg~ has degree lower than D.
Example: Randomness is Necessary
Let’s see why the converse is not true in the first definition of g.
Let F=Z97 (notably, 96=25⋅3), let ω=8 be a primitive 16-th root of unity and let:
As it can be seen, thanks to the random values, now the high-degree terms do not cancel out and we find that g~ is a polynomial of degree 14.
Try itSame field, domain and f as above (𝔽97, |H| = 16, D = 8, d = 5). Pick the challenges and see whether the degree check catches the cheating f.
g̃(X) =
deg g̃ =
Alternatives
The following alternatives also work! We should assume however that the Prover cannot predict the randomness in advance.
β=α2 (or in general β=f(α))
g(X)=α⋅f(X)+α2⋅XD−d⋅f(X).
As far as α=α2 this alternative will also work and therefore we would save one random value in the process. However, notice that the probability of g~ being a low degree polynomial is of 1−2/∣F∣, since both α=0 and α=1 would make it fail.
In general, all α‘s that make α=β=f(α) would make it fail.
Only α is used
g(X)=α⋅f(X)+XD−d⋅f(X).
This should work as far α=1. The probability here is of 1−1/∣F∣.
Only β is used
g(X)=f(X)+β⋅XD−d⋅f(X).
This should work as far β=1. The probability here is of 1−1/∣F∣.
Here we have that g~ is of degree lower than D if and only if the degree of f1~<d1and the degree of f2~<d2.
When we include in the definition of g more than one f polynomial, then both randomness are necessary to achieve the highest probability.
Conclusion
We arrive to the following conclusions:
If only one f polynomial is included in the definition of g, then simply sample a random value α and define:
g(X)=f(X)+α⋅XD−d⋅f(X).
If more than one f polynomial is needed, then sample two random values αi,βi per f polynomial and define:
g(X)=i=1∑k(αi⋅fi(X)+βi⋅XD−di⋅fi(X)).
In such case, the αi‘s and βi‘s must be sampled uniformly and independently (of each other) from F. This guarantees that g~ will be of low degree with probability 1−1/∣F∣, assuming that the f~‘s are of low degree.