Sum-check protocol
import gkr
env = gkr.init(verbose=False)
Introduction ¶ These notes replicate Thaler’s elegant presentation 1 of the sum-check protocol by Lund, Fortnow, Karloff, and Nisan 2 , enriched with additional background information and interactive examples.
Definitions, conventions, and notation ¶ Let F \mathbb{F} F be a finite field, v v v a positive integer, and g g g a v v v -variate polynomial with coefficients in F \mathbb{F} F :
g ( X 0 , … , X v − 1 ) = ∑ e ∈ N v a e X 0 e 0 ⋯ X v − 1 e v − 1 , a e ∈ F , e = ( e 0 , … , e v − 1 ) , g(X_0,\ldots,X_{v - 1}) = \sum_{e \, \in \, \mathbb{N}^{v}} a_{e} X_0^{e_0}\cdots X_{v - 1}^{e_{v - 1}}, \quad a_e \in \mathbb{F}, \quad e = (e_0,\ldots,e_{v-1}), g ( X 0 , … , X v − 1 ) = e ∈ N v ∑ a e X 0 e 0 ⋯ X v − 1 e v − 1 , a e ∈ F , e = ( e 0 , … , e v − 1 ) , where a e = 0 a_e = 0 a e = 0 for all but finitely many e e e . The ring of all such polynomials is denoted F [ X 0 , … , X v − 1 ] \mathbb{F}[X_0,\ldots,X_{v - 1}] F [ X 0 , … , X v − 1 ] . We use zero-based indexing throughout for consistency with the code and to minimize confusion, and define
N : = { 0 , 1 , 2 , … } . \mathbb{N} := \{0,1,2,\ldots\}. N := { 0 , 1 , 2 , … } . Referring to (1) above, we call each a e a_e a e a coefficient of g g g . If a e = 0 a_e = 0 a e = 0 for all e ∈ N v e \in \mathbb{N}^v e ∈ N v , we call g g g the zero polynomial . Suppose g g g is not the zero polynomial. The total degree of g g g is
d e g ( g ) = max { e 0 + ⋯ + e v − 1 : a e ≠ 0 } , \mathrm{deg}(g) = \max \left\{ e_0 + \cdots + e_{v-1} : a_e \ne 0 \right\}, deg ( g ) = max { e 0 + ⋯ + e v − 1 : a e = 0 } , i.e. the highest sum of the exponents of the indeterminates in any single term with a nonzero coefficient. The degree of indeterminate X j X_j X j in g g g is
d e g X j ( g ) = max { e j : a e ≠ 0 } , \mathrm{deg}_{X_j}(g) = \max \left\{ e_j : a_e \ne 0 \right\}, deg X j ( g ) = max { e j : a e = 0 } , i.e. the highest power of X j X_j X j that appears in any single term with a nonzero coefficient. As the indeterminates are indexed we may denote this by d e g j ( g ) \mathrm{deg}_j(g) deg j ( g ) . We call g g g multilinear if each e j e_j e j in (1) is either 0 or 1. In other words, g g g is multilinear if it is linear in each of its indeterminates individually.
(i) The total degree of a univariate polynomial (v = 1 v = 1 v = 1 ) is just its degree. We may use the terms degree and total degree interchangeably.
(ii) The zero polynomial is denoted by 0. Context will always make clear whether 0 denotes the zero polynomial or the zero element of F \mathbb{F} F . The nonzero constant polynomials are precisely those of total degree 0. We leave the degree of the zero polynomial undefined. Some authors, however, define it as − ∞ -\infty − ∞ for convenience, which simplifies statements like d e g ( g 1 + g 2 ) ≤ max { d e g ( g 1 ) , d e g ( g 2 ) } \mathrm{deg}(g_1 + g_2) \le \max\{\mathrm{deg}(g_1),\mathrm{deg}(g_2)\} deg ( g 1 + g 2 ) ≤ max { deg ( g 1 ) , deg ( g 2 )} and d e g ( g 1 g 2 ) = d e g ( g 1 ) + d e g ( g 2 ) \mathrm{deg}(g_1g_2) = \mathrm{deg}(g_1) + \mathrm{deg}(g_2) deg ( g 1 g 2 ) = deg ( g 1 ) + deg ( g 2 ) , without needing to exclude the zero polynomial as a special case. (iii) On the other hand, if we consider g g g as a v v v -variate polynomial in F [ X 0 , … , X v − 1 ] \mathbb{F}[X_0,\ldots,X_{v-1}] F [ X 0 , … , X v − 1 ] , then d e g j ( X j ) \mathrm{deg}_{j}(X_j) deg j ( X j ) is defined and nonnegative for every j j j , 0 ≤ j ≤ v − 1 0 \le j \le v - 1 0 ≤ j ≤ v − 1 . Some authors might say, for instance, that the degree of X 2 X_2 X 2 in X 0 X 1 + X 1 2 X_0X_1 + X_1^2 X 0 X 1 + X 1 2 , is undefined. In our case, if we understand the polynomial as belonging to F [ X 0 , X 1 , X 2 ] \mathbb{F}[X_0,X_1,X_2] F [ X 0 , X 1 , X 2 ] , then we note that we can multiply each term by X 2 0 X_2^0 X 2 0 without affecting the polynomial, whence the degree of X 2 X_2 X 2 in this polynomial is 0. This convention ensures that d e g j ( g ) \mathrm{deg}_j(g) deg j ( g ) is defined for all j j j , which will be important when tracking degree bounds variable-by-variable in the sum-check protocol.
In the RHS of (1) , we may replace a subset of w w w indeterminates X j X_j X j with field elements r j r_j r j , resulting in a ( v − w ) (v - w) ( v − w ) -variate polynomial in the remaining indeterminates, with their original indices preserved, and which we denote by substituting the corresponding r j r_j r j for each replaced X j X_j X j in the LHS. For instance, if v > 1 v > 1 v > 1 then g ( X 0 , r 1 , … , r v − 1 ) g(X_0,r_1,\ldots,r_{v-1}) g ( X 0 , r 1 , … , r v − 1 ) denotes the univariate polynomial in the indeterminate X 0 X_0 X 0 , obtained by substituting X 1 , … , X v − 1 X_1,\ldots,X_{v - 1} X 1 , … , X v − 1 with r 1 , … , r v − 1 r_1,\ldots,r_{v - 1} r 1 , … , r v − 1 in the RHS. For a more explicit example: if g ( X 0 , X 1 , X 2 ) = X 0 X 1 X 2 + X 0 X 1 2 + X 2 g(X_0,X_1,X_2) = X_0X_1X_2 + X_0X_1^2 + X_2 g ( X 0 , X 1 , X 2 ) = X 0 X 1 X 2 + X 0 X 1 2 + X 2 then g ( X 0 , 1 , 1 ) = 2 X 0 + 1 g(X_0,1,1) = 2X_0 + 1 g ( X 0 , 1 , 1 ) = 2 X 0 + 1 .
Formally, substituting field elements for indeterminates defines a ring homomorphism
F [ X 0 , … , X v − 1 ] ↦ F [ X i 1 , … , X i v − w ] . \mathbb{F}[X_0,\ldots,X_{v - 1}] \mapsto \mathbb{F}[X_{i_1},\ldots,X_{i_{v - w}}]. F [ X 0 , … , X v − 1 ] ↦ F [ X i 1 , … , X i v − w ] . The expression g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v - 1}) g ( r 0 , … , r v − 1 ) therefore denotes a constant polynomial in 0 indeterminates, which we identify with the corresponding field element. We call this the evaluation of g g g at the point ( r 0 , … , r v − 1 ) (r_0,\ldots,r_{v - 1}) ( r 0 , … , r v − 1 ) . We call ( r 0 , … , r v − 1 ) (r_0,\ldots,r_{v-1}) ( r 0 , … , r v − 1 ) a root or zero of g g g in F v \mathbb{F}^v F v if g ( r 0 , … , r v − 1 ) = 0 g(r_0,\ldots,r_{v-1}) = 0 g ( r 0 , … , r v − 1 ) = 0 . For example, over F = Z / 2 Z \mathbb{F} = \mathbb{Z}/2\mathbb{Z} F = Z /2 Z , the evaluation of g ( X 0 , X 1 , X 2 ) = X 0 X 1 X 2 + X 0 X 1 2 + X 2 g(X_0,X_1,X_2) = X_0X_1X_2 + X_0X_1^2 + X_2 g ( X 0 , X 1 , X 2 ) = X 0 X 1 X 2 + X 0 X 1 2 + X 2 at the point ( 1 , 1 , 1 ) (1,1,1) ( 1 , 1 , 1 ) is g ( 1 , 1 , 1 ) = 1 g(1,1,1) = 1 g ( 1 , 1 , 1 ) = 1 , so ( 1 , 1 , 1 ) (1,1,1) ( 1 , 1 , 1 ) is not a root of g g g , but g ( 0 , 0 , 0 ) = 0 g(0,0,0) = 0 g ( 0 , 0 , 0 ) = 0 , so ( 0 , 0 , 0 ) (0,0,0) ( 0 , 0 , 0 ) is a root of g g g , as are ( 0 , 1 , 0 ) (0,1,0) ( 0 , 1 , 0 ) and ( 1 , 0 , 0 ) (1,0,0) ( 1 , 0 , 0 ) .
We call f : F v → F f : \mathbb{F}^v \to \mathbb{F} f : F v → F a polynomial function if there is a g ∈ F [ X 0 , … , X v − 1 ] g \in \mathbb{F}[X_0,\ldots,X_{v - 1}] g ∈ F [ X 0 , … , X v − 1 ] such that f ( x 0 , … , x v − 1 ) = g ( x 0 , … , x v − 1 ) f(x_0,\ldots,x_{v - 1}) = g(x_0,\ldots,x_{v - 1}) f ( x 0 , … , x v − 1 ) = g ( x 0 , … , x v − 1 ) for each ( x 0 , … , x v − 1 ) ∈ F v (x_0,\ldots,x_{v - 1}) \in \mathbb{F}^v ( x 0 , … , x v − 1 ) ∈ F v .
The distinction between constant polynomials and constants, and between polynomials and polynomial functions, may seem pedantic but are particularly important for polynomials over finite fields. Over a finite field, a polynomial function may be represented by many distinct polynomials. In fact, every function f : F v → F f : \mathbb{F}^v \to \mathbb{F} f : F v → F is a polynomial function, a consequence of the finiteness of F \mathbb{F} F .
If F \mathbb{F} F has order q q q , then X q − X X^q - X X q − X is certainly not the zero polynomial in F [ X ] \mathbb{F}[X] F [ X ] , but x ↦ x q − x x \mapsto x^q - x x ↦ x q − x is the zero function on F \mathbb{F} F , by Fermat’s little theorem (equivalently, the Frobenius endomorphism). Polynomials are really just sequences of coefficients that we add and multiply in a certain way. Indeterminates X j X_j X j serve as placeholders—not variables—to encode formal algebraic operations independently of evaluation. If this remark seems opaque, consider that a univariate polynomial can be represented as a sequence of coefficients ( a 0 , a 1 , a 2 , … ) (a_0, a_1, a_2, \ldots) ( a 0 , a 1 , a 2 , … ) , where only finitely many a i a_i a i are nonzero. Given two polynomials g = ( a 0 , a 1 , a 2 , … ) g = (a_0, a_1, a_2, \ldots) g = ( a 0 , a 1 , a 2 , … ) and h = ( b 0 , b 1 , b 2 , … ) h = (b_0, b_1, b_2, \dots) h = ( b 0 , b 1 , b 2 , … ) , their product g ⋅ h g \cdot h g ⋅ h is another sequence of coefficients ( c 0 , c 1 , c 2 , … ) (c_0, c_1, c_2, \ldots) ( c 0 , c 1 , c 2 , … ) defined by c k = ∑ i = 0 k a i b k − i c_k = \sum_{i=0}^k a_i b_{k-i} c k = ∑ i = 0 k a i b k − i .
In the sum-check protocol we will repeatedly substitute random field elements for some variables, so tracking d e g j ( g ) \mathrm{deg}_j(g) deg j ( g ) is useful because it bounds the degree of the univariate polynomials sent in each round.
DeMillo–Lipton–Schwartz–Zippel Lemma ¶ This result, commonly referred to as the Schwartz-Zippel lemma, tells us that the roots of a multivariate polynomial over a field are sparse. This insight has useful implications; for instance, it suggests that two multivariate polynomials over a field are unlikely to agree at a randomly selected point, which is the crux of the soundness error in the sum-check protocol.
The lemma was first proved jointly by DeMillo and Lipton 3 , preceding the independent discoveries by both Schwartz 4 and Zippel 5 around the late 1970s. In fact, for the special case of finite fields—which is the only case relevant here—the result was originally established by Ore in 1922 6 .
To set up the proof of the Schwartz-Zippel lemma, we begin by stating a foundational proposition upon which the proof relies.
Let F \mathbb{F} F be a field and g ∈ F [ X ] g \in \mathbb{F}[X] g ∈ F [ X ] a nonzero univariate polynomial over F \mathbb{F} F . If g g g has degree d d d , then g g g has at most d d d roots in F \mathbb{F} F , counted with multiplicity.
Let r 0 ∈ F r_0 \in \mathbb{F} r 0 ∈ F be a root of g g g . By the division algorithm, we may write
g ( X ) = ( X − r 0 ) q ( X ) g(X) = (X - r_0)q(X) g ( X ) = ( X − r 0 ) q ( X ) for some polynomial q ( X ) ∈ F [ X ] q(X) \in \mathbb{F}[X] q ( X ) ∈ F [ X ] of degree d − 1 d - 1 d − 1 . If r 0 r_0 r 0 is a repeated root, then there exists a maximal integer m 0 ≥ 1 m_0 \ge 1 m 0 ≥ 1 such that
g ( X ) = ( X − r 0 ) m 0 q 0 ( X ) , q 0 ( r 0 ) ≠ 0. g(X) = (X - r_0)^{m_0}q_0(X), \quad q_0(r_0) \ne 0. g ( X ) = ( X − r 0 ) m 0 q 0 ( X ) , q 0 ( r 0 ) = 0. Now let r 1 ≠ r 0 r_1 \ne r_0 r 1 = r 0 be another root of g g g . Since F \mathbb{F} F is an integral domain, ( r 1 − r 0 ) m 0 ≠ 0 (r_1 - r_0)^{m_0} \ne 0 ( r 1 − r 0 ) m 0 = 0 , and hence
0 = g ( r 1 ) = ( r 1 − r 0 ) m 0 q 0 ( r 1 ) 0 = g(r_1) = (r_1 - r_0)^{m_0}q_0(r_1) 0 = g ( r 1 ) = ( r 1 − r 0 ) m 0 q 0 ( r 1 ) implies q 0 ( r 1 ) = 0 q_0(r_1) = 0 q 0 ( r 1 ) = 0 . Thus q 0 ( X ) q_0(X) q 0 ( X ) is divisible by X − r 1 X - r_1 X − r 1 .
Repeating this process for distinct roots, each new root reduces the degree of the remaining factor by at least one. Since the original polynomial has degree d d d , the total number of roots, counted with multiplicity, cannot exceed d d d .
Let g g g be a v v v -variate (v ≥ 1 v \ge 1 v ≥ 1 ), nonzero polynomial of total degree d d d over a finite field F \mathbb{F} F . We have
# { r ∈ F v : g ( r ) = 0 } ≤ ( # F ) v − 1 d . \#\{\mathbf{r} \in \mathbb{F}^v : g(\mathbf{r}) = 0\} \le (\#\mathbb{F})^{v - 1}d. # { r ∈ F v : g ( r ) = 0 } ≤ ( # F ) v − 1 d . In other words, if r 0 , … , r v − 1 r_0,\ldots,r_{v - 1} r 0 , … , r v − 1 are selected at random independently and uniformly from F \mathbb{F} F , then
P r [ g ( r 0 , … , r v − 1 ) = 0 ] ≤ d # F . \mathrm{Pr}[g(r_0,\ldots,r_{v - 1}) = 0] \le \frac{d}{\# \mathbb{F}}. Pr [ g ( r 0 , … , r v − 1 ) = 0 ] ≤ # F d . The proof is by induction on v v v . The base case v = 1 v = 1 v = 1 is the previous proposition. Let v ≥ 2 v \ge 2 v ≥ 2 and assume the statement holds for all nonzero polynomials in u u u indeterminates, 1 ≤ u ≤ v − 1 1 \le u \le v - 1 1 ≤ u ≤ v − 1 .
Writing g g g as in (1) , note that
g ( X 0 , … , X v − 1 ) = ∑ e ∈ N v a e X 0 e 0 ⋯ X v − 1 e v − 1 = ∑ e v − 1 ∈ N X v − 1 e v − 1 ∑ ( e 0 , … , e v − 2 ) ∈ N v − 1 a e X 0 e 0 ⋯ X v − 2 e v − 2 = ∑ k = 0 d X v − 1 k h k ( X 0 , … , X v − 2 ) , \begin{align}
g(X_0,\ldots,X_{v - 1})
& = \sum_{e \, \in \, \mathbb{N}^{v}} a_{e} X_0^{e_0}\cdots X_{v - 1}^{e_{v - 1}} \\
& = \sum_{e_{v-1} \, \in \, \mathbb{N}} X_{v-1}^{e_{v-1}} \sum_{(e_0,\ldots,e_{v-2}) \, \in \, \mathbb{N}^{v-1}} a_{e} X_0^{e_0}\cdots X_{v - 2}^{e_{v - 2}} \\
& = \sum_{k \, = \, 0}^{d} X_{v-1}^k h_k(X_0,\ldots,X_{v-2}),
\end{align} g ( X 0 , … , X v − 1 ) = e ∈ N v ∑ a e X 0 e 0 ⋯ X v − 1 e v − 1 = e v − 1 ∈ N ∑ X v − 1 e v − 1 ( e 0 , … , e v − 2 ) ∈ N v − 1 ∑ a e X 0 e 0 ⋯ X v − 2 e v − 2 = k = 0 ∑ d X v − 1 k h k ( X 0 , … , X v − 2 ) , say, where we have replaced e v − 1 e_{v - 1} e v − 1 by k k k in the outer sum and truncated it at k = d k = d k = d , because total degree d d d implies e v − 1 ≤ d e_{v - 1} \le d e v − 1 ≤ d for every monomial with nonzero coefficient. We can’t have h k ≡ 0 h_k \equiv 0 h k ≡ 0 for every k k k , for in that case we’d also have g ≡ 0 g \equiv 0 g ≡ 0 . Let j = max { k : h k ≢ 0 } j = \max\{k: h_k \not\equiv 0\} j = max { k : h k ≡ 0 } be the largest k k k for which h k h_k h k is a nonzero polynomial.
We now separate the roots of g g g according to whether the leading coefficient (as a polynomial in X v − 1 X_{v - 1} X v − 1 ) vanishes:
{ r ∈ F v : g ( r ) = 0 } ⊆ { r ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 } ∪ { r ∈ F v : h j ( r 0 , … , r v − 2 ) ≠ 0 and g ( r ) = 0 } . \{\mathbf{r} \in \mathbb{F}^{v} : g(\mathbf{r}) = 0\} \subseteq \{\mathbf{r} \in \mathbb{F}^{v} : h_j(r_0,\ldots,r_{v-2}) = 0\} \cup \{\mathbf{r} \in \mathbb{F}^v : h_j(r_0,\ldots,r_{v-2}) \ne 0 \,\, \text{and} \,\, g(\mathbf{r}) = 0 \}. { r ∈ F v : g ( r ) = 0 } ⊆ { r ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 } ∪ { r ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 and g ( r ) = 0 } . We will show that the sets on the RHS have sizes bounded by ( # F ) v − 1 ( d − j ) (\#\mathbb{F})^{v - 1}(d - j) ( # F ) v − 1 ( d − j ) and ( # F ) v − 1 j (\#\mathbb{F})^{v - 1}j ( # F ) v − 1 j respectively.
Since X v − 1 j h j ( X 0 , … , X v − 2 ) X_{v-1}^jh_j(X_0,\ldots,X_{v-2}) X v − 1 j h j ( X 0 , … , X v − 2 ) has degree at most d e g ( g ) = d \mathrm{deg} \, (g) = d deg ( g ) = d , we have d e g ( h j ) ≤ d − j \mathrm{deg} \, (h_j) \le d - j deg ( h j ) ≤ d − j . Therefore, by inductive hypothesis,
# { ( r 0 , … , r v − 2 ) ∈ F v − 1 : h j ( r 0 , … , r v − 2 ) = 0 } ≤ ( # F ) v − 2 ( d − j ) . \#\{(r_0,\ldots,r_{v - 2}) \in \mathbb{F}^{v - 1} : h_j(r_0,\ldots,r_{v-2}) = 0\} \le (\#\mathbb{F})^{v - 2}(d - j). # {( r 0 , … , r v − 2 ) ∈ F v − 1 : h j ( r 0 , … , r v − 2 ) = 0 } ≤ ( # F ) v − 2 ( d − j ) . Consequently,
# { ( r 0 , … , r v − 2 , r v − 1 ) ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 } ≤ ( # F ) v − 1 ( d − j ) . \#\{(r_0,\ldots,r_{v - 2},r_{v-1}) \in \mathbb{F}^v : h_j(r_0,\ldots,r_{v-2}) = 0\} \le (\#\mathbb{F})^{v - 1}(d - j). # {( r 0 , … , r v − 2 , r v − 1 ) ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 } ≤ ( # F ) v − 1 ( d − j ) . If h j ( r 0 , … , r v − 2 ) ≠ 0 h_j(r_0,\ldots,r_{v - 2}) \ne 0 h j ( r 0 , … , r v − 2 ) = 0 , then g ( r 0 , … , r v − 2 , X v − 1 ) g(r_0,\ldots,r_{v-2},X_{v-1}) g ( r 0 , … , r v − 2 , X v − 1 ) is a nonzero univariate polynomial of degree j j j (its leading term is X v − 1 j h j ( r 0 , … , r v − 2 ) ) X_{v-1}^jh_j(r_0,\ldots,r_{v-2})) X v − 1 j h j ( r 0 , … , r v − 2 )) . There are trivially at most ( # F ) v − 1 (\#\mathbb{F})^{v-1} ( # F ) v − 1 tuples ( r 0 , … , r v − 2 ) ∈ F v − 1 (r_0,\ldots,r_{v-2}) \in \mathbb{F}^{v - 1} ( r 0 , … , r v − 2 ) ∈ F v − 1 such that h j ( r 0 , … , r v − 2 ) ≠ 0 h_j(r_0,\ldots,r_{v-2}) \ne 0 h j ( r 0 , … , r v − 2 ) = 0 , and for each such tuple, there are at most j j j elements r v − 1 r_{v - 1} r v − 1 of F \mathbb{F} F such that g ( r 0 , … , r v − 1 ) = 0 g(r_0,\ldots,r_{v-1}) = 0 g ( r 0 , … , r v − 1 ) = 0 . This follows from the univariate case, since such r v − 1 r_{v-1} r v − 1 are roots of a nonzero univariate polynomial of degree j j j . Hence,
# { ( r 0 , … , r v − 1 ) ∈ F v : h j ( r 0 , … , r v − 2 ) ≠ 0 and g ( r 0 , … , r v − 1 ) = 0 } ≤ ( # F ) v − 1 j . \#\{(r_0,\ldots,r_{v - 1}) \in \mathbb{F}^v : h_j(r_0,\ldots,r_{v-2}) \ne 0 \,\, \text{and} \,\, g(r_0,\ldots,r_{v-1}) = 0 \} \le (\#\mathbb{F})^{v-1}j. # {( r 0 , … , r v − 1 ) ∈ F v : h j ( r 0 , … , r v − 2 ) = 0 and g ( r 0 , … , r v − 1 ) = 0 } ≤ ( # F ) v − 1 j . A striking feature of the Schwartz-Zippel bound is that it depends on the degree of the polynomial but not on the number of variables. This reflects the fact that low degree, rather than low dimension, is what prevents a polynomial from vanishing on a large fraction of points.
(i) The proof shows that F \mathbb{F} F can actually be replaced by any integral domain R R R (whether finite or infinite), provided we select r 0 , … , r v − 1 r_0, \ldots, r_{v - 1} r 0 , … , r v − 1 from a finite subset S ⊆ R S \subseteq R S ⊆ R and substitute # S \#S # S for # F \#\mathbb{F} # F in the denominator on the right-hand side. This generalization—the full result established by DeMillo and Lipton, Schwartz, and Zippel—is not required for our current purposes.
(ii) Some people mistakenly refer to the base case as the much deeper fundamental theorem of algebra, which states that a non-zero polynomial of degree d d d over C \mathbb{C} C has exactly d d d roots in C \mathbb{C} C , counted with multiplicity.
from sympy import symbols, Poly, GF
from gkr import roots_example
X = symbols("X_:2")
g_small = Poly(X[0]*X[1] + 1, X, domain=GF(5, symmetric=False))
Y = symbols("X_:3")
g_big = Poly(Y[0]*Y[1] + Y[2]**2, Y, domain=GF(331, symmetric=False))
roots_example(polynomials=[g_small, g_big], time_out=3)
EXAMPLE 1. The polynomial X_0*X_1 + 1 has 4 roots in (GF(5))^(2).
Thus, if each of r_0, r_1 is chosen independently and uniformly at random from GF(5), then g(r_0, r_1) = 0 with probability 4/5**2 = 0.16.
The polynomial has total degree d = 2, and the Schwartz-Zippel bound is 2/5 = 0.4.
Observed probability is below the Schwartz-Zippel upper bound.
EXAMPLE 2. In 3 seconds, we found 436 roots of X_0*X_1 + X_2**2 in (GF(331))^(3).
There may be more roots, so what follows is not a verification of Schwartz-Zippel.
Thus, if each of r_0, r_1, r_2 is chosen independently and uniformly at random from GF(331), then g(r_0, r_1, r_2) = 0 with probability at least 436/331**3 = 1.2022713774122602e-05 (this is a lower bound). Schwartz-Zippel gives an upper bound.
The polynomial has total degree d = 2, and the Schwartz-Zippel bound is 2/331 = 0.006042296072507553.
Here are 10 of the roots:
Sum-check protocol of Lund, Fortnow, Karloff, and Nisan, as described by Thaler ¶ This is a description of the sum-check protocol as presented by Lund, Fortnow, Karloff, and Nisan in 2 , with the exposition following Thaler’s treatment in 1
Initialization. Given a nonzero v v v -variate polynomial g g g over a finite field F \mathbb{F} F , let
H : = ∑ b 0 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( b 0 , … , b v − 1 ) . H := \sum_{b_0 \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(b_0,\ldots,b_{v - 1}). H := b 0 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( b 0 , … , b v − 1 ) . Although verifier V does not know g g g , the number of indeterminates v v v and upper bounds d e g X j ( g ) ≤ d j \mathrm{deg}_{X_j}(g) \le d_j deg X j ( g ) ≤ d j are known to V. Prover P claims that
H = claim P H ∗ , H \overset{\mathsf{P}}{\underset{\text{claim}}{=}} H^*, H claim = P H ∗ , sending this claim to V, who needs to verify that this claim is true by interacting with P.
We distinguish between ground-truth objects and objects that the prover P merely claims to be ground-truth by using an asterisk. Thus, H H H denotes the true value of the right-hand side of ( 5 ) (5) ( 5 ) , whereas H ∗ H^{*} H ∗ denotes the value that P claims it to be. Any expression involving asterisked notation may therefore be false, and the verifier V’s goal is to detect such inconsistencies with high probability.
To make the epistemic status of equalities explicit, we use the notation
= claim P \overset{\mathsf{P}}{\underset{\text{claim}}{=}} claim = P to denote an equality explicitly asserted by P, which may be false.
Finally, we use the notation
= ? , ≤ ? \stackrel{?}{=}, \, \stackrel{?}{\le} = ? , ≤ ? to denote an (in)equality that the verifier checks as part of the sum-check protocol. Such an equality is not asserted outright by P, but is instead forced by the protocol transcript : if P behaves honestly, the equality holds deterministically, whereas if P behaves dishonestly, the verifier accepts a false equality only with negligible probability.
Round 0. Let
g 0 ( X 0 ) : = ∑ b 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( X 0 , b 1 , … , b v − 1 ) . g_0(X_0) := \sum_{b_1 \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(X_0,b_1,\ldots,b_{v - 1}). g 0 ( X 0 ) := b 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( X 0 , b 1 , … , b v − 1 ) . P sends polynomial g 0 ∗ g^*_0 g 0 ∗ to V, claiming that
g 0 ∗ = claim P g 0 . g^*_0 \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_0. g 0 ∗ claim = P g 0 . (Here, ‘P sends a polynomial’ means P sends an explicit representation, e.g., its coefficients.) If so, then
d e g ( g 0 ∗ ) = ? d e g ( g 0 ) ≤ d e g 0 ( g ) = d 0 . \mathrm{deg}(g^*_0) \stackrel{?}{=} \mathrm{deg}(g_0) \le \mathrm{deg}_0(g) = d_0. deg ( g 0 ∗ ) = ? deg ( g 0 ) ≤ deg 0 ( g ) = d 0 . V verifies this: if d e g ( g 0 ∗ ) > d 0 \mathrm{deg}(g^*_0) > d_0 deg ( g 0 ∗ ) > d 0 then V ‘rejects’ and the protocol terminates. Otherwise, we continue. If P’s claims that
H = claim P H ∗ and g 0 ∗ = claim P g 0 H \overset{\mathsf{P}}{\underset{\text{claim}}{=}} H^* \quad \text{and} \quad g^*_0 \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_0 H claim = P H ∗ and g 0 ∗ claim = P g 0 are both true, then
H ∗ = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . H^* \stackrel{?}{=} g^*_0(0) + g^*_0(1). H ∗ = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . This is because H = g 0 ( 0 ) + g 0 ( 1 ) H = g_0(0) + g_0(1) H = g 0 ( 0 ) + g 0 ( 1 ) . V verifies (7) , which is easy because g 0 ∗ g^*_0 g 0 ∗ is explicitly given as a univariate polynomial, even though V cannot compute g 0 g_0 g 0 efficiently from scratch. If (7) does not hold, then V rejects and the protocol terminates. Otherwise, V chooses r 0 r_0 r 0 uniformly at random from F \mathbb{F} F , and sends it to P.
Round j (1 ≤ j ≤ v − 1 1 \le j \le v - 1 1 ≤ j ≤ v − 1 ). Let
g j ( X j ) : = ∑ b j + 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , r 1 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) . g_j(X_j) := \sum_{b_{j+1} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,r_1,\ldots,r_{j-1},X_j,b_{j+1},\ldots,b_{v - 1}). g j ( X j ) := b j + 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) . P responds to V’s random challenge r j − 1 r_{j - 1} r j − 1 by sending V a polynomial g j ∗ g^*_{j} g j ∗ , claiming that
g j ∗ = claim P g j . g^*_{j} \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_j. g j ∗ claim = P g j . If so, then
d e g ( g j ∗ ) = ? d e g ( g j ) ≤ d e g j ( g ) = d j . \mathrm{deg}(g^*_j) \stackrel{?}{=} \mathrm{deg}(g_j) \le \mathrm{deg}_j(g) = d_j. deg ( g j ∗ ) = ? deg ( g j ) ≤ deg j ( g ) = d j . V verifies this: if d e g ( g j ∗ ) > d j \mathrm{deg}(g^*_j) > d_j deg ( g j ∗ ) > d j then V ‘rejects’ and the protocol terminates. Otherwise, we continue. If P’s previous claims that
g j − 1 ∗ = claim P g j − 1 and g j ∗ = claim P g j g^*_{j-1} \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_{j - 1} \quad \text{and} \quad g^*_{j} \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_{j} g j − 1 ∗ claim = P g j − 1 and g j ∗ claim = P g j are both true, then
g j − 1 ∗ ( r j − 1 ) = ? g j ∗ ( 0 ) + g j ∗ ( 1 ) . g^*_{j - 1}(r_{j - 1}) \stackrel{?}{=} g^*_j(0) + g^*_j(1). g j − 1 ∗ ( r j − 1 ) = ? g j ∗ ( 0 ) + g j ∗ ( 1 ) . This is because g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) g_{j - 1}(r_{j - 1}) = g_j(0) + g_j(1) g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) . To see this, note that by definition (8) ,
g j − 1 ( r j − 1 ) = ∑ b j ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , r 1 , … , r j − 2 , r j − 1 , b j , … , b v − 1 ) \begin{align*}
g_{j - 1}(r_{j - 1}) & = \sum_{b_{j} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,r_1,\ldots,r_{j-2},r_{j-1},b_{j},\ldots,b_{v - 1})
\end{align*} g j − 1 ( r j − 1 ) = b j ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , … , r j − 2 , r j − 1 , b j , … , b v − 1 ) and
g j ( 0 ) + g j ( 1 ) = ∑ b j + 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , r 1 , … , r j − 1 , 0 , b j + 1 , … , b v − 1 ) + ∑ b j + 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , r 1 , … , r j − 1 , 1 , b j + 1 , … , b v − 1 ) = ∑ b j ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , r 1 , … , r j − 1 , b j , b j + 1 , … , b v − 1 ) . \begin{align}
g_j(0) + g_j(1) & = \sum_{b_{j+1} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,r_1,\ldots,r_{j-1},0,b_{j+1},\ldots,b_{v - 1})
+ \sum_{b_{j+1} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,r_1,\ldots,r_{j-1},1,b_{j+1},\ldots,b_{v - 1}) \\
& = \sum_{b_{j} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,r_1,\ldots,r_{j-1},b_j,b_{j+1},\ldots,b_{v - 1}).
\end{align} g j ( 0 ) + g j ( 1 ) = b j + 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , … , r j − 1 , 0 , b j + 1 , … , b v − 1 ) + b j + 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , … , r j − 1 , 1 , b j + 1 , … , b v − 1 ) = b j ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , … , r j − 1 , b j , b j + 1 , … , b v − 1 ) . V verifies (9) , which is easy because g j − 1 g_{j - 1} g j − 1 and g j g_{j} g j are explicitly given as univariate polynomials, even though V cannot compute g j − 1 g_{j - 1} g j − 1 and g j g_{j} g j efficiently from scratch. If (9) does not hold, V rejects and the protocol terminates. Otherwise, V chooses r j r_j r j uniformly at random from F \mathbb{F} F , independently of r 0 , … , r j − 1 r_0,\ldots,r_{j-1} r 0 , … , r j − 1 , and sends it to P.
It helps to write out Round v − 1 v - 1 v − 1 explicitly. In the final round, P sends g v − 1 ∗ g^*_{v - 1} g v − 1 ∗ to V, claiming that
g v − 1 ∗ = claim P g v − 1 , g^*_{v - 1} \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_{v - 1}, g v − 1 ∗ claim = P g v − 1 , where
g v − 1 ( X v − 1 ) : = g ( r 0 , … , r v − 2 , X v − 1 ) . g_{v - 1}(X_{v - 1}) := g(r_0,\ldots,r_{v - 2},X_{v - 1}). g v − 1 ( X v − 1 ) := g ( r 0 , … , r v − 2 , X v − 1 ) . V verifies that d e g ( g v − 1 ∗ ) ≤ ? d v − 1 \mathrm{deg}(g^*_{v-1}) \stackrel{?}{\le} d_{v-1} deg ( g v − 1 ∗ ) ≤ ? d v − 1 and that g v − 2 ∗ ( r v − 2 ) = ? g v − 1 ∗ ( 0 ) + g v − 1 ∗ ( 1 ) g^*_{v - 2}(r_{v - 2}) \stackrel{?}{=} g^*_{v - 1}(0) + g^*_{v - 1}(1) g v − 2 ∗ ( r v − 2 ) = ? g v − 1 ∗ ( 0 ) + g v − 1 ∗ ( 1 ) . If either the degree bound or (9) with j = v − 1 j = v - 1 j = v − 1 does not hold, V rejects and the protocol terminates. Otherwise, we continue.
Final check. V chooses r v − 1 r_{v - 1} r v − 1 uniformly at random from F \mathbb{F} F , independently of r 0 , … , r v − 2 r_0,\ldots,r_{v-2} r 0 , … , r v − 2 , and verifies that
g v − 1 ∗ ( r v − 1 ) = ? g ( r 0 , … , r v − 2 , r v − 1 ) , g^*_{v - 1}(r_{v - 1}) \stackrel{?}{=} g(r_0,\ldots,r_{v - 2},r_{v - 1}), g v − 1 ∗ ( r v − 1 ) = ? g ( r 0 , … , r v − 2 , r v − 1 ) , which holds if g v − 1 ∗ = claim P g v − 1 g^*_{v-1} \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_{v-1} g v − 1 ∗ claim = P g v − 1 is true, in view of (10) . If (11) does not hold, then V rejects. Otherwise, V accepts that H = claim P H ∗ H \overset{\mathsf{P}}{\underset{\text{claim}}{=}} H^* H claim = P H ∗ is true and P passes the sum-check protocol. The protocol is complete.
In the original interactive-proof setting, the verifier is assumed to have oracle access to the evaluation map induced by the polynomial g g g . That is, although g g g is formally an element of F [ X 0 , … , X v − 1 ] \mathbb{F}[X_0,\ldots,X_{v-1}] F [ X 0 , … , X v − 1 ] , the verifier may query the oracle at any point r ∈ F v \mathbf r \in \mathbb{F}^v r ∈ F v and receive the value g ( r ) g(\mathbf r) g ( r ) . We will freely identify a polynomial with the polynomial function it induces on F v \mathbb{F}^v F v , since the verifier only ever interacts with g g g through such evaluations.
In cryptographic implementations, this oracle access is replaced by a binding commitment to g g g (or to a witness that uniquely determines g g g ), together with a separate mechanism that allows the verifier to check claimed point evaluations. Concretely, when the verifier requests the value of g g g at ( r 0 , … , r v − 1 ) (r_0,\ldots,r_{v-1}) ( r 0 , … , r v − 1 ) in the final check, the prover supplies both the value g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) and a proof that this value is consistent with the committed polynomial. This evaluation-consistency check is provided by the commitment scheme itself (for example, a polynomial commitment), and is not an invocation of the sum-check protocol.
Although the verifier may have oracle access to evaluations of g g g , computing H H H directly from the oracle would require 2 v 2^v 2 v queries. The sum-check protocol shows how to reduce verification of this exponentially large sum to a linear number of oracle queries by exploiting the low-degree structure of g g g .
from gkr import sum_check_example
sum_check_example(interactive=False)
Let
g(X_0, X_1, X_2) = X_0*X_1 + 4*X_0*X_2 + 4*X_1**2 + X_1*X_2.
We display g for the reader. In the protocol, V does not receive g explicitly; V only has oracle/committed evaluation access to g.
For soundness, V relies on degree bounds per variable (this is public information): [1, 2, 1].
Let
H := sum g(b_0, b_1, b_2) over (b_0, b_1, b_2) in {0,1}^3.
P claims that H = H*, where H* = 3.
Let
g_0(X_0) := sum g(X_0, b_1, b_2) over (b_1, b_2) in {0,1}^2
P claims that g_0(X_0) = g*_0(X_0), where
g*_0(X_0) = 4.
If P's last two claims are true, then deg(g*_0) ≤ deg_0(g) and H* = g*_0(0) + g*_0(1).
V checks the degree bound: deg(g*_0) = 0 ≤ deg_0(g) = 1.
P's claim is that H = H* = 3. V proceeds to compute:
This is easy because g*_0 is given explicitly, so V can evaluate it at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(5); here r_0 = 0.
Let
g_1(X_1) := sum g(0, X_1, b_2) over (b_2) in {0,1}^1
P claims that g_1(X_1) = g*_1(X_1), where
g*_1(X_1) = 3*X_1**2 + X_1.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(0) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 2 ≤ deg_1(g) = 2.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(5); here r_1 = 4.
Let
g_2(X_2) := g(0, 4, X_2)
P claims that g_2(X_2) = g*_2(X_2), where
g*_2(X_2) = 4*X_2 + 4.
If P's last two claims are true, then deg(g*_2) ≤ deg_2(g) and g*_1(4) = g*_2(0) + g*_2(1).
V checks the degree bound: deg(g*_2) = 1 ≤ deg_2(g) = 1.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(5); here r_2 = 3.
If all of P's claims are true, then
g*_2(3) = g(0, 4, 3).
Finally, V queries an oracle for g at r to obtain
g(0, 4, 3) = 1.
P passes the final verification, and V ACCEPTS P's initial claim that H = H*.
True polynomial g:
g(X_0, X_1, X_2) = X_0*X_1 + 4*X_0*X_2 + 4*X_1**2 + X_1*X_2
True value of H := sum g(b) over b in {0,1}^3 is: 3
Prover claimed that this is equal to: H* = 3.
This was a TRUE POSITIVE: the claim H = H* was correct.
Why V should be convinced if P passes sum check ¶ The sum-check protocol is complete : if P’s claims are true, P will pass the protocol, assuming V’s calculations are accurate. If V rejects, then at least one of P’s claims is inconsistent with the protocol checks.
In terms of soundness , a dishonest P may provide an incorrect value for the initial sum H H H and still pass sum check. However, we can make the probability of this event—the soundness error—as small as desired by choosing a large field size # F \#\mathbb{F} # F relative to v d vd v d . The probability of V being convinced of a false value for the initial sum is at most v d / # F vd/\#\mathbb{F} v d /# F .
To recap the sum-check protocol, we have
H : = ∑ b 0 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( b 0 , … , b v − 1 ) g 0 ( X 0 ) : = ∑ b 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( X 0 , b 1 , … , b v − 1 ) \begin{align}
H & := \sum_{b_0 \, \in \, \{0,1\}} \cdots \sum_{b_{v - 1} \, \in \, \{0,1\}} g(b_0,\ldots,b_{v-1}) \\
g_0(X_0) & := \sum_{b_1 \, \in \, \{0,1\}} \cdots \sum_{b_{v - 1} \, \in \, \{0,1\}} g(X_0,b_1,\ldots,b_{v-1})
\end{align} H g 0 ( X 0 ) := b 0 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( b 0 , … , b v − 1 ) := b 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( X 0 , b 1 , … , b v − 1 ) Also, r 0 , … , r v − 1 r_0,\ldots,r_{v-1} r 0 , … , r v − 1 are selected independently and uniformly at random from F \mathbb{F} F , and
g j ( X j ) : = ∑ b j + 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) , 0 ≤ j ≤ v − 2 g v − 1 ( X v − 1 ) : = g ( r 0 , … , r v − 2 , X v − 1 ) \begin{align}
g_j(X_j) & := \sum_{b_{j + 1} \, \in \, \{0,1\}} \cdots \sum_{b_{v - 1} \, \in \, \{0,1\}} g(r_0,\ldots,r_{j-1},X_j,b_{j+1},\ldots,b_{v-1}), \quad 0 \le j \le v - 2 \\
g_{v-1}(X_{v-1}) & := g(r_0,\ldots,r_{v-2},X_{v-1})
\end{align} g j ( X j ) g v − 1 ( X v − 1 ) := b j + 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) , 0 ≤ j ≤ v − 2 := g ( r 0 , … , r v − 2 , X v − 1 ) Letting d j : = d e g j ( g ) d_j := \mathrm{deg}_{j}(g) d j := deg j ( g ) for 0 ≤ j ≤ v − 1 0 \le j \le v - 1 0 ≤ j ≤ v − 1 , we have
d e g ( g j ) ≤ d j , 0 ≤ j ≤ v − 1. \mathrm{deg}(g_j) \le d_j, \quad 0 \le j \le v - 1. deg ( g j ) ≤ d j , 0 ≤ j ≤ v − 1. Also,
H = g 0 ( 0 ) + g 0 ( 1 ) g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) , 1 ≤ j ≤ v − 1 g v − 1 ( r v − 1 ) = g ( r 0 , … , r v − 1 ) \begin{align}
H & = g_0(0) + g_0(1) \\
g_{j-1}(r_{j-1}) & = g_j(0) + g_j(1), \quad 1 \le j \le v - 1 \\
g_{v-1}(r_{v-1}) & = g(r_0,\ldots,r_{v-1})
\end{align} H g j − 1 ( r j − 1 ) g v − 1 ( r v − 1 ) = g 0 ( 0 ) + g 0 ( 1 ) = g j ( 0 ) + g j ( 1 ) , 1 ≤ j ≤ v − 1 = g ( r 0 , … , r v − 1 ) P claims that H = claim P H ∗ H \overset{\mathsf{P}}{\underset{\text{claim}}{=}} H^* H claim = P H ∗ and g j = claim P g j ∗ g_j \overset{\mathsf{P}}{\underset{\text{claim}}{=}} g_j^* g j claim = P g j ∗ for 0 ≤ j ≤ v − 1 0 \le j \le v - 1 0 ≤ j ≤ v − 1 , passing sum check if and only if the V’s acceptance conditions hold:
d e g ( g j ∗ ) ≤ ? d j , 0 ≤ j ≤ v − 1 , H ∗ = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) g j − 1 ∗ ( r j − 1 ) = ? g j ∗ ( 0 ) + g j ∗ ( 1 ) , 1 ≤ j ≤ v − 1 g v − 1 ∗ ( r v − 1 ) = ? g ( r 0 , … , r v − 1 ) \begin{align}
\begin{split}
\mathrm{deg}(g^*_j) & \stackrel{?}{\le} d_j, \quad 0 \le j \le v - 1, \\
H^* & \stackrel{?}{=} g^*_0(0) + g^*_0(1) \\
g^*_{j-1}(r_{j-1}) & \stackrel{?}{=} g^*_j(0) + g^*_j(1), \quad 1 \le j \le v - 1 \\
g^*_{v-1}(r_{v-1}) & \stackrel{?}{=} g(r_0,\ldots,r_{v-1})
\end{split}
\end{align} deg ( g j ∗ ) H ∗ g j − 1 ∗ ( r j − 1 ) g v − 1 ∗ ( r v − 1 ) ≤ ? d j , 0 ≤ j ≤ v − 1 , = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = ? g j ∗ ( 0 ) + g j ∗ ( 1 ) , 1 ≤ j ≤ v − 1 = ? g ( r 0 , … , r v − 1 ) Suppose P’s claim for the value of the initial sum is false, i.e. in fact H ∗ ≠ H H^* \ne H H ∗ = H , and that P passes sum-check in spite of this, i.e. V’s acceptance conditions (12) all hold. If we had g 0 ∗ = g 0 g^*_0 = g_0 g 0 ∗ = g 0 , then we’d have g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = g 0 ( 0 ) + g 0 ( 1 ) = H ≠ H ∗ g^*_0(0) + g^*_0(1) = g_0(0) + g_0(1) = H \ne H^* g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = g 0 ( 0 ) + g 0 ( 1 ) = H = H ∗ , and so V would reject in Round 0. Therefore, g 0 ∗ ≠ g 0 g^*_0 \ne g_0 g 0 ∗ = g 0 .
Case 1. g j ∗ ≠ g j g^*_j \ne g_j g j ∗ = g j for all j j j , 0 ≤ j ≤ v − 1 0 \le j \le v - 1 0 ≤ j ≤ v − 1 . In particular, g v − 1 ∗ ≠ g v − 1 g^*_{v - 1} \ne g_{v - 1} g v − 1 ∗ = g v − 1 , and by the final acceptance condition,
g v − 1 ∗ ( r v − 1 ) = g v − 1 ( r v − 1 ) = g ( r 0 , … , r v − 1 ) . g^*_{v-1}(r_{v - 1}) = g_{v-1}(r_{v-1}) = g(r_0,\ldots,r_{v-1}). g v − 1 ∗ ( r v − 1 ) = g v − 1 ( r v − 1 ) = g ( r 0 , … , r v − 1 ) . Case 2. There is a minimal k k k , 1 ≤ k ≤ v − 1 1 \le k \le v - 1 1 ≤ k ≤ v − 1 , such that g k − 1 ∗ ≠ g k − 1 g^*_{k-1} \ne g_{k-1} g k − 1 ∗ = g k − 1 and g k ∗ = g k g^*_k = g_k g k ∗ = g k . By the acceptance condition of Round k,
g k − 1 ∗ ( r k − 1 ) = g k ∗ ( 0 ) + g k ∗ ( 1 ) = g k ( 0 ) + g k ( 1 ) = g k − 1 ( r k − 1 ) . g^*_{k-1}(r_{k-1}) = g^*_k(0) + g^*_k(1) = g_k(0) + g_k(1) = g_{k - 1}(r_{k - 1}). g k − 1 ∗ ( r k − 1 ) = g k ∗ ( 0 ) + g k ∗ ( 1 ) = g k ( 0 ) + g k ( 1 ) = g k − 1 ( r k − 1 ) . If Case 1 holds, take k = v k = v\, k = v ; else take k k k as in Case 2. In either case, there is a sequence of polynomials g 0 ∗ ≠ g 0 , … , g k − 1 ∗ ≠ g k − 1 g^*_0 \ne g_0,\ldots,g^*_{k-1} \ne g_{k-1} g 0 ∗ = g 0 , … , g k − 1 ∗ = g k − 1 , where 1 ≤ k ≤ v 1 \le k \le v 1 ≤ k ≤ v , such that g k − 1 ∗ ( r k − 1 ) = g k − 1 ( r k − 1 ) g^*_{k-1}(r_{k-1}) = g_{k-1}(r_{k-1}) g k − 1 ∗ ( r k − 1 ) = g k − 1 ( r k − 1 ) . Since g k − 1 g_{k - 1} g k − 1 and g k − 1 ∗ g^*_{k-1} g k − 1 ∗ are fixed after seeing the transcript ( r 0 , … , r k − 1 ) (r_0,\ldots,r_{k - 1}) ( r 0 , … , r k − 1 ) but before r k − 1 r_{k - 1} r k − 1 is chosen, they are independent of r k − 1 r_{k - 1} r k − 1 . Moreover, by the degree bounds, the (univariate) polynomial g k − 1 ∗ − g k − 1 g^*_{k - 1} - g_{k - 1} g k − 1 ∗ − g k − 1 is nonzero and has degree at most d k − 1 ≤ d : = d e g ( g ) d_{k - 1} \le d := \mathrm{deg}(g) d k − 1 ≤ d := deg ( g ) . Therefore, since r k − 1 r_{k - 1} r k − 1 is uniform in F \mathbb{F} F ,
P r [ ( g k − 1 ∗ − g k − 1 ) ( r k − 1 ) = 0 ] ≤ d k − 1 # F ≤ d # F (12) \mathrm{Pr}[(g^*_{k - 1} - g_{k - 1})(r_{k-1}) = 0] \le \frac{d_{k - 1}}{\#\mathbb{F}} \le \frac{d}{\#\mathbb{F}} \tag{12} Pr [( g k − 1 ∗ − g k − 1 ) ( r k − 1 ) = 0 ] ≤ # F d k − 1 ≤ # F d ( 12 ) by the univariate root bound (equivalently, the v = 1 v = 1 v = 1 case of Schwartz-Zippel Schwartz-Zippel ).
In each round j ≥ 1 j \ge 1 j ≥ 1 , while V verifies that g j − 1 ∗ ( r j − 1 ) = g j ∗ ( 0 ) + g j ∗ ( 1 ) g^*_{j-1}(r_{j-1}) = g^*_j(0) + g^*_j(1) g j − 1 ∗ ( r j − 1 ) = g j ∗ ( 0 ) + g j ∗ ( 1 ) (which could hold even if g j − 1 ∗ ( r j − 1 ) ≠ g j − 1 ( r j − 1 ) g^*_{j-1}(r_{j-1}) \ne g_{j-1}(r_{j-1}) g j − 1 ∗ ( r j − 1 ) = g j − 1 ( r j − 1 ) ), P can check whether g j − 1 ∗ ( r j − 1 ) = g j − 1 ( r j − 1 ) g^*_{j - 1}(r_{j - 1}) = g_{j-1}(r_{j - 1}) g j − 1 ∗ ( r j − 1 ) = g j − 1 ( r j − 1 ) . (This check is possible because the prover knows [or can compute from a witness defining] the underlying polynomial g g g and can efficiently evaluate g g g at arbitrary points. In particular, P can compute the value g j − 1 ( r j − 1 ) g_{j - 1}(r_{j - 1}) g j − 1 ( r j − 1 ) directly as a sum of evaluations of g g g without ever expanding g j − 1 g_{j - 1} g j − 1 symbolically.) If this equality holds, P can then revert to sending the ‘true’ polynomials g j ∗ = g j g^*_j = g_j g j ∗ = g j for subsequent rounds j j j and pass the sum-check protocol.
Finally, we note that V will accept a false value for the sum H H H in the end in the event that the above occurs for any k k k , 1 ≤ k ≤ v 1 \le k \le v 1 ≤ k ≤ v . Therefore, by the union bound and ( 12 ) (12) ( 12 ) ,
P r [ V accepts ∣ H ∗ ≠ H ] ≤ ∑ j = 0 v − 1 d j # F ≤ v d # F . \mathrm{Pr}[ \text{V accepts} \, | \, H^* \ne H] \le \frac{\sum_{j = 0}^{v - 1}d_j}{\#\mathbb{F}} \le \frac{vd}{\#\mathbb{F}}. Pr [ V accepts ∣ H ∗ = H ] ≤ # F ∑ j = 0 v − 1 d j ≤ # F v d . (i) If P provides a false value H ∗ H^* H ∗ for the initial sum, their strategy to pass the sum-check protocol might involve finding a polynomial g 0 ∗ ≠ g 0 g^*_0 \ne g_0 g 0 ∗ = g 0 , of degree at most d 0 d_0 d 0 , such that g 0 ∗ − g 0 g^*_0 - g_0 g 0 ∗ − g 0 has as many roots as possible in F \mathbb{F} F , while satisfying the condition g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = H ∗ g^*_0(0) + g^*_0(1) = H^* g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = H ∗ . This maximizes the likelihood that g 0 ∗ ( r 0 ) = g 0 ( r 0 ) g^*_0(r_0) = g_0(r_0) g 0 ∗ ( r 0 ) = g 0 ( r 0 ) . If this coincidence occurs, P can immediately switch to sending the ‘true’ polynomials to V, starting with g 1 ∗ = g 1 g^*_1 = g_1 g 1 ∗ = g 1 , since the acceptance condition g 0 ∗ ( r 0 ) = g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) g^*_0(r_0) = g^*_1(0) + g^*_1(1) g 0 ∗ ( r 0 ) = g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) will hold (because g 0 ( r 0 ) = g 1 ( 0 ) + g 1 ( 1 ) g_0(r_0) = g_1(0) + g_1(1) g 0 ( r 0 ) = g 1 ( 0 ) + g 1 ( 1 ) ). Notably, the acceptance condition might still hold even if g 0 ∗ ( r 0 ) ≠ g 0 ( r 0 ) g^*_0(r_0) \ne g_0(r_0) g 0 ∗ ( r 0 ) = g 0 ( r 0 ) . In that case, P would seek a polynomial g 1 ∗ ≠ g 1 g^*_1 \ne g_1 g 1 ∗ = g 1 such that g 1 ∗ − g 1 g^*_1 - g_1 g 1 ∗ − g 1 has as many roots as possible in F \mathbb{F} F , and so on.
For instance, suppose F \mathbb{F} F is a prime field of order p p p , and that g 0 g_0 g 0 has degree d 0 d_0 d 0 , where 2 ≤ d 0 < p 2 \le d_0 < p 2 ≤ d 0 < p . If { α 0 , … , α k − 1 } \{\alpha_0,\ldots,\alpha_{k-1}\} { α 0 , … , α k − 1 } is any set of k k k distinct field elements such that
[ ( 0 − α 0 ) ⋯ ( 0 − α k − 1 ) ] + [ ( 1 − α 0 ) ⋯ ( 1 − α k − 1 ) ] ≠ 0 , [(0 - \alpha_0)\cdots (0 - \alpha_{k-1})] + [(1 - \alpha_0)\cdots (1 - \alpha_{k-1})] \ne 0, [( 0 − α 0 ) ⋯ ( 0 − α k − 1 )] + [( 1 − α 0 ) ⋯ ( 1 − α k − 1 )] = 0 , and if α k ∈ F \alpha_{k} \in \mathbb{F} α k ∈ F satisfies
( 0 − α k ) = [ H ∗ − H ] − [ ( 1 − α 0 ) ⋯ ( 1 − α k − 1 ) ] [ ( 0 − α 0 ) ⋯ ( 0 − α k − 1 ) ] + [ ( 1 − α 0 ) ⋯ ( 1 − α k − 1 ) ] , (0 - \alpha_{k}) = \frac{[H^* - H] - [(1 - \alpha_0)\cdots (1 - \alpha_{k-1})]}{[(0 - \alpha_0)\cdots (0 - \alpha_{k-1})] + [(1 - \alpha_0)\cdots (1 - \alpha_{k-1})]}, ( 0 − α k ) = [( 0 − α 0 ) ⋯ ( 0 − α k − 1 )] + [( 1 − α 0 ) ⋯ ( 1 − α k − 1 )] [ H ∗ − H ] − [( 1 − α 0 ) ⋯ ( 1 − α k − 1 )] , then
[ ( 0 − α 0 ) ⋯ ( 0 − α k ) ] + [ ( 1 − α 0 ) ⋯ ( 1 − α k ) ] = H ∗ − H ≠ 0. [(0 - \alpha_0)\cdots (0 - \alpha_{k})] + [(1 - \alpha_0)\cdots (1 - \alpha_{k})] = H^* - H \ne 0. [( 0 − α 0 ) ⋯ ( 0 − α k )] + [( 1 − α 0 ) ⋯ ( 1 − α k )] = H ∗ − H = 0. If α k ∉ { α 0 , … , α k − 1 } \alpha_{k} \not\in \{\alpha_0,\ldots,\alpha_{k - 1}\} α k ∈ { α 0 , … , α k − 1 } , then we now have k + 1 k + 1 k + 1 distinct field elements α 0 , … , α k \alpha_0,\ldots,\alpha_k α 0 , … , α k such that
g 0 ∗ ( X 0 ) : = g 0 ( X 0 ) + ( X 0 − α 0 ) ⋯ ( X 0 − α k ) g^*_0(X_0) := g_0(X_0) + (X_0 - \alpha_0)\cdots (X_0 - \alpha_{k}) g 0 ∗ ( X 0 ) := g 0 ( X 0 ) + ( X 0 − α 0 ) ⋯ ( X 0 − α k ) satisfies
g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = H ∗ . g^*_0(0) + g^*_0(1) = H^*. g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = H ∗ . A dishonest prover P may try to generate such a polynomial g 0 ∗ g^*_0 g 0 ∗ with k k k as large as possible while not exceeding d 0 − 1 d_0 - 1 d 0 − 1 . Then g 0 ∗ g_0^* g 0 ∗ is distinct from g 0 g_0 g 0 , has degree at most d 0 d_0 d 0 , and g 0 ∗ ( r 0 ) = g 0 ( r 0 ) g^*_0(r_0) = g_0(r_0) g 0 ∗ ( r 0 ) = g 0 ( r 0 ) if and only if r 0 ∈ { α 0 , α 1 , … , α k } r_0 \in \{\alpha_0,\alpha_1,\ldots,\alpha_{k}\} r 0 ∈ { α 0 , α 1 , … , α k } . That is, P r [ g 0 ∗ ( r 0 ) = g 0 ( r 0 ) ] = ( k + 1 ) / # F \mathrm{Pr}[ g^*_0(r_0) = g_0(r_0) ] = (k+1)/\#\mathbb{F} Pr [ g 0 ∗ ( r 0 ) = g 0 ( r 0 )] = ( k + 1 ) /# F . Given that g 0 ∗ ≠ g 0 g^*_0 \ne g_0 g 0 ∗ = g 0 and d e g ( g 0 ∗ ) ≤ d e g ( g 0 ) ≤ d e g ( g ) \mathrm{deg}(g^*_0) \le \mathrm{deg}(g_0) \le \mathrm{deg}(g) deg ( g 0 ∗ ) ≤ deg ( g 0 ) ≤ deg ( g ) , this probability can be at most d / # F d/\#\mathbb{F} d /# F , by the Schwartz-Zippel lemma .
Alternatively, P could start with a multivariate polynomial g ∗ g^* g ∗ different from g g g , where d e g ( g ∗ ) ≤ d \mathrm{deg}(g^*) \le d deg ( g ∗ ) ≤ d and the sum of g ∗ g^* g ∗ over the Boolean hypercube equals H ∗ ≠ H H^* \ne H H ∗ = H . P would then respond to all of V’s challenges as though g ∗ g^* g ∗ were the same as g g g . For the final check to pass, it would require that g ∗ ( r 0 , … , r v − 1 ) = g ( r 0 , … , r v − 1 ) g^*(r_0, \ldots, r_{v-1}) = g(r_0, \ldots, r_{v-1}) g ∗ ( r 0 , … , r v − 1 ) = g ( r 0 , … , r v − 1 ) . P could maximize the likelihood of this by choosing a g ∗ ≠ g g^* \ne g g ∗ = g such that g ∗ − g g^* - g g ∗ − g has as many roots as possible in F v \mathbb{F}^v F v . By the Schwartz-Zippel lemma, the probability that ( r 0 , … , r v − 1 ) (r_0, \ldots, r_{v - 1}) ( r 0 , … , r v − 1 ) is a root of g ∗ − g g^* - g g ∗ − g remains at most v d / # F vd/\#\mathbb{F} v d /# F .
(ii) If the degree d d d of g g g were concealed from V, a dishonest P could inflate the degrees of the g j ∗ g^*_j g j ∗ polynomials, increasing the probability of passing.
(iii) In the sum-check protocol, the degree d d d of g g g and the number of indeterminates v v v are typically known to V beforehand, as they are determined by the structure of the problem being verified. These parameters are either agreed upon during the setup phase or are intrinsic to the function being evaluated (e.g., a multilinear extension or arithmetic circuit). The verifier ensures the prover’s adherence to these parameters by checking that the submitted polynomials meet the degree constraints at each round.
from sympy import symbols, Poly, GF
from gkr import sum_check_example
x, y, z = symbols("x y z")
g = Poly(x**2 + 2*x*y*z + y*z**2, x, y, z, domain=GF(331, symmetric=False))
sum_check_example(scenario={"poly": g, "claim": 7, "challenges": [6, 77, 4]})
Let
g(x, y, z) = x**2 + 2*x*y*z + y*z**2.
We display g for the reader. In the protocol, V does not receive g explicitly; V only has oracle/committed evaluation access to g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 1, 2].
Let
H := sum g(b_0, b_1, b_2) over (b_0, b_1, b_2) in {0,1}^3.
P claims that H = H*, where H* = 7.
In this run, P's initial claim H* is intentionally false, and P will try to get away with it.
Let
g_0(x) := sum g(x, b_1, b_2) over (b_1, b_2) in {0,1}^2
P claims that g_0(x) = g*_0(x), where
g*_0(x) = 5*x**2 + 1.
If P's last two claims are true, then deg(g*_0) ≤ deg_0(g) and H* = g*_0(0) + g*_0(1).
V checks the degree bound: deg(g*_0) = 2 ≤ deg_0(g) = 2.
P's claim is that H = H* = 7. V proceeds to compute:
This is easy because g*_0 is given explicitly, so V can evaluate it at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_0 = 6.
Let
g_1(y) := sum g(6, y, b_2) over (b_2) in {0,1}^1
P claims that g_1(y) = g*_1(y), where
g*_1(y) = 35*y + 73.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(6) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 1 ≤ deg_1(g) = 1.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_1 = 77.
Let
g_2(z) := g(6, 77, z)
P claims that g_2(z) = g*_2(z), where
g*_2(z) = 78*z**2 + 301*z + 36.
If P's last two claims are true, then deg(g*_2) ≤ deg_2(g) and g*_1(77) = g*_2(0) + g*_2(1).
V checks the degree bound: deg(g*_2) = 2 ≤ deg_2(g) = 2.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_2 = 4.
If all of P's claims are true, then
g*_2(4) = g(6, 77, 4).
V computes
g*_2(4) = 171.
Finally, V queries an oracle for g at r to obtain
g(6, 77, 4) = 330.
P fails the final verification, and V REJECTS P's initial claim that H = H*.
Interpretation: P can often keep the transcript locally consistent round-by-round, but the final random evaluation ties the transcript to the true g and typically catches a lie.
True polynomial g:
g(x, y, z) = x**2 + 2*x*y*z + y*z**2
True value of H := sum g(b) over b in {0,1}^3 is: 8
Prover claimed that this is equal to: H* = 7.
This was a TRUE NEGATIVE: V rejected a false claim.
from sympy import symbols, Poly, GF
from gkr import sum_check_example
x, y, z = symbols("x y z")
g = Poly(x**2 + 2*x*y*z + y*z**2, x, y, z, domain=GF(331, symmetric=False))
sum_check_example(scenario={"poly": g, "claim": 7, "challenges": [2, 4, 1]})
Let
g(x, y, z) = x**2 + 2*x*y*z + y*z**2.
We display g for the reader. In the protocol, V does not receive g explicitly; V only has oracle/committed evaluation access to g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 1, 2].
Let
H := sum g(b_0, b_1, b_2) over (b_0, b_1, b_2) in {0,1}^3.
P claims that H = H*, where H* = 7.
In this run, P's initial claim H* is intentionally false, and P will try to get away with it.
Let
g_0(x) := sum g(x, b_1, b_2) over (b_1, b_2) in {0,1}^2
P claims that g_0(x) = g*_0(x), where
g*_0(x) = 5*x**2 + 1.
If P's last two claims are true, then deg(g*_0) ≤ deg_0(g) and H* = g*_0(0) + g*_0(1).
V checks the degree bound: deg(g*_0) = 2 ≤ deg_0(g) = 2.
P's claim is that H = H* = 7. V proceeds to compute:
This is easy because g*_0 is given explicitly, so V can evaluate it at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_0 = 2.
Let
g_1(y) := sum g(2, y, b_2) over (b_2) in {0,1}^1
P claims that g_1(y) = g*_1(y), where
g*_1(y) = 5*y + 8.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(2) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 1 ≤ deg_1(g) = 1.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_1 = 4.
P claims that g_2(z) = g*_2(z), where
g*_2(z) = 4*z**2 + 16*z + 4.
If P's last two claims are true, then deg(g*_2) ≤ deg_2(g) and g*_1(4) = g*_2(0) + g*_2(1).
V checks the degree bound: deg(g*_2) = 2 ≤ deg_2(g) = 2.
This is easy because both claimed polynomials are given explicitly, and V only needs univariate evaluations at 0 and 1.
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(331); here r_2 = 1.
If all of P's claims are true, then
g*_2(1) = g(2, 4, 1).
Finally, V queries an oracle for g at r to obtain
g(2, 4, 1) = 24.
P passes the final verification, and V ACCEPTS P's initial claim that H = H*.
P HAS DECEIVED V: THE TRUE VALUE OF H IS IN FACT 8.
P GOT LUCKY: the final random check happened not to expose the inconsistency this time. Over a large field, this success event should be rare.
True polynomial g:
g(x, y, z) = x**2 + 2*x*y*z + y*z**2
True value of H := sum g(b) over b in {0,1}^3 is: 8
Prover claimed that this is equal to: H* = 7.
This was a FALSE POSITIVE: V accepted a false claim (P got lucky).
Complexity and proof size ¶ Verifier’s runtime ¶ In Round j j j of the sum-check protocol, verifier V performs the following steps:
Degree bound check: verify that deg ( g j ∗ ) ≤ d j \deg(g_j^*) \le d_j deg ( g j ∗ ) ≤ d j .
Consistency check: verify that g j − 1 ∗ ( r j − 1 ) = g j ∗ ( 0 ) + g j ∗ ( 1 ) g^*_{j-1}(r_{j-1}) = g^*_j(0) + g^*_j(1) g j − 1 ∗ ( r j − 1 ) = g j ∗ ( 0 ) + g j ∗ ( 1 ) (with H ∗ H^* H ∗ substituted for g − 1 ∗ ( r − 1 ) g^*_{-1}(r_{-1}) g − 1 ∗ ( r − 1 ) in Round 0, i.e. H ∗ = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) H^* = g^*_0(0) + g^*_0(1) H ∗ = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) ).
Sample a random field element r j ∈ F r_j \in \mathbb{F} r j ∈ F .
Final check: verify that g v − 1 ∗ ( r v − 1 ) = g ( r 0 , … , r v − 1 ) g^*_{v-1}(r_{v-1}) = g(r_0,\ldots,r_{v-1}) g v − 1 ∗ ( r v − 1 ) = g ( r 0 , … , r v − 1 ) .
Note that each d j : = deg j ( g ) d_j := \deg_j(g) d j := deg j ( g ) satisfies d j ≤ d d_j \le d d j ≤ d , where d : = deg ( g ) d := \deg(g) d := deg ( g ) is the total degree. Since each g j ∗ g^*_j g j ∗ is a univariate polynomial, the work in Round j j j is:
Degree verification: O ( t j ) O(t_j) O ( t j ) field operations, where t j t_j t j is the number of terms used to represent g j ∗ g_j^* g j ∗ (e.g. the number of nonzero coefficients sent as pairs ( i , c i ) (i,c_i) ( i , c i ) ). In the dense-coefficient representation this is O ( d ) O(d) O ( d ) .
Evaluation check: O ( d ) O(d) O ( d ) field operations, because evaluating a univariate polynomial of degree at most d d d can be done with d d d multiplications and d d d additions using Horner’s method.
Random field element generation: this is often treated as O ( 1 ) O(1) O ( 1 ) in protocol analyses (randomness is assumed available). In bit complexity, sampling a uniform element from F p k \mathbb{F}_{p^k} F p k costs O ( k log p ) O(k\log p) O ( k log p ) expected time (e.g. by rejection sampling in F p \mathbb{F}_p F p and sampling k k k coefficients for F p k \mathbb{F}_{p^k} F p k ).
Final round verification: O ( d ) O(d) O ( d ) field operations to compute g v − 1 ∗ ( r v − 1 ) g^*_{v-1}(r_{v-1}) g v − 1 ∗ ( r v − 1 ) , plus the cost of obtaining and verifying the value g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) (one oracle query in the interactive-proof model, or one commitment opening verification in cryptographic implementations).
Horner’s method is an efficient way to evaluate a polynomial given its coefficients. Rewrite a degree-d d d polynomial
P ( X ) = c 0 + c 1 X + ⋯ + c d X d P(X) = c_0 + c_1X + \cdots + c_d X^d P ( X ) = c 0 + c 1 X + ⋯ + c d X d in nested form:
P ( X ) = c 0 + X ( c 1 + X ( c 2 + ⋯ + X ( c d − 1 + X c d ) ⋯ ) ) . P(X) = c_0 + X\bigl(c_1 + X\bigl(c_2 + \cdots + X(c_{d-1} + Xc_d)\cdots\bigr)\bigr). P ( X ) = c 0 + X ( c 1 + X ( c 2 + ⋯ + X ( c d − 1 + X c d ) ⋯ ) ) . Given a ∈ F a \in \mathbb{F} a ∈ F , set A d : = c d A_d := c_d A d := c d and compute recursively
A j = c j + a A j + 1 , j = d − 1 , d − 2 , … , 0. A_j = c_j + aA_{j+1}, \quad j = d-1, d-2,\ldots,0. A j = c j + a A j + 1 , j = d − 1 , d − 2 , … , 0. Then P ( a ) = A 0 P(a) = A_0 P ( a ) = A 0 .
In practical implementations, d d d is usually much smaller than k log p k\log p k log p , so random number generation can dominate if done online. To mitigate this, r 0 , … , r v − 1 r_0,\ldots,r_{v-1} r 0 , … , r v − 1 are typically precomputed. We assume this is the case.
Complexity of evaluating g g g at a point. A v v v -variate polynomial of total degree d d d has at most
( v + d d ) \binom{v + d}{d} ( d v + d ) monomials (nonzero terms): one for each exponent tuple ( e 0 , … , e v − 1 ) (e_0,\ldots,e_{v-1}) ( e 0 , … , e v − 1 ) with e 0 + ⋯ + e v − 1 ≤ d e_0 + \cdots + e_{v-1} \le d e 0 + ⋯ + e v − 1 ≤ d .
Using a monomial-sum representation, one can evaluate g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) by evaluating and summing all monomials. Each monomial evaluation requires O ( v ) O(v) O ( v ) field operations (e.g. multiplying together the v v v contributions r i e i r_i^{e_i} r i e i , with e i ≤ d e_i \le d e i ≤ d ), so the total is
O ( ( v + d d ) ⋅ v ) . O\!\left(\binom{v + d}{d}\cdot v\right). O ( ( d v + d ) ⋅ v ) . Since ( v + d d ) = Θ ( v d ) \binom{v + d}{d} = \Theta(v^d) ( d v + d ) = Θ ( v d ) for constant d d d , this becomes O ( v d + 1 ) O(v^{d+1}) O ( v d + 1 ) when d d d is bounded (in many applications d d d is 2 or 3).
Verifier’s total runtime. Ignoring randomness generation (or assuming it is done offline), V’s work across all rounds is
plus the cost of a single oracle query / commitment opening verification for g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) in the final check.
Verifier’s space complexity ¶ The verifier generates and stores the v v v random field elements r 0 , … , r v − 1 r_0, \ldots, r_{v-1} r 0 , … , r v − 1 , all of which must be retained because g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) is compared against g v − 1 ∗ ( r v − 1 ) g^*_{v-1}(r_{v-1}) g v − 1 ∗ ( r v − 1 ) in the final round.
In each round j j j (0 ≤ j ≤ v − 1 0 \le j \le v-1 0 ≤ j ≤ v − 1 ), V receives a univariate polynomial g j ∗ g_j^* g j ∗ of degree at most d j ≤ d d_j \le d d j ≤ d . If g j ∗ g_j^* g j ∗ is sent in coefficient form, storing it requires O ( d + 1 ) O(d+1) O ( d + 1 ) field elements (or O ( t j ) O(t_j) O ( t j ) in sparse form). Evaluating g j ∗ g_j^* g j ∗ at a point via Horner’s method uses only O ( 1 ) O(1) O ( 1 ) working memory beyond access to the coefficients (one running accumulator), and each polynomial is needed for at most two consecutive rounds.
Thus, measured in field elements, the total space complexity for the verifier is O ( v + d ) O(v + d) O ( v + d ) . If the field is F p k \mathbb{F}_{p^k} F p k and each field element is represented using O ( k log p ) O(k\log p) O ( k log p ) bits, then the bit space complexity is O ( ( v + d ) k log p ) O((v + d)k\log p) O (( v + d ) k log p ) .
Prover’s runtime ¶ In Round 0, an honest prover P computes
g 0 ( X 0 ) : = ∑ b 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( X 0 , b 1 , … , b v − 1 ) . g_0(X_0) := \sum_{b_1 \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(X_0,b_1,\ldots,b_{v-1}). g 0 ( X 0 ) := b 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( X 0 , b 1 , … , b v − 1 ) . Computing g 0 g_0 g 0 by direct summation requires evaluating g g g at each point ( X 0 , b 1 , … , b v − 1 ) (X_0,b_1,\ldots,b_{v-1}) ( X 0 , b 1 , … , b v − 1 ) with ( b 1 , … , b v − 1 ) ∈ { 0 , 1 } v − 1 (b_1,\ldots,b_{v-1}) \in \{0,1\}^{v-1} ( b 1 , … , b v − 1 ) ∈ { 0 , 1 } v − 1 , i.e. at 2 v − 1 2^{v-1} 2 v − 1 points. If g g g is represented as a sum of monomials, evaluating g g g at one point takes
O ( ( v + d d ) ⋅ v ) O\!\left(\binom{v + d}{d}\cdot v\right) O ( ( d v + d ) ⋅ v ) field operations, so the total cost in Round 0 is
O ( ( v + d d ) ⋅ v ⋅ 2 v − 1 ) . O\!\left(\binom{v + d}{d}\cdot v \cdot 2^{v-1}\right). O ( ( d v + d ) ⋅ v ⋅ 2 v − 1 ) . In Round j j j , 1 ≤ j ≤ v − 1 1 \le j \le v-1 1 ≤ j ≤ v − 1 , an honest prover P computes
g j ( X j ) : = ∑ b j + 1 ∈ { 0 , 1 } ⋯ ∑ b v − 1 ∈ { 0 , 1 } g ( r 0 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) , g_j(X_j) := \sum_{b_{j+1} \in \{0,1\}} \cdots \sum_{b_{v-1} \in \{0,1\}} g(r_0,\ldots,r_{j-1},X_j,b_{j+1},\ldots,b_{v-1}), g j ( X j ) := b j + 1 ∈ { 0 , 1 } ∑ ⋯ b v − 1 ∈ { 0 , 1 } ∑ g ( r 0 , … , r j − 1 , X j , b j + 1 , … , b v − 1 ) , which involves 2 v − j − 1 2^{v-j-1} 2 v − j − 1 evaluations of (a specialization of) g g g . Using the same monomial-sum evaluation model, the work in Round j j j is at most
O ( ( v + d d ) ⋅ v ⋅ 2 v − j − 1 ) . O\!\left(\binom{v + d}{d}\cdot v \cdot 2^{v-j-1}\right). O ( ( d v + d ) ⋅ v ⋅ 2 v − j − 1 ) . Summing across all rounds gives
∑ j = 0 v − 1 O ( ( v + d d ) ⋅ v ⋅ 2 v − j − 1 ) = O ( ( v + d d ) ⋅ v ⋅ 2 v ) , \sum_{j=0}^{v-1} O\!\left(\binom{v + d}{d}\cdot v \cdot 2^{v-j-1}\right)
= O\!\left(\binom{v + d}{d}\cdot v \cdot 2^v\right), j = 0 ∑ v − 1 O ( ( d v + d ) ⋅ v ⋅ 2 v − j − 1 ) = O ( ( d v + d ) ⋅ v ⋅ 2 v ) , since 2 v − 1 + 2 v − 2 + ⋯ + 1 = 2 v − 1 2^{v-1} + 2^{v-2} + \cdots + 1 = 2^v - 1 2 v − 1 + 2 v − 2 + ⋯ + 1 = 2 v − 1 .
Equivalently,
O ( ( v + d d ) ⋅ v ⋅ 2 v ) = O ( v ( v + d ) d 2 v d ! ) . O\!\left(\binom{v + d}{d}\cdot v \cdot 2^v\right)
= O\!\left(\frac{v(v + d)^d 2^v}{d!}\right). O ( ( d v + d ) ⋅ v ⋅ 2 v ) = O ( d ! v ( v + d ) d 2 v ) . If d d d is bounded, this simplifies to O ( v d + 1 2 v ) O(v^{d+1}2^v) O ( v d + 1 2 v ) , dominated by the exponential term 2 v 2^v 2 v arising from the Boolean hypercube.
Prover’s space complexity ¶ P’s space complexity is dominated by storing the multivariate polynomial g ( X 0 , … , X v − 1 ) g(X_0,\ldots,X_{v-1}) g ( X 0 , … , X v − 1 ) . In a monomial-sum representation, g g g may have up to ( v + d d ) \binom{v + d}{d} ( d v + d ) nonzero terms, and each term requires storing a coefficient together with its exponent tuple. Thus the storage for g g g is O ( ( v + d d ) ) O\!\left(\binom{v + d}{d}\right) O ( ( d v + d ) ) field elements (up to constant-factor overhead for exponents).
During each round, P computes and sends a univariate polynomial g j ( X j ) g_j(X_j) g j ( X j ) of degree at most d d d , which can be stored using O ( d + 1 ) O(d+1) O ( d + 1 ) field elements. The working memory needed to sum over the hypercube can be kept small: P can stream through the 2 v − j − 1 2^{v-j-1} 2 v − j − 1 points, maintaining only an accumulator for each coefficient of g j g_j g j (i.e. O ( d + 1 ) O(d+1) O ( d + 1 ) field elements), plus whatever temporary values are needed to evaluate g g g at one point. If P precomputes the powers r i 0 , … , r i d r_i^0,\ldots,r_i^d r i 0 , … , r i d for the specialized point, this adds O ( v d ) O(vd) O ( v d ) field elements; otherwise the working memory can be treated as O ( 1 ) O(1) O ( 1 ) beyond the accumulator.
Overall, the prover’s space is dominated by the representation size of g g g , namely O ( ( v + d d ) ) O\!\left(\binom{v + d}{d}\right) O ( ( d v + d ) ) field elements (or O ( v d ) O(v^d) O ( v d ) for bounded d d d ), plus lower-order terms such as O ( v d ) O(vd) O ( v d ) and O ( d ) O(d) O ( d ) .
Proof size ¶ The proof size is the total amount of information communicated from the prover to the verifier during the sum-check protocol.
In each round j j j , 0 ≤ j ≤ v − 1 0 \le j \le v-1 0 ≤ j ≤ v − 1 , P sends a univariate polynomial of degree at most d j ≤ d d_j \le d d j ≤ d to V. In coefficient form this requires at most d + 1 d+1 d + 1 field elements per round (or fewer in sparse form). Thus, counting only the sum-check messages, the total proof size is
field elements. In bit terms, since each element of F p k \mathbb{F}_{p^k} F p k can be encoded using O ( k log p ) O(k\log p) O ( k log p ) bits, the sum-check proof size is
O ( v d k log p ) O(vdk\log p) O ( v d k log p ) bits. (In cryptographic implementations, one must additionally account for the size of the opening proof used in the final check to justify the value g ( r 0 , … , r v − 1 ) g(r_0,\ldots,r_{v-1}) g ( r 0 , … , r v − 1 ) .)
Thaler, J. (2015). A note on the GKR protocol . https://api.semanticscholar.org/CorpusID:16402332 Lund, C., Fortnow, L., Karloff, H., & Nisan, N. (1992). Algebraic methods for interactive proof systems. Journal of the ACM , 39 (4), 859–868. 10.1145/146585.146605 DeMillo, R. A., & Lipton, R. J. (1978). A probabilistic remark on algebraic program testing. Information Processing Letters , 7 (4), 193–195. 10.1016/0020-0190(78)90067-4 Schwartz, J. T. (1980). Fast probabilistic algorithms for verification of polynomial identities. Journal of the ACM , 27 (4), 701–717. 10.1145/322217.322225 Zippel, R. (1979). Probabilistic algorithms for sparse polynomials. In E. W. Ng (Ed.), Symbolic and Algebraic Computation, EUROSAM ’79, An International Symposium on Symbolic and Algebraic Computation, Marseille, France, June 1979, Proceedings (Vol. 72, pp. 216–226). Springer. 10.1007/3-540-09519-5_73 Ore, Ø. (1922). Über höhere Kongruenzen. Norsk Matematisk Forenings Skrifter, Ser. I , 7 , 15.