GKR protocol
import gkr
env = gkr.init(verbose=False)
Introduction ¶ Building on our exploration of the sum-check protocol , multilinear extensions , and arithmetic circuits , we are now ready to present the GKR protocol in full. Originally introduced by Goldwasser, Kalai, and Rothblum 1 2 , and refined by many authors since, GKR is a cornerstone of modern interactive proofs for verifying circuit computations. This notebook assembles the objects and identities from the previous notebooks and shows how they combine into the protocol itself. We follow Thaler’s presentation 3 .
Worked Example ¶ We proceed via a complete worked example. It serves two purposes: (i) to summarize the key objects (multilinear extensions, wiring predicates, Thaler’s identity), and (ii) to illustrate the recurring GKR pattern: run sum-check on Thaler’s identity , then apply a folding step that converts a claim about two values into a single claim at a fresh random point.
No example small enough to compute fully by hand can showcase GKR’s asymptotic savings: our toy computation is trivial, while the protocol machinery is comparatively elaborate. The value of the example is conceptual. Later we will discuss complexity and explain why, for large circuits, the verifier’s work in GKR is asymptotically far smaller than re-evaluating the circuit.
Example 1 [setup and arithmetic circuit]. Work over the field F = Z / p Z \mathbb{F} = \mathbb{Z}/p\mathbb{Z} F = Z / p Z , where p = 2 31 − 1 p = 2^{31} - 1 p = 2 31 − 1 is the eighth Mersenne prime. Consider the 4-variate polynomial
P ∈ F [ X 0 , X 1 , X 2 , X 3 ] , P ( X 0 , X 1 , X 2 , X 3 ) : = X 0 X 1 + X 2 + X 3 . P \in \mathbb{F}[X_0,X_1,X_2,X_3], \quad P(X_0,X_1,X_2,X_3) := X_0X_1 + X_2 + X_3. P ∈ F [ X 0 , X 1 , X 2 , X 3 ] , P ( X 0 , X 1 , X 2 , X 3 ) := X 0 X 1 + X 2 + X 3 . For instance,
P ( 3 , 2 , 4 , 1 ) ≡ ( 3 ⋅ 2 ) + ( 4 + 1 ) ≡ 11 m o d p . P(3,2,4,1) \equiv (3\cdot 2) + (4 + 1) \equiv 11 \bmod p. P ( 3 , 2 , 4 , 1 ) ≡ ( 3 ⋅ 2 ) + ( 4 + 1 ) ≡ 11 mod p . We represent this computation by a constant-input, binary, strictly layered arithmetic circuit C C C of size 7 and depth d = 2 d = 2 d = 2 :
Layer 2 (inputs): the four inputs 3 , 2 , 4 , 1 3,2,4,1 3 , 2 , 4 , 1 ;
Layer 1: one multiplication gate and one addition gate, computing 3 ⋅ 2 ≡ 6 3\cdot 2 \equiv 6 3 ⋅ 2 ≡ 6 and 4 + 1 ≡ 5 4 + 1 \equiv 5 4 + 1 ≡ 5 ;
Layer 0 (output): one addition gate computing 6 + 5 ≡ 11 6 + 5 \equiv 11 6 + 5 ≡ 11 .
In this example, Layer i has size S i = 2 i S_i = 2^i S i = 2 i , hence bit-length s i = ⌈ log 2 S i ⌉ = i s_i = \lceil \log_2 S_i\rceil = i s i = ⌈ log 2 S i ⌉ = i for i ∈ { 0 , 1 , 2 } i \in \{0,1,2\} i ∈ { 0 , 1 , 2 } . (For general circuits, s i s_i s i need not equal i i i .)
We label the gates in Layer i using bitstrings of length s i s_i s i as follows:
Layer 2 (inputs): 3 ↦ ( 0 , 0 ) , 2 ↦ ( 0 , 1 ) , 4 ↦ ( 1 , 0 ) , 1 ↦ ( 1 , 1 ) 3 \mapsto (0,0), \; 2 \mapsto (0,1), \; 4 \mapsto (1,0), \; 1 \mapsto (1,1) 3 ↦ ( 0 , 0 ) , 2 ↦ ( 0 , 1 ) , 4 ↦ ( 1 , 0 ) , 1 ↦ ( 1 , 1 ) .
Layer 1: × ↦ 0 , + ↦ 1 \times \mapsto 0, \; + \mapsto 1 × ↦ 0 , + ↦ 1 .
Layer 0 (output): + ↦ ∅ + \mapsto \emptyset + ↦ ∅ (the empty bitstring, also written ( ) () ( ) ).
from gkr.ac import ArithmeticCircuit
expression_01 = '(3*2) + (4 + 1)'
gkr_01 = ArithmeticCircuit(expression_01, prime=2**31 - 1)
display(gkr_01.graphviz_circuit_bitstring)Gate-value functions. For each layer i ∈ { 0 , … , d } i \in \{0,\ldots,d\} i ∈ { 0 , … , d } , the gate-value function
W i : { 0 , 1 } s i → F W_i : \{0,1\}^{s_i} \to \mathbb{F} W i : { 0 , 1 } s i → F records the value at each gate. By multilinear interpolation on the Boolean hypercube, each W i W_i W i has a unique multilinear extension
W ~ i : F s i → F . \widetilde{W}_i : \mathbb{F}^{s_i} \to \mathbb{F}. W i : F s i → F . Example 1 [gate-value functions]. In our example,
W 2 ( 0 , 0 ) = 3 , W 2 ( 0 , 1 ) = 2 , W 2 ( 1 , 0 ) = 4 , W 2 ( 1 , 1 ) = 1 , W 1 ( 0 ) = 6 , W 1 ( 1 ) = 5 , W 0 ( ∅ ) = 11. \begin{align}
W_2(0,0) &= 3, & W_2(0,1) &= 2, & W_2(1,0) &= 4, & W_2(1,1) &= 1,\\
W_1(0) &= 6, & W_1(1) &= 5,\\
W_0(\emptyset) &= 11.
\end{align} W 2 ( 0 , 0 ) W 1 ( 0 ) W 0 ( ∅ ) = 3 , = 6 , = 11. W 2 ( 0 , 1 ) W 1 ( 1 ) = 2 , = 5 , W 2 ( 1 , 0 ) = 4 , W 2 ( 1 , 1 ) = 1 , These admit the multilinear extensions (computed explicitly below)
W ~ 2 ( v 0 , v 1 ) = − 2 v 0 v 1 + v 0 − v 1 + 3 , W ~ 1 ( v ) = 6 − v , W ~ 0 ( ∅ ) = 11. \widetilde{W}_2(v_0,v_1) = -2v_0v_1 + v_0 - v_1 + 3,\qquad
\widetilde{W}_1(v) = 6 - v,\qquad
\widetilde{W}_0(\emptyset) = 11. W 2 ( v 0 , v 1 ) = − 2 v 0 v 1 + v 0 − v 1 + 3 , W 1 ( v ) = 6 − v , W 0 ( ∅ ) = 11. For instance,
W ~ 2 ( 1 , 1 ) = − 2 ( 1 ⋅ 1 ) + 1 − 1 + 3 ≡ 1 m o d p , \widetilde{W}_2(1,1) = -2(1\cdot 1) + 1 - 1 + 3 \equiv 1 \bmod p, W 2 ( 1 , 1 ) = − 2 ( 1 ⋅ 1 ) + 1 − 1 + 3 ≡ 1 mod p , matching W 2 ( 1 , 1 ) W_2(1,1) W 2 ( 1 , 1 ) .
Wiring predicates. For i ∈ { 0 , … , d − 1 } i \in \{0,\ldots,d-1\} i ∈ { 0 , … , d − 1 } , define wiring predicates
a d d i , m u l t i : { 0 , 1 } s i × { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 → { 0 , 1 } , \mathrm{add}_i,\,\mathrm{mult}_i : \{0,1\}^{s_i} \times \{0,1\}^{s_{i+1}} \times \{0,1\}^{s_{i+1}} \to \{0,1\}, add i , mult i : { 0 , 1 } s i × { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 → { 0 , 1 } , encoding the circuit topology. Concretely, a d d i ( c , a , b ) = 1 \mathrm{add}_i(\mathbf{c},\mathbf{a},\mathbf{b}) = 1 add i ( c , a , b ) = 1 iff c \mathbf{c} c is an addition gate whose two children are a \mathbf{a} a and b \mathbf{b} b , and a ≤ b \mathbf{a} \le \mathbf{b} a ≤ b (lexicographic order). Similarly for m u l t i \mathrm{mult}_i mult i . Each wiring predicate has a unique multilinear extension
a d d ~ i , m u l t ~ i : F s i × F s i + 1 × F s i + 1 → F . \widetilde{\mathrm{add}}_i,\,\widetilde{\mathrm{mult}}_i : \mathbb{F}^{s_i} \times \mathbb{F}^{s_{i+1}} \times \mathbb{F}^{s_{i+1}} \to \mathbb{F}. add i , mult i : F s i × F s i + 1 × F s i + 1 → F . Example 1 [wiring predicates]. In our circuit,
a d d 0 ( ∅ , 0 , 1 ) = 1 , m u l t 1 ( 0 , ( 0 , 0 ) , ( 0 , 1 ) ) = 1 , a d d 1 ( 1 , ( 1 , 0 ) , ( 1 , 1 ) ) = 1 , \mathrm{add}_0(\emptyset,0,1) = 1,\quad
\mathrm{mult}_1(0,(0,0),(0,1)) = 1,\quad
\mathrm{add}_1(1,(1,0),(1,1)) = 1, add 0 ( ∅ , 0 , 1 ) = 1 , mult 1 ( 0 , ( 0 , 0 ) , ( 0 , 1 )) = 1 , add 1 ( 1 , ( 1 , 0 ) , ( 1 , 1 )) = 1 , and all other values are zero. The multilinear extensions are:
a d d ~ 0 ( ∅ , x , y ) = ( 1 − x ) y , m u l t ~ 0 ( ∅ , x , y ) = 0 , a d d ~ 1 ( z , ( x 0 , x 1 ) , ( y 0 , y 1 ) ) = z x 0 ( 1 − x 1 ) y 0 y 1 , m u l t ~ 1 ( z , ( x 0 , x 1 ) , ( y 0 , y 1 ) ) = ( 1 − z ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 . \begin{align}
\widetilde{\mathrm{add}}_0(\emptyset,x,y) &= (1-x)y,\\
\widetilde{\mathrm{mult}}_0(\emptyset,x,y) &= 0,\\
\widetilde{\mathrm{add}}_1(z,(x_0,x_1),(y_0,y_1)) &= zx_0(1-x_1)y_0y_1,\\
\widetilde{\mathrm{mult}}_1(z,(x_0,x_1),(y_0,y_1)) &= (1-z)(1-x_0)(1-x_1)(1-y_0)y_1.
\end{align} add 0 ( ∅ , x , y ) mult 0 ( ∅ , x , y ) add 1 ( z , ( x 0 , x 1 ) , ( y 0 , y 1 )) mult 1 ( z , ( x 0 , x 1 ) , ( y 0 , y 1 )) = ( 1 − x ) y , = 0 , = z x 0 ( 1 − x 1 ) y 0 y 1 , = ( 1 − z ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 . Gate propagation and Thaler’s identity. The circuit semantics are captured by the layer-wise gate propagation equation : for i ∈ { 0 , … , d − 1 } i \in \{0,\ldots,d-1\} i ∈ { 0 , … , d − 1 } and z ∈ { 0 , 1 } s i \mathbf{z}\in\{0,1\}^{s_i} z ∈ { 0 , 1 } s i ,
W i ( z ) = ∑ x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 { a d d i ( z , x , y ) [ W i + 1 ( x ) + W i + 1 ( y ) ] + m u l t i ( z , x , y ) [ W i + 1 ( x ) W i + 1 ( y ) ] } . W_i(\mathbf{z}) =
\sum_{\substack{\mathbf{x}\in\{0,1\}^{s_{i+1}}\\ \mathbf{y}\in\{0,1\}^{s_{i+1}}}}
\Big\{
\mathrm{add}_i(\mathbf{z},\mathbf{x},\mathbf{y})\big[W_{i+1}(\mathbf{x})+W_{i+1}(\mathbf{y})\big]
+
\mathrm{mult}_i(\mathbf{z},\mathbf{x},\mathbf{y})\big[W_{i+1}(\mathbf{x})W_{i+1}(\mathbf{y})\big]
\Big\}. W i ( z ) = x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 ∑ { add i ( z , x , y ) [ W i + 1 ( x ) + W i + 1 ( y ) ] + mult i ( z , x , y ) [ W i + 1 ( x ) W i + 1 ( y ) ] } . Thaler’s identity is the multilinear-extension analogue: for i ∈ { 0 , … , d − 1 } i \in \{0,\ldots,d-1\} i ∈ { 0 , … , d − 1 } and z ∈ F s i \mathbf{z}\in\mathbb{F}^{s_i} z ∈ F s i ,
W ~ i ( z ) = ∑ x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 { a d d ~ i ( z , x , y ) [ W ~ i + 1 ( x ) + W ~ i + 1 ( y ) ] + m u l t ~ i ( z , x , y ) [ W ~ i + 1 ( x ) W ~ i + 1 ( y ) ] } . \widetilde{W}_i(\mathbf{z}) =
\sum_{\substack{\mathbf{x}\in\{0,1\}^{s_{i+1}}\\ \mathbf{y}\in\{0,1\}^{s_{i+1}}}}
\Big\{
\widetilde{\mathrm{add}}_i(\mathbf{z},\mathbf{x},\mathbf{y})\big[\widetilde{W}_{i+1}(\mathbf{x})+\widetilde{W}_{i+1}(\mathbf{y})\big]
+
\widetilde{\mathrm{mult}}_i(\mathbf{z},\mathbf{x},\mathbf{y})\big[\widetilde{W}_{i+1}(\mathbf{x})\widetilde{W}_{i+1}(\mathbf{y})\big]
\Big\}. W i ( z ) = x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 ∑ { add i ( z , x , y ) [ W i + 1 ( x ) + W i + 1 ( y ) ] + mult i ( z , x , y ) [ W i + 1 ( x ) W i + 1 ( y ) ] } . Example 1 [layer-wise gate propagation and Thaler’s identity]. In our example, (2) expands to
11 = ∑ x ∈ { 0 , 1 } ∑ y ∈ { 0 , 1 } ( 1 − x ) y [ ( 6 − x ) + ( 6 − y ) ] . 11 = \sum_{x\in\{0,1\}} \sum_{y\in\{0,1\}} (1-x)y\big[(6-x)+(6-y)\big]. 11 = x ∈ { 0 , 1 } ∑ y ∈ { 0 , 1 } ∑ ( 1 − x ) y [ ( 6 − x ) + ( 6 − y ) ] . and
6 − z = ∑ x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } { z x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − z ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . \begin{align}
6 - z
&= \sum_{x_0\in\{0,1\}}\sum_{x_1\in\{0,1\}}\sum_{y_0\in\{0,1\}}\sum_{y_1\in\{0,1\}}
\Big\{
zx_0(1-x_1)y_0y_1\big[(-2x_0x_1+x_0-x_1+3)+(-2y_0y_1+y_0-y_1+3)\big] \notag \\
&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
+ \; (1-z)(1-x_0)(1-x_1)(1-y_0)y_1\big[(-2x_0x_1+x_0-x_1+3)(-2y_0y_1+y_0-y_1+3)\big]
\Big\}.
\end{align} 6 − z = x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } ∑ { z x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − z ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . What is being verified? The circuit C C C (including its wiring predicates) is public. The prover’s private information is the collection of intermediate gate values, equivalently the functions W i W_i W i . In the single-output setting, the prover’s top-level claim is simply that the output gate evaluates to a particular field element (here, 11).
More generally, Layer 0 may contain multiple output gates . We label the S 0 S_0 S 0 outputs by { 0 , 1 } s 0 \{0,1\}^{s_0} { 0 , 1 } s 0 , and the function
W 0 : { 0 , 1 } s 0 → F W_0 : \{0,1\}^{s_0}\to\mathbb{F} W 0 : { 0 , 1 } s 0 → F encodes all outputs at once. The prover’s claim is that the true output function W 0 W_0 W 0 equals a purported function W 0 ∗ W_0^* W 0 ∗ (equivalently, W ~ 0 = W ~ 0 ∗ \widetilde{W}_0=\widetilde{W}_0^* W 0 = W 0 ∗ as polynomial functions).
The verifier does not check equality at all points. Instead, they sample a uniformly random ρ 0 ∈ F s 0 \rho_0\in\mathbb{F}^{s_0} ρ 0 ∈ F s 0 and check equality at that point:
W ~ 0 ( ρ 0 ) = W ~ 0 ∗ ( ρ 0 ) . \widetilde{W}_0(\rho_0) = \widetilde{W}_0^*(\rho_0). W 0 ( ρ 0 ) = W 0 ∗ ( ρ 0 ) . If W ~ 0 ≠ W ~ 0 ∗ \widetilde{W}_0\neq \widetilde{W}_0^* W 0 = W 0 ∗ , then W ~ 0 − W ~ 0 ∗ \widetilde{W}_0-\widetilde{W}_0^* W 0 − W 0 ∗ is a nonzero multilinear polynomial function (degree ≤ s 0 \le s_0 ≤ s 0 ), so by Schwartz-Zippel,
Pr [ W ~ 0 ( ρ 0 ) = W ~ 0 ∗ ( ρ 0 ) ] = Pr [ ( W ~ 0 − W ~ 0 ∗ ) ( ρ 0 ) = 0 ] ≤ s 0 # F . \Pr\big[\widetilde{W}_0(\rho_0)=\widetilde{W}_0^*(\rho_0)\big]
= \Pr\big[(\widetilde{W}_0-\widetilde{W}_0^*)(\rho_0)=0\big]
\le \frac{s_0}{\#\mathbb{F}}. Pr [ W 0 ( ρ 0 ) = W 0 ∗ ( ρ 0 ) ] = Pr [ ( W 0 − W 0 ∗ ) ( ρ 0 ) = 0 ] ≤ # F s 0 . Thus, a match at a random point gives strong evidence that all output gates are correct.
From Thaler’s identity to GKR. Fix a layer i i i . The verifier does not try to check (2) for all z ∈ F s i \mathbf{z}\in\mathbb{F}^{s_i} z ∈ F s i . Instead, they sample a random point ρ i ∈ F s i \rho_i\in\mathbb{F}^{s_i} ρ i ∈ F s i and ask the prover to justify (2) at z = ρ i \mathbf{z}=\rho_i z = ρ i .
Once ρ i \rho_i ρ i is fixed, the right-hand side of (2) becomes a polynomial function in the 2 s i + 1 2s_{i+1} 2 s i + 1 Boolean variables ( x , y ) (\mathbf{x},\mathbf{y}) ( x , y ) . The prover and verifier then run sum-check over these variables. At the end of sum-check, the verifier is left with a small number of claimed values of W ~ i + 1 \widetilde{W}_{i+1} W i + 1 ; the folding step compresses these into a single new claim about W ~ i + 1 \widetilde{W}_{i+1} W i + 1 at a fresh random point ρ i + 1 \rho_{i+1} ρ i + 1 .
As in the sum-check notebook, we distinguish circuit-determined objects from prover-asserted objects. We use ( ⋅ ) ∗ (\cdot)^* ( ⋅ ) ∗ (e.g. W ~ i ∗ \widetilde{W}_i^* W i ∗ ) for prover claims, which may be false. For clarity, we sometimes use the notation = ? \;\overset{?}{=}\; = ? for an equality that may not hold if P is dishonest. Unadorned symbols refer to the true objects induced by the circuit. For readability, we reuse symbols like the verifier challenges r j r_j r j and the prover’s round polynomials g j g_j g j across different sum-check invocations; they are “reset” each time a new sum-check begins.
GKR Layer 0. The parties are the verifier V and the prover P. V samples ρ 0 ← F s 0 \rho_0 \leftarrow \mathbb{F}^{s_0} ρ 0 ← F s 0 . Define
g ( x , y ) : = a d d ~ 0 ( ρ 0 , x , y ) [ W ~ 1 ( x ) + W ~ 1 ( y ) ] + m u l t ~ 0 ( ρ 0 , x , y ) [ W ~ 1 ( x ) W ~ 1 ( y ) ] , g(\mathbf{x},\mathbf{y}) :=
\widetilde{\mathrm{add}}_0(\rho_0,\mathbf{x},\mathbf{y})\big[\widetilde{W}_{1}(\mathbf{x})+\widetilde{W}_{1}(\mathbf{y})\big]
+
\widetilde{\mathrm{mult}}_0(\rho_0,\mathbf{x},\mathbf{y})\big[\widetilde{W}_{1}(\mathbf{x})\widetilde{W}_{1}(\mathbf{y})\big], g ( x , y ) := add 0 ( ρ 0 , x , y ) [ W 1 ( x ) + W 1 ( y ) ] + mult 0 ( ρ 0 , x , y ) [ W 1 ( x ) W 1 ( y ) ] , the summand in (2) when i = 0 i=0 i = 0 and z = ρ 0 \mathbf{z}=\rho_0 z = ρ 0 . Thus,
W ~ 0 ( ρ 0 ) = ∑ ( x , y ) ∈ { 0 , 1 } s 1 × { 0 , 1 } s 1 g ( x , y ) . \widetilde{W}_0(\rho_0)
=
\sum_{(\mathbf{x},\mathbf{y})\in \{0,1\}^{s_1}\times \{0,1\}^{s_1}}
g(\mathbf{x},\mathbf{y}). W 0 ( ρ 0 ) = ( x , y ) ∈ { 0 , 1 } s 1 × { 0 , 1 } s 1 ∑ g ( x , y ) . Moreover deg g ≤ 4 s 1 \deg g \le 4s_1 deg g ≤ 4 s 1 : the wiring polynomials have degree ≤ 2 s 1 \le 2s_1 ≤ 2 s 1 , the multilinear extensions W ~ 1 ( x ) \widetilde{W}_1(\mathbf{x}) W 1 ( x ) and W ~ 1 ( y ) \widetilde{W}_1(\mathbf{y}) W 1 ( y ) have degree ≤ s 1 \le s_1 ≤ s 1 , and the worst case comes from the product term. (In general Layer i i i , the same reasoning gives deg g ≤ 4 s i + 1 \deg g \le 4s_{i+1} deg g ≤ 4 s i + 1 .)
The protocol runs sum-check on (6) (with the prover’s possibly false claim for W ~ 0 ( ρ 0 ) \widetilde{W}_0(\rho_0) W 0 ( ρ 0 ) on the left-hand side), with one crucial twist at the final step: instead of having V evaluate g ( r x , r y ) g(r_x,r_y) g ( r x , r y ) directly, GKR uses claimed values of W ~ 1 \widetilde{W}_1 W 1 and then folds them into a single new claim.
Example 1 [GKR Layer 0]. Here s 0 = 0 s_0=0 s 0 = 0 , so F s 0 = { ∅ } \mathbb{F}^{s_0}=\{\emptyset\} F s 0 = { ∅ } and ρ 0 = ∅ \rho_0=\emptyset ρ 0 = ∅ . Also s 1 = 1 s_1=1 s 1 = 1 , and from (3) we set
g ( x , y ) : = ( 1 − x ) y [ ( 6 − x ) + ( 6 − y ) ] . g(x,y) := (1-x)y\big[(6-x)+(6-y)\big]. g ( x , y ) := ( 1 − x ) y [ ( 6 − x ) + ( 6 − y ) ] . To see how cheating is forced to “thread the needle”, suppose P falsely claims that W ~ 0 ( ρ 0 ) \widetilde{W}_0(\rho_0) W 0 ( ρ 0 ) equals 10 (the truth is 11). The sum-check claim is
W ~ 0 ∗ ( ρ 0 ) = ? ∑ x , y ∈ { 0 , 1 } g ( x , y ) , \widetilde{W}_0^*(\rho_0) \overset{?}{=} \sum_{x,y\in\{0,1\}} g(x,y), W 0 ∗ ( ρ 0 ) = ? x , y ∈ { 0 , 1 } ∑ g ( x , y ) , which is true iff the left-hand side equals 11. Since P insists on W ~ 0 ∗ ( ρ 0 ) = 10 \widetilde{W}_0^*(\rho_0) = 10 W 0 ∗ ( ρ 0 ) = 10 , they must lie consistently, and later they will still need luck to avoid detection.
Sum-check Round 0.0. Define
g 0 ( u 0 ) : = ∑ y ∈ { 0 , 1 } g ( u 0 , y ) = g ( u 0 , 0 ) + g ( u 0 , 1 ) , g_0(u_0) := \sum_{y\in\{0,1\}} g(u_0,y) = g(u_0,0)+g(u_0,1), g 0 ( u 0 ) := y ∈ { 0 , 1 } ∑ g ( u 0 , y ) = g ( u 0 , 0 ) + g ( u 0 , 1 ) , so that, as W ~ 0 \widetilde{W}_0 W 0 and g 0 g_0 g 0 are ground-truth polynomial functions, W ~ 0 ( ρ 0 ) = g 0 ( 0 ) + g 0 ( 1 ) \widetilde{W}_0(\rho_0)=g_0(0)+g_0(1) W 0 ( ρ 0 ) = g 0 ( 0 ) + g 0 ( 1 ) . P sends g 0 ∗ g_0^* g 0 ∗ , and V checks:
deg g 0 ∗ ≤ 4 s 1 = 4 \deg g_0^* \le 4s_1 = 4 deg g 0 ∗ ≤ 4 s 1 = 4 ,
W ~ 0 ∗ ( ρ 0 ) = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) \widetilde{W}_0^*(\rho_0)=g_0^*(0)+g_0^*(1) W 0 ∗ ( ρ 0 ) = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) .
If both pass, V samples r 0 ← F r_0\leftarrow\mathbb{F} r 0 ← F and sends it to P.
In truth, g 0 ( u 0 ) = ( 1 − u 0 ) ( 11 − u 0 ) g_0(u_0)=(1-u_0)(11-u_0) g 0 ( u 0 ) = ( 1 − u 0 ) ( 11 − u 0 ) , but V does not know this. To satisfy the checks while forcing g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 10 g_0^*(0)+g_0^*(1)=10 g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 10 , P can pick (for example)
g 0 ∗ ( u 0 ) : = 2 u 0 ( u 0 − 7 ) + 11 , g_0^*(u_0) := 2u_0(u_0-7)+11, g 0 ∗ ( u 0 ) := 2 u 0 ( u 0 − 7 ) + 11 , since
g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 11 + ( 2 ( − 6 ) + 11 ) = 10 = W ~ 0 ∗ ( ∅ ) . g_0^*(0)+g_0^*(1) = 11 + \big(2(-6)+11\big)=10=\widetilde{W}_0^*(\emptyset). g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 11 + ( 2 ( − 6 ) + 11 ) = 10 = W 0 ∗ ( ∅ ) . Suppose V chooses r 0 = 17 r_0=17 r 0 = 17 .
Sum-check Round 0.1. Define g 1 ( u 1 ) : = g ( r 0 , u 1 ) g_1(u_1):=g(r_0,u_1) g 1 ( u 1 ) := g ( r 0 , u 1 ) , so 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 ) . P sends g 1 ∗ g_1^* g 1 ∗ , and V checks:
deg g 1 ∗ ≤ 4 \deg g_1^* \le 4 deg g 1 ∗ ≤ 4 ,
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 ) .
If both pass, V samples r 1 ← F r_1\leftarrow\mathbb{F} r 1 ← F and sends it to P.
Since r 0 = 17 r_0=17 r 0 = 17 , the truth is
g 1 ( u 1 ) = g ( 17 , u 1 ) = ( 1 − 17 ) u 1 [ 6 − 17 + 6 − u 1 ] = 16 u 1 ( 5 + u 1 ) , g_1(u_1)=g(17,u_1)=(1-17)u_1\big[6-17+6-u_1\big]=16u_1(5+u_1), g 1 ( u 1 ) = g ( 17 , u 1 ) = ( 1 − 17 ) u 1 [ 6 − 17 + 6 − u 1 ] = 16 u 1 ( 5 + u 1 ) , but P can instead claim
g 1 ∗ ( u 1 ) : = u 1 ( 17 u 1 + 334 ) , g_1^*(u_1):=u_1(17u_1+334), g 1 ∗ ( u 1 ) := u 1 ( 17 u 1 + 334 ) , which satisfies
g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) = 351 = 2 ⋅ 17 ( 17 − 7 ) + 11 = g 0 ∗ ( 17 ) . g_1^*(0)+g_1^*(1)=351=2\cdot 17(17-7)+11=g_0^*(17). g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) = 351 = 2 ⋅ 17 ( 17 − 7 ) + 11 = g 0 ∗ ( 17 ) . Suppose V chooses r 1 = 42 r_1=42 r 1 = 42 .
Sum-check final check (where GKR diverges). In standalone sum-check, V would check g 1 ∗ ( r 1 ) = ? g ( r 0 , r 1 ) g_1^*(r_1)\overset{?}{=}g(r_0,r_1) g 1 ∗ ( r 1 ) = ? g ( r 0 , r 1 ) , but in GKR V does not directly evaluate g ( r 0 , r 1 ) g(r_0,r_1) g ( r 0 , r 1 ) .
Instead, define
z 0 : = W ~ 1 ( r 0 ) , z 1 : = W ~ 1 ( r 1 ) , z_0 := \widetilde{W}_1(r_0),\qquad z_1 := \widetilde{W}_1(r_1), z 0 := W 1 ( r 0 ) , z 1 := W 1 ( r 1 ) , and P supplies claimed values z 0 ∗ , z 1 ∗ z_0^*,z_1^* z 0 ∗ , z 1 ∗ asserted to equal z 0 , z 1 z_0,z_1 z 0 , z 1 .
In our example, the ground truth is
z 0 = W ~ 1 ( 17 ) = 6 − 17 = − 11 , z 1 = W ~ 1 ( 42 ) = 6 − 42 = − 36 , z_0 = \widetilde{W}_1(17)=6-17=-11,\qquad
z_1 = \widetilde{W}_1(42)=6-42=-36, z 0 = W 1 ( 17 ) = 6 − 17 = − 11 , z 1 = W 1 ( 42 ) = 6 − 42 = − 36 , and also
g ( r 0 , r 1 ) = g ( 17 , 42 ) = 16 ⋅ 42 ( 5 + 42 ) = 1974 , g(r_0,r_1)=g(17,42)=16\cdot 42(5+42)=1974, g ( r 0 , r 1 ) = g ( 17 , 42 ) = 16 ⋅ 42 ( 5 + 42 ) = 1974 , whereas
g 1 ∗ ( r 1 ) = g 1 ∗ ( 42 ) = 42 ( 17 ⋅ 42 + 334 ) = 44016 , g_1^*(r_1)=g_1^*(42)=42(17\cdot 42+334)=44016, g 1 ∗ ( r 1 ) = g 1 ∗ ( 42 ) = 42 ( 17 ⋅ 42 + 334 ) = 44016 , so standalone sum-check would reject. GKR postpones this evaluation and moves to folding.
At this point, V has reduced a claim about W ~ 0 \widetilde{W}_0 W 0 to two claimed values of W ~ 1 \widetilde{W}_1 W 1 . Recursing naïvely would cause a blow-up. Folding avoids this by compressing two claims into one.
GKR folding at Layer 0. At the end of the Layer 0 sum-check, V is left to verify
g 2 s 1 − 1 ∗ ( r 2 s 1 − 1 ) = ? g ( r x , r y ) , g_{2s_1-1}^*(r_{2s_1-1}) \overset{?}{=} g(r_x,r_y), g 2 s 1 − 1 ∗ ( r 2 s 1 − 1 ) = ? g ( r x , r y ) , where
r x = ( r 0 , … , r s 1 − 1 ) ∈ F s 1 , r y = ( r s 1 , … , r 2 s 1 − 1 ) ∈ F s 1 r_x=(r_0,\ldots,r_{s_1-1})\in\mathbb{F}^{s_1},\qquad
r_y=(r_{s_1},\ldots,r_{2s_1-1})\in\mathbb{F}^{s_1} r x = ( r 0 , … , r s 1 − 1 ) ∈ F s 1 , r y = ( r s 1 , … , r 2 s 1 − 1 ) ∈ F s 1 are the verifier challenge vectors from the 2 s 1 2s_1 2 s 1 rounds. P supplies claimed values
W ~ 1 ( r x ) = claim P z 0 ∗ , W ~ 1 ( r y ) = claim P z 1 ∗ . \widetilde{W}_1(r_x)\overset{\mathsf{P}}{\underset{\text{claim}}{=}}z_0^*,\qquad \widetilde{W}_1(r_y)\overset{\mathsf{P}}{\underset{\text{claim}}{=}}z_1^*. W 1 ( r x ) claim = P z 0 ∗ , W 1 ( r y ) claim = P z 1 ∗ . Together, (5) , (7) , and (8) amount to the “bridging” equation
g 2 s 1 − 1 ∗ ( r 2 s 1 − 1 ) = ? a d d ~ 0 ( ρ 0 , r x , r y ) [ z 0 ∗ + z 1 ∗ ] + m u l t ~ 0 ( ρ 0 , r x , r y ) [ z 0 ∗ z 1 ∗ ] . g_{2s_1-1}^*(r_{2s_1-1})
\overset{?}{=}
\widetilde{\mathrm{add}}_0(\rho_0,r_x,r_y)\big[z_0^*+z_1^*\big]
+
\widetilde{\mathrm{mult}}_0(\rho_0,r_x,r_y)\big[z_0^*z_1^*\big]. g 2 s 1 − 1 ∗ ( r 2 s 1 − 1 ) = ? add 0 ( ρ 0 , r x , r y ) [ z 0 ∗ + z 1 ∗ ] + mult 0 ( ρ 0 , r x , r y ) [ z 0 ∗ z 1 ∗ ] . Since the circuit is public, V can evaluate a d d ~ 0 \widetilde{\mathrm{add}}_0 add 0 and m u l t ~ 0 \widetilde{\mathrm{mult}}_0 mult 0 at any point, so V checks (9) and rejects if it fails.
Now fold the two claims in (8) into a single claim. Define the affine line ℓ : F → F s 1 \ell:\mathbb{F}\to\mathbb{F}^{s_1} ℓ : F → F s 1 by
ℓ ( t ) : = ( 1 − t ) r x + t r y , \ell(t):=(1-t)r_x + t r_y, ℓ ( t ) := ( 1 − t ) r x + t r y , and define the associated univariate polynomial function q 1 : F → F q_1 : \mathbb{F} \to \mathbb{F} q 1 : F → F by
q 1 ( t ) : = W ~ 1 ( ℓ ( t ) ) . q_1(t):=\widetilde{W}_1(\ell(t)). q 1 ( t ) := W 1 ( ℓ ( t )) . By construction, q 1 ( 0 ) = W ~ 1 ( r x ) q_1(0)=\widetilde{W}_1(r_x) q 1 ( 0 ) = W 1 ( r x ) and q 1 ( 1 ) = W ~ 1 ( r y ) q_1(1)=\widetilde{W}_1(r_y) q 1 ( 1 ) = W 1 ( r y ) .
P sends a univariate polynomial function q 1 ∗ q_1^* q 1 ∗ , purported to equal q 1 q_1 q 1 . V checks:
deg q 1 ∗ ≤ s 1 \deg q_1^* \le s_1 deg q 1 ∗ ≤ s 1 ,
q 1 ∗ ( 0 ) = z 0 ∗ q_1^*(0)=z_0^* q 1 ∗ ( 0 ) = z 0 ∗ and q 1 ∗ ( 1 ) = z 1 ∗ q_1^*(1)=z_1^* q 1 ∗ ( 1 ) = z 1 ∗ .
If these checks pass, V samples τ 1 ← F \tau_1\leftarrow\mathbb{F} τ 1 ← F and sets
ρ 1 : = ℓ ( τ 1 ) ∈ F s 1 . \rho_1 := \ell(\tau_1)\in\mathbb{F}^{s_1}. ρ 1 := ℓ ( τ 1 ) ∈ F s 1 . In an honest execution, q 1 ∗ q^*_1 q 1 ∗ is the true q 1 q_1 q 1 , and hence q 1 ∗ ( τ 1 ) q_1^*(\tau_1) q 1 ∗ ( τ 1 ) is equal to W ~ 1 ( ρ 1 ) \widetilde{W}_1(\rho_1) W 1 ( ρ 1 ) . Thus the two claims in (8) have been reduced to a single claim about W ~ 1 \widetilde{W}_1 W 1 at the random point ρ 1 \rho_1 ρ 1 . The protocol then proceeds to Layer 1.
Example 1 [GKR folding at Layer 0]. In this example, r x = r 0 r_x=r_0 r x = r 0 and r y = r 1 r_y=r_1 r y = r 1 . P supplies z 0 ∗ , z 1 ∗ z_0^*,z_1^* z 0 ∗ , z 1 ∗ , and V checks
g 1 ∗ ( r 1 ) = ? ( 1 − r 0 ) r 1 [ z 0 ∗ + z 1 ∗ ] . g_1^*(r_1) \overset{?}{=} (1-r_0)r_1\big[z_0^*+z_1^*\big]. g 1 ∗ ( r 1 ) = ? ( 1 − r 0 ) r 1 [ z 0 ∗ + z 1 ∗ ] . Define ℓ \ell ℓ as in (10) and q 1 q_1 q 1 as in (11) . Here ℓ ( t ) = ( 1 − t ) r 0 + t r 1 \ell(t)=(1-t)r_0+tr_1 ℓ ( t ) = ( 1 − t ) r 0 + t r 1 and q 1 ( t ) = W ~ 1 ( ℓ ( t ) ) = 6 − ℓ ( t ) q_1(t)=\widetilde{W}_1(\ell(t))=6-\ell(t) q 1 ( t ) = W 1 ( ℓ ( t )) = 6 − ℓ ( t ) . P sends q 1 ∗ q_1^* q 1 ∗ and V checks the endpoint constraints (and deg q 1 ∗ ≤ 1 \deg q_1^*\le 1 deg q 1 ∗ ≤ 1 ). Then V samples τ 1 ← F \tau_1\leftarrow\mathbb{F} τ 1 ← F and defines ρ 1 = ℓ ( τ 1 ) \rho_1=\ell(\tau_1) ρ 1 = ℓ ( τ 1 ) as in (12) . In an honest execution, q 1 ∗ ( τ 1 ) q_1^*(\tau_1) q 1 ∗ ( τ 1 ) equals W ~ 1 ( ρ 1 ) \widetilde{W}_1(\rho_1) W 1 ( ρ 1 ) , and by Thaler’s identity this equals
q 1 ∗ ( τ 1 ) = ? ∑ x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } { ρ 1 x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − ρ 1 ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . \begin{align}
q_1^*(\tau_1)
&\overset{?}{=}
\sum_{x_0\in\{0,1\}}\sum_{x_1\in\{0,1\}}\sum_{y_0\in\{0,1\}}\sum_{y_1\in\{0,1\}}
\Big\{
\rho_1 x_0(1-x_1)y_0y_1\big[(-2x_0x_1+x_0-x_1+3)+(-2y_0y_1+y_0-y_1+3)\big] \notag \\
&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
+ \; (1-\rho_1)(1-x_0)(1-x_1)(1-y_0)y_1\big[(-2x_0x_1+x_0-x_1+3)(-2y_0y_1+y_0-y_1+3)\big]
\Big\}.
\end{align} q 1 ∗ ( τ 1 ) = ? x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } ∑ { ρ 1 x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − ρ 1 ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . With the concrete values above, ( r 0 , r 1 ) = ( 17 , 42 ) (r_0,r_1)=(17,42) ( r 0 , r 1 ) = ( 17 , 42 ) and g 1 ∗ ( r 1 ) = 44016 g_1^*(r_1)=44016 g 1 ∗ ( r 1 ) = 44016 . To satisfy (13) , P must choose z 0 ∗ , z 1 ∗ z_0^*,z_1^* z 0 ∗ , z 1 ∗ with
z 0 ∗ z 1 ∗ ≡ g 1 ∗ ( r 1 ) [ ( 1 − r 0 ) r 1 ] − 1 m o d p . z_0^*z_1^* \equiv g_1^*(r_1)\big[(1-r_0)r_1\big]^{-1}\bmod p. z 0 ∗ z 1 ∗ ≡ g 1 ∗ ( r 1 ) [ ( 1 − r 0 ) r 1 ] − 1 mod p . Since [ ( 1 − 17 ) ⋅ 42 ] − 1 ≡ 405848844 m o d p \big[(1-17)\cdot 42\big]^{-1}\equiv 405848844\bmod p [ ( 1 − 17 ) ⋅ 42 ] − 1 ≡ 405848844 mod p , one possible choice is
z 0 ∗ = 255440969 , z 1 ∗ = 150407875. z_0^* = 255440969,\qquad z_1^* = 150407875. z 0 ∗ = 255440969 , z 1 ∗ = 150407875. Then P can define q 1 ∗ ( t ) : = ( 1 − t ) z 0 ∗ + t z 1 ∗ q_1^*(t):=(1-t)z_0^*+t z_1^* q 1 ∗ ( t ) := ( 1 − t ) z 0 ∗ + t z 1 ∗ , which automatically satisfies the endpoint checks.
Suppose V chooses τ 1 = 3 \tau_1=3 τ 1 = 3 . Then ρ 1 = ℓ ( 3 ) = 92 \rho_1=\ell(3)=92 ρ 1 = ℓ ( 3 ) = 92 , and the truth is q 1 ( 3 ) = W ~ 1 ( 92 ) = 6 − 92 = − 86 q_1(3)=\widetilde{W}_1(92)=6-92=-86 q 1 ( 3 ) = W 1 ( 92 ) = 6 − 92 = − 86 , whereas
q 1 ∗ ( 3 ) = 255440969 − 105033094 ⋅ 3 ≡ 2087825334 m o d p . q_1^*(3)=255440969-105033094\cdot 3 \equiv 2087825334 \bmod p. q 1 ∗ ( 3 ) = 255440969 − 105033094 ⋅ 3 ≡ 2087825334 mod p . Thus in the next sum-check (Layer 1), P is forced to justify the false claim
2087825334 = ? ∑ x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } { 92 x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − 92 ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . \begin{align}
2087825334
&\overset{?}{=}
\sum_{x_0\in\{0,1\}}\sum_{x_1\in\{0,1\}}\sum_{y_0\in\{0,1\}}\sum_{y_1\in\{0,1\}}
\Big\{
92 x_0(1-x_1)y_0y_1\big[(-2x_0x_1+x_0-x_1+3)+(-2y_0y_1+y_0-y_1+3)\big] \notag \\
&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad
+ \; (1-92)(1-x_0)(1-x_1)(1-y_0)y_1\big[(-2x_0x_1+x_0-x_1+3)(-2y_0y_1+y_0-y_1+3)\big]
\Big\}.
\end{align} 2087825334 = ? x 0 ∈ { 0 , 1 } ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } ∑ { 92 x 0 ( 1 − x 1 ) y 0 y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) + ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] + ( 1 − 92 ) ( 1 − x 0 ) ( 1 − x 1 ) ( 1 − y 0 ) y 1 [ ( − 2 x 0 x 1 + x 0 − x 1 + 3 ) ( − 2 y 0 y 1 + y 0 − y 1 + 3 ) ] } . The true value of the right-hand side is 2147483561. V does not know this, but after the Layer 1 sum-check the inconsistency is detected with high probability.
GKR Layer i (1 ≤ i ≤ d − 2 1 \le i \le d-2 1 ≤ i ≤ d − 2 ). At the start of Layer i i i , V holds a point ρ i ∈ F s i \rho_i\in\mathbb{F}^{s_i} ρ i ∈ F s i and a claimed value q i ∗ ( τ i ) ∈ F q_i^*(\tau_i)\in\mathbb{F} q i ∗ ( τ i ) ∈ F , which (if P is honest) equals W ~ i ( ρ i ) \widetilde{W}_i(\rho_i) W i ( ρ i ) . V and P run sum-check to justify Thaler’s identity at z = ρ i \mathbf{z}=\rho_i z = ρ i .
Define
g ( x , y ) : = a d d ~ i ( ρ i , x , y ) [ W ~ i + 1 ( x ) + W ~ i + 1 ( y ) ] + m u l t ~ i ( ρ i , x , y ) [ W ~ i + 1 ( x ) W ~ i + 1 ( y ) ] , g(\mathbf{x},\mathbf{y}) :=
\widetilde{\mathrm{add}}_i(\rho_i,\mathbf{x},\mathbf{y})\big[\widetilde{W}_{i+1}(\mathbf{x})+\widetilde{W}_{i+1}(\mathbf{y})\big]
+
\widetilde{\mathrm{mult}}_i(\rho_i,\mathbf{x},\mathbf{y})\big[\widetilde{W}_{i+1}(\mathbf{x})\widetilde{W}_{i+1}(\mathbf{y})\big], g ( x , y ) := add i ( ρ i , x , y ) [ W i + 1 ( x ) + W i + 1 ( y ) ] + mult i ( ρ i , x , y ) [ W i + 1 ( x ) W i + 1 ( y ) ] , a polynomial function on F s i + 1 × F s i + 1 \mathbb{F}^{s_{i+1}}\times\mathbb{F}^{s_{i+1}} F s i + 1 × F s i + 1 . Sum-check is applied to
q i ∗ ( τ i ) = ? ∑ x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 g ( x , y ) . q_i^*(\tau_i)
\overset{?}{=}
\sum_{\substack{\mathbf{x}\in\{0,1\}^{s_{i+1}}\\ \mathbf{y}\in\{0,1\}^{s_{i+1}}}}
g(\mathbf{x},\mathbf{y}). q i ∗ ( τ i ) = ? x ∈ { 0 , 1 } s i + 1 y ∈ { 0 , 1 } s i + 1 ∑ g ( x , y ) . Let m : = 2 s i + 1 m:=2s_{i+1} m := 2 s i + 1 , and identify ( x , y ) (\mathbf{x},\mathbf{y}) ( x , y ) with v = ( v 0 , … , v m − 1 ) ∈ F m v=(v_0,\ldots,v_{m-1})\in\mathbb{F}^m v = ( v 0 , … , v m − 1 ) ∈ F m , where x = ( v 0 , … , v s i + 1 − 1 ) \mathbf{x}=(v_0,\ldots,v_{s_{i+1}-1}) x = ( v 0 , … , v s i + 1 − 1 ) and y = ( v s i + 1 , … , v m − 1 ) \mathbf{y}=(v_{s_{i+1}},\ldots,v_{m-1}) y = ( v s i + 1 , … , v m − 1 ) . The sum-check routine has m m m rounds, with verifier challenges r = ( r 0 , … , r m − 1 ) ∈ F m r=(r_0,\ldots,r_{m-1})\in\mathbb{F}^m r = ( r 0 , … , r m − 1 ) ∈ F m . Write r x = ( r 0 , … , r s i + 1 − 1 ) ∈ F s i + 1 r_x=(r_0,\ldots,r_{s_{i+1}-1})\in\mathbb{F}^{s_{i+1}} r x = ( r 0 , … , r s i + 1 − 1 ) ∈ F s i + 1 and r y = ( r s i + 1 , … , r m − 1 ) ∈ F s i + 1 r_y=(r_{s_{i+1}},\ldots,r_{m-1})\in\mathbb{F}^{s_{i+1}} r y = ( r s i + 1 , … , r m − 1 ) ∈ F s i + 1 . As usual, the prover sends round polynomials g j ∗ g_j^* g j ∗ , and the verifier checks the degree bound and consistency equations. After the final challenge r m − 1 r_{m-1} r m − 1 , sum-check reduces consistency to g m − 1 ∗ ( r m − 1 ) = g ( r 0 , … , r m − 1 ) = g ( r x , r y ) g_{m-1}^*(r_{m-1}) = g(r_0,\ldots,r_{m-1}) = g(r_x,r_y) g m − 1 ∗ ( r m − 1 ) = g ( r 0 , … , r m − 1 ) = g ( r x , r y ) .
Expanding g ( r x , r y ) g(r_x,r_y) g ( r x , r y ) yields
g ( r x , r y ) = a d d ~ i ( ρ i , r x , r y ) [ z x + z y ] + m u l t ~ i ( ρ i , r x , r y ) [ z x z y ] , g(r_x,r_y)
=
\widetilde{\mathrm{add}}_i(\rho_i,r_x,r_y)\big[z_x+z_y\big]
+
\widetilde{\mathrm{mult}}_i(\rho_i,r_x,r_y)\big[z_x z_y\big], g ( r x , r y ) = add i ( ρ i , r x , r y ) [ z x + z y ] + mult i ( ρ i , r x , r y ) [ z x z y ] , where z x : = W ~ i + 1 ( r x ) z_x:=\widetilde{W}_{i+1}(r_x) z x := W i + 1 ( r x ) and z y : = W ~ i + 1 ( r y ) z_y:=\widetilde{W}_{i+1}(r_y) z y := W i + 1 ( r y ) .
GKR folding at Layer i. P supplies claimed values z x ∗ , z y ∗ ∈ F z_x^*,z_y^*\in\mathbb{F} z x ∗ , z y ∗ ∈ F . V checks the bridging equation
g m − 1 ∗ ( r m − 1 ) = ? a d d ~ i ( ρ i , r x , r y ) [ z x ∗ + z y ∗ ] + m u l t ~ i ( ρ i , r x , r y ) [ z x ∗ z y ∗ ] , g_{m-1}^*(r_{m-1})
\overset{?}{=}
\widetilde{\mathrm{add}}_i(\rho_i,r_x,r_y)\big[z_x^*+z_y^*\big]
+
\widetilde{\mathrm{mult}}_i(\rho_i,r_x,r_y)\big[z_x^* z_y^*\big], g m − 1 ∗ ( r m − 1 ) = ? add i ( ρ i , r x , r y ) [ z x ∗ + z y ∗ ] + mult i ( ρ i , r x , r y ) [ z x ∗ z y ∗ ] , rejecting if it fails. To fold the two claims into one, define
ℓ ( t ) : = ( 1 − t ) r x + t r y , \ell(t):=(1-t)r_x + t r_y, ℓ ( t ) := ( 1 − t ) r x + t r y , and
q i + 1 ( t ) : = W ~ i + 1 ( ℓ ( t ) ) . q_{i+1}(t):=\widetilde{W}_{i+1}(\ell(t)). q i + 1 ( t ) := W i + 1 ( ℓ ( t )) . Then q i + 1 ( 0 ) = W ~ i + 1 ( r x ) q_{i+1}(0)=\widetilde{W}_{i+1}(r_x) q i + 1 ( 0 ) = W i + 1 ( r x ) and q i + 1 ( 1 ) = W ~ i + 1 ( r y ) q_{i+1}(1)=\widetilde{W}_{i+1}(r_y) q i + 1 ( 1 ) = W i + 1 ( r y ) . P sends q i + 1 ∗ q_{i+1}^* q i + 1 ∗ , and V checks:
deg q i + 1 ∗ ≤ s i + 1 \deg q_{i+1}^* \le s_{i+1} deg q i + 1 ∗ ≤ s i + 1 ,
q i + 1 ∗ ( 0 ) = z x ∗ q_{i+1}^*(0)=z_x^* q i + 1 ∗ ( 0 ) = z x ∗ and q i + 1 ∗ ( 1 ) = z y ∗ q_{i+1}^*(1)=z_y^* q i + 1 ∗ ( 1 ) = z y ∗ .
If these pass, V samples τ i + 1 ← F \tau_{i+1}\leftarrow\mathbb{F} τ i + 1 ← F and defines
ρ i + 1 : = ℓ ( τ i + 1 ) ∈ F s i + 1 . \rho_{i+1}:=\ell(\tau_{i+1})\in\mathbb{F}^{s_{i+1}}. ρ i + 1 := ℓ ( τ i + 1 ) ∈ F s i + 1 . In an honest execution, q i + 1 ∗ ( τ i + 1 ) q_{i+1}^*(\tau_{i+1}) q i + 1 ∗ ( τ i + 1 ) equals W ~ i + 1 ( ρ i + 1 ) \widetilde{W}_{i+1}(\rho_{i+1}) W i + 1 ( ρ i + 1 ) . The protocol proceeds to the next layer until reaching d − 1 d-1 d − 1 .
GKR Layer d - 1 (final layer). Layer d − 1 d-1 d − 1 is handled differently because its child gates lie in the input layer d d d . Here the recursion bottoms out: W ~ d \widetilde{W}_d W d is fully determined by the public inputs, so the verifier can evaluate W ~ d \widetilde{W}_d W d directly.
As before, at the start of Layer d - 1, V holds ρ d − 1 ∈ F s d − 1 \rho_{d-1}\in\mathbb{F}^{s_{d-1}} ρ d − 1 ∈ F s d − 1 and a claimed value q d − 1 ∗ ( τ d − 1 ) q_{d-1}^*(\tau_{d-1}) q d − 1 ∗ ( τ d − 1 ) (honestly W ~ d − 1 ( ρ d − 1 ) \widetilde{W}_{d-1}(\rho_{d-1}) W d − 1 ( ρ d − 1 ) ). The parties run sum-check on Thaler’s identity at layer d − 1 d-1 d − 1 , producing challenge vectors r x , r y ∈ F s d r_x,r_y\in\mathbb{F}^{s_d} r x , r y ∈ F s d and reducing to a final check of the form g 2 s d − 1 ∗ ( r 2 s d − 1 ) = ? g ( r x , r y ) g_{2s_d-1}^*(r_{2s_d-1}) \overset{?}{=} g(r_x,r_y) g 2 s d − 1 ∗ ( r 2 s d − 1 ) = ? g ( r x , r y ) . Unlike earlier layers, V now computes z x = W ~ d ( r x ) z_x=\widetilde{W}_d(r_x) z x = W d ( r x ) and z y = W ~ d ( r y ) z_y=\widetilde{W}_d(r_y) z y = W d ( r y ) directly from the public inputs, and checks the corresponding bridging equation. If it holds, V accepts; otherwise V rejects.
This completes the description of the GKR protocol.
Example 1 [GKR Layer d - 1]. In our example d = 2 d=2 d = 2 , so the final nontrivial layer is d − 1 = 1 d-1=1 d − 1 = 1 . The input layer has size S 2 = 4 S_2=4 S 2 = 4 and hence s 2 = 2 s_2=2 s 2 = 2 . At the end of Layer 0, V holds ρ 1 ∈ F s 1 = F \rho_1\in\mathbb{F}^{s_1}=\mathbb{F} ρ 1 ∈ F s 1 = F and a claimed value q 1 ∗ ( τ 1 ) q_1^*(\tau_1) q 1 ∗ ( τ 1 ) , which (if P is honest) equals W ~ 1 ( ρ 1 ) \widetilde{W}_1(\rho_1) W 1 ( ρ 1 ) . Sum-check at Layer 1 runs for 2 s 2 = 4 2s_2=4 2 s 2 = 4 rounds. At the end, V needs to check g 3 ∗ ( r 3 ) = ? g ( r 0 , r 1 , r 2 , r 3 ) g_3^*(r_3)\overset{?}{=}g(r_0,r_1,r_2,r_3) g 3 ∗ ( r 3 ) = ? g ( r 0 , r 1 , r 2 , r 3 ) . Crucially, since this is the input layer, V can evaluate W ~ 2 \widetilde{W}_2 W 2 directly:
W ~ 2 ( r 0 , r 1 ) = − 2 r 0 r 1 + r 0 − r 1 + 3 , W ~ 2 ( r 2 , r 3 ) = − 2 r 2 r 3 + r 2 − r 3 + 3 , \widetilde{W}_2(r_0,r_1)=-2r_0r_1+r_0-r_1+3,\qquad
\widetilde{W}_2(r_2,r_3)=-2r_2r_3+r_2-r_3+3, W 2 ( r 0 , r 1 ) = − 2 r 0 r 1 + r 0 − r 1 + 3 , W 2 ( r 2 , r 3 ) = − 2 r 2 r 3 + r 2 − r 3 + 3 , and therefore V can compute the right-hand side g ( r 0 , r 1 , r 2 , r 3 ) g(r_0,r_1,r_2,r_3) g ( r 0 , r 1 , r 2 , r 3 ) explicitly and reject if it disagrees with g 3 ∗ ( r 3 ) g_3^*(r_3) g 3 ∗ ( r 3 ) .
Sum-check for Layer 1. Here s 2 = 2 s_2 = 2 s 2 = 2 , so the sum-check protocol runs for 2 s 2 = 4 2s_2 = 4 2 s 2 = 4 rounds. Recall that the layer-1 claim being justified is the (possibly false) value q 1 ∗ ( τ 1 ) q_1^*(\tau_1) q 1 ∗ ( τ 1 ) , which in an honest execution equals W ~ 1 ( ρ 1 ) \widetilde{W}_1(\rho_1) W 1 ( ρ 1 ) ; see the setup in the preceding discussion (in particular, the explicit identity in (14) above).
Sum-check Round 1.0. Define
g 0 ( u 0 ) : = ∑ x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } g ( u 0 , x 1 , y 0 , y 1 ) . g_0(u_0)
:=
\sum_{x_1 \, \in \, \{0,1\}}
\sum_{y_0 \, \in \, \{0,1\}}
\sum_{y_1 \, \in \, \{0,1\}}
g(u_0,x_1,y_0,y_1). g 0 ( u 0 ) := x 1 ∈ { 0 , 1 } ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } ∑ g ( u 0 , x 1 , y 0 , y 1 ) . For the true g 0 g_0 g 0 and g g g , we have g 0 ( 0 ) + g 0 ( 1 ) = ∑ g ( ⋅ ) g_0(0)+g_0(1)=\sum g(\cdot) g 0 ( 0 ) + g 0 ( 1 ) = ∑ g ( ⋅ ) , so the sum-check consistency condition for the prover’s first message is
q 1 ∗ ( τ 1 ) = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . q_1^*(\tau_1) \overset{?}{=} g_0^*(0) + g_0^*(1). q 1 ∗ ( τ 1 ) = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . The prover P sends a polynomial g 0 ∗ g_0^* g 0 ∗ , claiming it is the same as g 0 g_0 g 0 . V checks:
deg g 0 ∗ ≤ 4 s 2 = 8 \deg g_0^* \le 4s_2 = 8 deg g 0 ∗ ≤ 4 s 2 = 8 ,
q 1 ∗ ( τ 1 ) = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) q_1^*(\tau_1) = g_0^*(0) + g_0^*(1) q 1 ∗ ( τ 1 ) = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) .
If either check fails, V rejects. Otherwise, V samples
r 0 ← F r_0 \leftarrow \mathbb{F} r 0 ← F and sends it to P.
With our specific values (ρ 1 = 92 \rho_1 = 92 ρ 1 = 92 ), the true polynomial is
g 0 ( u 0 ) = 274 u 0 2 + 732 u 0 + 2147483101. g_0(u_0) = 274u_0^2 + 732u_0 + 2147483101. g 0 ( u 0 ) = 274 u 0 2 + 732 u 0 + 2147483101. However, since P is pursuing the false claim from earlier, P must send some different polynomial g 0 ∗ g_0^* g 0 ∗ that still passes the two checks above. Suppose P chooses
g 0 ∗ ( u 0 ) = 275 u 0 2 + 2087826151 u 0 + 2147483101. g^*_0(u_0) = 275u_0^2 + 2087826151u_0 + 2147483101. g 0 ∗ ( u 0 ) = 275 u 0 2 + 2087826151 u 0 + 2147483101. Then the degree bound holds, and in Z / p Z \mathbb{Z}/p\mathbb{Z} Z / p Z we have
g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 2147483101 + ( 275 + 2087826151 + 2147483101 ) = 2087825334 = q 1 ∗ ( τ 1 ) . g^*_0(0) + g^*_0(1)
= 2147483101 + (275 + 2087826151 + 2147483101)
= 2087825334
= q_1^*(\tau_1). g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) = 2147483101 + ( 275 + 2087826151 + 2147483101 ) = 2087825334 = q 1 ∗ ( τ 1 ) . So far, P’s messages are consistent and V does not reject. Suppose V’s random challenge is
Sum-check Round 1.1. Define
g 1 ( u 1 ) : = ∑ y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } g ( r 0 , u 1 , y 0 , y 1 ) , g_1(u_1)
:=
\sum_{y_0 \, \in \, \{0,1\}}
\sum_{y_1 \, \in \, \{0,1\}}
g(r_0,u_1,y_0,y_1), g 1 ( u 1 ) := y 0 ∈ { 0 , 1 } ∑ y 1 ∈ { 0 , 1 } ∑ g ( r 0 , u 1 , y 0 , y 1 ) , so that, as these are the true polynomials,
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 ) . P sends g 1 ∗ g_1^* g 1 ∗ (claiming it is the same as g 1 g_1 g 1 ). V checks:
deg g 1 ∗ ≤ 8 \deg g_1^* \le 8 deg g 1 ∗ ≤ 8 ,
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 ) .
If the checks pass, V samples
r 1 ← F r_1 \leftarrow \mathbb{F} r 1 ← F and sends it to P.
With our specific values (r 0 = 99 r_0 = 99 r 0 = 99 ), the true polynomial is
g 1 ( u 1 ) = 5361856 u 1 2 + 2139364395 u 1 + 2757396. g_1(u_1) = 5361856u_1^2 + 2139364395u_1 + 2757396. g 1 ( u 1 ) = 5361856 u 1 2 + 2139364395 u 1 + 2757396. Suppose P instead claims
g 1 ∗ ( u 1 ) = 5361857 u 1 2 + 528176917 u 1 + 2757396. g^*_1(u_1) = 5361857u_1^2 + 528176917u_1 + 2757396. g 1 ∗ ( u 1 ) = 5361857 u 1 2 + 528176917 u 1 + 2757396. V verifies the degree bound and the consistency equation by checking (in Z / p Z \mathbb{Z}/p\mathbb{Z} Z / p Z )
g 0 ∗ ( 99 ) = 275 ( 9 9 2 ) + 2087826151 ( 99 ) + 2147483101 = 539053566 , g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) = 2757396 + ( 5361856 + 2139364395 + 2757396 ) = 539053566. \begin{align}
g^*_0(99) & = 275(99^2) + 2087826151(99) + 2147483101 = 539053566,\\
g^*_1(0) + g^*_1(1) & = 2757396 + (5361856 + 2139364395 + 2757396) = 539053566.
\end{align} g 0 ∗ ( 99 ) g 1 ∗ ( 0 ) + g 1 ∗ ( 1 ) = 275 ( 9 9 2 ) + 2087826151 ( 99 ) + 2147483101 = 539053566 , = 2757396 + ( 5361856 + 2139364395 + 2757396 ) = 539053566. Thus the transcript remains consistent so far. Suppose V’s next random challenge is
Sum-check Round 1.2. Define
g 2 ( u 2 ) : = ∑ y 1 ∈ { 0 , 1 } g ( r 0 , r 1 , u 2 , y 1 ) , g_2(u_2)
:=
\sum_{y_1 \, \in \, \{0,1\}}
g(r_0,r_1,u_2,y_1), g 2 ( u 2 ) := y 1 ∈ { 0 , 1 } ∑ g ( r 0 , r 1 , u 2 , y 1 ) , so that, as these are the true polynomials,
g 1 ( r 1 ) = g 2 ( 0 ) + g 2 ( 1 ) . g_1(r_1) = g_2(0) + g_2(1). g 1 ( r 1 ) = g 2 ( 0 ) + g 2 ( 1 ) . P sends g 2 ∗ g_2^* g 2 ∗ (claiming it is the same as g 2 g_2 g 2 ). V checks:
deg g 2 ∗ ≤ 8 \deg g_2^* \le 8 deg g 2 ∗ ≤ 8 ,
g 1 ∗ ( r 1 ) = g 2 ∗ ( 0 ) + g 2 ∗ ( 1 ) g_1^*(r_1) = g_2^*(0) + g_2^*(1) g 1 ∗ ( r 1 ) = g 2 ∗ ( 0 ) + g 2 ∗ ( 1 ) .
If successful, V samples
r 2 ← F r_2 \leftarrow \mathbb{F} r 2 ← F and sends it to P.
With our specific values ( r 0 , r 1 ) = ( 99 , 7 ) (r_0,r_1)=(99,7) ( r 0 , r 1 ) = ( 99 , 7 ) , the true polynomial is
g 2 ( u 2 ) = 69133476 u 2 2 + 2010688435 u 2 + 138157656. g_2(u_2) = 69133476u_2^2 + 2010688435u_2 + 138157656. g 2 ( u 2 ) = 69133476 u 2 2 + 2010688435 u 2 + 138157656. Suppose P instead claims this is
g 2 ∗ ( u 2 ) = 69133477 u 2 2 + 1469794372 u 2 + 138157656. g^*_2(u_2) = 69133477u_2^2 + 1469794372u_2 + 138157656. g 2 ∗ ( u 2 ) = 69133477 u 2 2 + 1469794372 u 2 + 138157656. V verifies the degree bound and the consistency equation by checking (in Z / p Z \mathbb{Z}/p\mathbb{Z} Z / p Z )
g 1 ∗ ( 7 ) = 5361856 ( 7 ) 2 + 2139364395 ( 7 ) + 2757396 = 1815243161 , g 2 ∗ ( 0 ) + g 2 ∗ ( 1 ) = 138157656 + ( 69133477 + 1469794372 + 138157656 ) = 1815243161. \begin{align}
g^*_1(7) & = 5361856(7)^2 + 2139364395(7) + 2757396 = 1815243161,\\
g^*_2(0) + g^*_2(1) & = 138157656 + (69133477 + 1469794372 + 138157656) = 1815243161.
\end{align} g 1 ∗ ( 7 ) g 2 ∗ ( 0 ) + g 2 ∗ ( 1 ) = 5361856 ( 7 ) 2 + 2139364395 ( 7 ) + 2757396 = 1815243161 , = 138157656 + ( 69133477 + 1469794372 + 138157656 ) = 1815243161. So V still does not reject. Suppose V’s next random challenge is
r 2 = 1001. r_2 = 1001. r 2 = 1001. Sum-check Round 1.3. Define
g 3 ( u 3 ) : = g ( r 0 , r 1 , r 2 , u 3 ) , g_3(u_3) := g(r_0,r_1,r_2,u_3), g 3 ( u 3 ) := g ( r 0 , r 1 , r 2 , u 3 ) , so that, as these are the true polynomials,
g 2 ( r 2 ) = g 3 ( 0 ) + g 3 ( 1 ) . g_2(r_2) = g_3(0) + g_3(1). g 2 ( r 2 ) = g 3 ( 0 ) + g 3 ( 1 ) . P sends g 3 ∗ g_3^* g 3 ∗ (claiming it is the same as g 3 g_3 g 3 ). V checks:
deg g 3 ∗ ≤ 8 \deg g_3^* \le 8 deg g 3 ∗ ≤ 8 ,
g 2 ∗ ( r 2 ) = g 3 ∗ ( 0 ) + g 3 ∗ ( 1 ) g_2^*(r_2) = g_3^*(0) + g_3^*(1) g 2 ∗ ( r 2 ) = g 3 ∗ ( 0 ) + g 3 ∗ ( 1 ) .
If the checks pass, V samples
r 3 ← F r_3 \leftarrow \mathbb{F} r 3 ← F and sends it to P.
With our specific values ( r 0 , r 1 , r 2 ) = ( 99 , 7 , 1001 ) (r_0,r_1,r_2)=(99,7,1001) ( r 0 , r 1 , r 2 ) = ( 99 , 7 , 1001 ) , the true polynomial is
g 3 ( u 3 ) = 421362090 u 3 2 + 655825959 u 3 . g_3(u_3) = 421362090u_3^2 + 655825959u_3. g 3 ( u 3 ) = 421362090 u 3 2 + 655825959 u 3 . Suppose P instead claims this is
g 3 ∗ ( u 3 ) = 421362091 u 3 2 + 387749940 u 3 . g^*_3(u_3) = 421362091u_3^2 + 387749940u_3. g 3 ∗ ( u 3 ) = 421362091 u 3 2 + 387749940 u 3 . V verifies consistency by checking (in Z / p Z \mathbb{Z}/p\mathbb{Z} Z / p Z )
g 2 ∗ ( 1001 ) = 69133477 ( 1001 ) 2 + 1469794372 ( 1001 ) + 138157656 = 809112031 , g 3 ∗ ( 0 ) + g 3 ∗ ( 1 ) = 0 + ( 421362091 + 387749940 ) = 809112031. \begin{align}
g^*_2(1001) & = 69133477(1001)^2 + 1469794372(1001) + 138157656 = 809112031,\\
g^*_3(0) + g^*_3(1) & = 0 + (421362091 + 387749940) = 809112031.
\end{align} g 2 ∗ ( 1001 ) g 3 ∗ ( 0 ) + g 3 ∗ ( 1 ) = 69133477 ( 1001 ) 2 + 1469794372 ( 1001 ) + 138157656 = 809112031 , = 0 + ( 421362091 + 387749940 ) = 809112031. Thus the transcript is still internally consistent. Suppose V’s final random challenge is
r 3 = 666. r_3 = 666. r 3 = 666. Sum-check final check (no folding). At this point,
g 3 ( r 3 ) = g ( r 0 , r 1 , r 2 , r 3 ) . g_3(r_3) = g(r_0,r_1,r_2,r_3). g 3 ( r 3 ) = g ( r 0 , r 1 , r 2 , r 3 ) . In earlier layers, this is where folding would be used. Here, however, we are at the input layer, so V can evaluate g ( r 0 , r 1 , r 2 , r 3 ) g(r_0,r_1,r_2,r_3) g ( r 0 , r 1 , r 2 , r 3 ) directly from the public data.
Expanding the right-hand side gives
g ( r 0 , r 1 , r 2 , r 3 ) = a d d ~ 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 ) ) [ W ~ 2 ( r 0 , r 1 ) + W ~ 2 ( r 2 , r 3 ) ] + m u l t ~ 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 ) ) [ W ~ 2 ( r 0 , r 1 ) W ~ 2 ( r 2 , r 3 ) ] . \begin{aligned}
g(r_0,r_1,r_2,r_3)
&=
\widetilde{\mathrm{add}}_1(\rho_1,(r_0,r_1),(r_2,r_3))
\big[
\widetilde{W}_{2}(r_0,r_1) + \widetilde{W}_{2}(r_2,r_3)
\big]
+
\widetilde{\mathrm{mult}}_1(\rho_1,(r_0,r_1),(r_2,r_3))
\big[
\widetilde{W}_{2}(r_0,r_1)\widetilde{W}_{2}(r_2,r_3)
\big].
\end{aligned} g ( r 0 , r 1 , r 2 , r 3 ) = add 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 )) [ W 2 ( r 0 , r 1 ) + W 2 ( r 2 , r 3 ) ] + mult 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 )) [ W 2 ( r 0 , r 1 ) W 2 ( r 2 , r 3 ) ] . Since the circuit is public, V can evaluate the wiring predicates:
a d d ~ 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 ) ) = ρ 1 r 0 ( 1 − r 1 ) r 2 r 3 , m u l t ~ 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 ) ) = ( 1 − ρ 1 ) ( 1 − r 0 ) ( 1 − r 1 ) ( 1 − r 2 ) r 3 . \begin{align}
\widetilde{\mathrm{add}}_1(\rho_1,(r_0,r_1),(r_2,r_3))
&= \rho_1 r_0(1-r_1)r_2r_3,\\
\widetilde{\mathrm{mult}}_1(\rho_1,(r_0,r_1),(r_2,r_3))
&= (1-\rho_1)(1-r_0)(1-r_1)(1-r_2)r_3.
\end{align} add 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 )) mult 1 ( ρ 1 , ( r 0 , r 1 ) , ( r 2 , r 3 )) = ρ 1 r 0 ( 1 − r 1 ) r 2 r 3 , = ( 1 − ρ 1 ) ( 1 − r 0 ) ( 1 − r 1 ) ( 1 − r 2 ) r 3 . Crucially, because this is the input layer, V can also compute W ~ 2 \widetilde{W}_2 W 2 directly:
W ~ 2 ( r 0 , r 1 ) = − 2 r 0 r 1 + r 0 − r 1 + 3 , W ~ 2 ( r 2 , r 3 ) = − 2 r 2 r 3 + r 2 − r 3 + 3. \widetilde{W}_{2}(r_0,r_1) = -2r_0r_1 + r_0 - r_1 + 3,
\qquad
\widetilde{W}_{2}(r_2,r_3) = -2r_2r_3 + r_2 - r_3 + 3. W 2 ( r 0 , r 1 ) = − 2 r 0 r 1 + r 0 − r 1 + 3 , W 2 ( r 2 , r 3 ) = − 2 r 2 r 3 + r 2 − r 3 + 3. V therefore checks whether
g 3 ∗ ( r 3 ) = ? g ( r 0 , r 1 , r 2 , r 3 ) , g_3^*(r_3) \overset{?}{=} g(r_0,r_1,r_2,r_3), g 3 ∗ ( r 3 ) = ? g ( r 0 , r 1 , r 2 , r 3 ) , rejecting if the equality fails. If it holds, V accepts and the protocol terminates.
With our concrete values ( r 0 , r 1 , r 2 , r 3 ) = ( 99 , 7 , 1001 , 666 ) (r_0,r_1,r_2,r_3)=(99,7,1001,666) ( r 0 , r 1 , r 2 , r 3 ) = ( 99 , 7 , 1001 , 666 ) , V computes
g 3 ∗ ( r 3 ) = g 3 ∗ ( 666 ) = 421362091 ( 666 ) 2 + 387749940 ( 666 ) = 577775939. g^*_3(r_3) = g_3^*(666) = 421362091(666)^2 + 387749940(666) = 577775939. g 3 ∗ ( r 3 ) = g 3 ∗ ( 666 ) = 421362091 ( 666 ) 2 + 387749940 ( 666 ) = 577775939. If P were honest, we would instead have
g 3 ( r 3 ) = 421362090 ( 666 ) 2 + 655825959 ( 666 ) = 874818336. g_3(r_3) = 421362090(666)^2 + 655825959(666) = 874818336. g 3 ( r 3 ) = 421362090 ( 666 ) 2 + 655825959 ( 666 ) = 874818336. Although V does not know g 3 ( r 3 ) g_3(r_3) g 3 ( r 3 ) directly, V does compute the right-hand side exactly:
g ( r 0 , r 1 , r 2 , r 3 ) = g ( 99 , 7 , 1001 , 666 ) = 874818336. g(r_0,r_1,r_2,r_3) = g(99,7,1001,666) = 874818336. g ( r 0 , r 1 , r 2 , r 3 ) = g ( 99 , 7 , 1001 , 666 ) = 874818336. Since 874818336 ≠ 577775939 874818336 \ne 577775939 874818336 = 577775939 , V rejects P’s original claim.
expression_01 = '(3*2) + (4 + 1)'
gkr_01 = ArithmeticCircuit(expression_01, prime=2**(31) - 1)
display(gkr_01.graphviz_circuit_bitstring)
gkr_01.print_gate_values()
gkr_01.print_tilde_W()
gkr_01.print_wiring_predicates()
gkr_01.print_wiring_predicate_mles()
gkr_01.print_verification_propagation_equation()
gkr_01.print_verification_propagation_equation(mle=True)
MULTILINEAR EXTENSIONS OF GATE-VALUE FUNCTIONS
W̃_2(x_0, x_1) = 2147483645*x_0*x_1 + x_0 + 2147483646*x_1 + 3
W̃_1(x_0) = 2147483646*x_0 + 6
ADDITION WIRING PREDICATES (NONZERO VALUES)
add_1((1),(1,0),(1,1)) = 1
MULTIPLICATION WIRING PREDICATES (NONZERO VALUES)
mult_1((0),(0,0),(0,1)) = 1
MULTILINEAR EXTENSIONS OF WIRING PREDICATES: ADD
add̃_1(z_0,x_0,x_1,y_0,y_1) = 2147483646*x_0*x_1*y_0*y_1*z_0 + x_0*y_0*y_1*z_0
add̃_0(x_0,y_0) = 2147483646*x_0*y_0 + y_0
MULTILINEAR EXTENSIONS OF WIRING PREDICATES: MULT
mult̃_1(z_0,x_0,x_1,y_0,y_1) = x_0*x_1*y_0*y_1*z_0 + 2147483646*x_0*x_1*y_0*y_1 + 2147483646*x_0*x_1*y_1*z_0 + x_0*x_1*y_1 + 2147483646*x_0*y_0*y_1*z_0 + x_0*y_0*y_1 + x_0*y_1*z_0 + 2147483646*x_0*y_1 + 2147483646*x_1*y_0*y_1*z_0 + x_1*y_0*y_1 + x_1*y_1*z_0 + 2147483646*x_1*y_1 + y_0*y_1*z_0 + 2147483646*y_0*y_1 + 2147483646*y_1*z_0 + y_1
VERIFICATION OF LAYER-WISE GATE-VALUE PROPAGATION EQUATION
W_1(0) = 6, sum { add_1((0),x,y) [ W_2(x) + W_2(y) ] + mult_1((0),x,y) [ W_2(x) W_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 6 ✓
W_1(1) = 5, sum { add_1((1),x,y) [ W_2(x) + W_2(y) ] + mult_1((1),x,y) [ W_2(x) W_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 5 ✓
W_0() = 11, sum { add_0((),x,y) [ W_1(x) + W_1(y) ] + mult_0((),x,y) [ W_1(x) W_1(y)] } over (x,y) in {0,1}^1 × {0,1}^1 = 11 ✓
VERIFICATION OF THALER'S IDENTITY
(There are 2147483647 z-values in the domain; checking all would be slow.
We will select 1000 z-values uniformly at random, and display at most 100 of them.)
W̃_1(580532985) = 1566950668, sum { add̃_1((580532985),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((580532985),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1566950668 ✓
W̃_1(1309811308) = 837672345, sum { add̃_1((1309811308),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1309811308),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 837672345 ✓
W̃_1(1798557119) = 348926534, sum { add̃_1((1798557119),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1798557119),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 348926534 ✓
W̃_1(1185603246) = 961880407, sum { add̃_1((1185603246),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1185603246),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 961880407 ✓
W̃_1(1383826465) = 763657188, sum { add̃_1((1383826465),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1383826465),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 763657188 ✓
W̃_1(1451687875) = 695795778, sum { add̃_1((1451687875),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1451687875),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 695795778 ✓
W̃_1(1012432304) = 1135051349, sum { add̃_1((1012432304),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1012432304),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1135051349 ✓
W̃_1(1753714641) = 393769012, sum { add̃_1((1753714641),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1753714641),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 393769012 ✓
W̃_1(233602758) = 1913880895, sum { add̃_1((233602758),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((233602758),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1913880895 ✓
W̃_1(1038398223) = 1109085430, sum { add̃_1((1038398223),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1038398223),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1109085430 ✓
W̃_1(1423853633) = 723630020, sum { add̃_1((1423853633),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1423853633),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 723630020 ✓
W̃_1(734154451) = 1413329202, sum { add̃_1((734154451),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((734154451),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1413329202 ✓
W̃_1(1463172515) = 684311138, sum { add̃_1((1463172515),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1463172515),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 684311138 ✓
W̃_1(1647994442) = 499489211, sum { add̃_1((1647994442),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1647994442),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 499489211 ✓
W̃_1(911438742) = 1236044911, sum { add̃_1((911438742),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((911438742),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1236044911 ✓
W̃_1(1616094889) = 531388764, sum { add̃_1((1616094889),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1616094889),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 531388764 ✓
W̃_1(1320933914) = 826549739, sum { add̃_1((1320933914),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1320933914),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 826549739 ✓
W̃_1(1681881748) = 465601905, sum { add̃_1((1681881748),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1681881748),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 465601905 ✓
W̃_1(1944021403) = 203462250, sum { add̃_1((1944021403),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1944021403),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 203462250 ✓
W̃_1(808428777) = 1339054876, sum { add̃_1((808428777),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((808428777),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1339054876 ✓
W̃_1(1862710594) = 284773059, sum { add̃_1((1862710594),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1862710594),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 284773059 ✓
W̃_1(119163748) = 2028319905, sum { add̃_1((119163748),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((119163748),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2028319905 ✓
W̃_1(1137057510) = 1010426143, sum { add̃_1((1137057510),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1137057510),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1010426143 ✓
W̃_1(16740576) = 2130743077, sum { add̃_1((16740576),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((16740576),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2130743077 ✓
W̃_1(1595277925) = 552205728, sum { add̃_1((1595277925),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1595277925),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 552205728 ✓
W̃_1(499565674) = 1647917979, sum { add̃_1((499565674),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((499565674),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1647917979 ✓
W̃_1(601787749) = 1545695904, sum { add̃_1((601787749),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((601787749),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1545695904 ✓
W̃_1(19707372) = 2127776281, sum { add̃_1((19707372),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((19707372),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2127776281 ✓
W̃_1(1185415007) = 962068646, sum { add̃_1((1185415007),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1185415007),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 962068646 ✓
W̃_1(1445538898) = 701944755, sum { add̃_1((1445538898),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1445538898),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 701944755 ✓
W̃_1(65423735) = 2082059918, sum { add̃_1((65423735),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((65423735),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2082059918 ✓
W̃_1(2142752722) = 4730931, sum { add̃_1((2142752722),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2142752722),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 4730931 ✓
W̃_1(1157933521) = 989550132, sum { add̃_1((1157933521),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1157933521),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 989550132 ✓
W̃_1(1923902781) = 223580872, sum { add̃_1((1923902781),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1923902781),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 223580872 ✓
W̃_1(2119589805) = 27893848, sum { add̃_1((2119589805),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2119589805),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 27893848 ✓
W̃_1(1249608465) = 897875188, sum { add̃_1((1249608465),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1249608465),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 897875188 ✓
W̃_1(1139199755) = 1008283898, sum { add̃_1((1139199755),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1139199755),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1008283898 ✓
W̃_1(476343557) = 1671140096, sum { add̃_1((476343557),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((476343557),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1671140096 ✓
W̃_1(1937452553) = 210031100, sum { add̃_1((1937452553),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1937452553),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 210031100 ✓
W̃_1(366914188) = 1780569465, sum { add̃_1((366914188),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((366914188),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1780569465 ✓
W̃_1(859944513) = 1287539140, sum { add̃_1((859944513),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((859944513),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1287539140 ✓
W̃_1(1920070890) = 227412763, sum { add̃_1((1920070890),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1920070890),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 227412763 ✓
W̃_1(100464164) = 2047019489, sum { add̃_1((100464164),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((100464164),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2047019489 ✓
W̃_1(25253520) = 2122230133, sum { add̃_1((25253520),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((25253520),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2122230133 ✓
W̃_1(411880283) = 1735603370, sum { add̃_1((411880283),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((411880283),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1735603370 ✓
W̃_1(1422793050) = 724690603, sum { add̃_1((1422793050),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1422793050),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 724690603 ✓
W̃_1(241452860) = 1906030793, sum { add̃_1((241452860),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((241452860),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1906030793 ✓
W̃_1(390429418) = 1757054235, sum { add̃_1((390429418),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((390429418),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1757054235 ✓
W̃_1(695966034) = 1451517619, sum { add̃_1((695966034),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((695966034),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1451517619 ✓
W̃_1(2094005506) = 53478147, sum { add̃_1((2094005506),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2094005506),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 53478147 ✓
W̃_1(1597054330) = 550429323, sum { add̃_1((1597054330),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1597054330),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 550429323 ✓
W̃_1(580984324) = 1566499329, sum { add̃_1((580984324),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((580984324),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1566499329 ✓
W̃_1(1269545215) = 877938438, sum { add̃_1((1269545215),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1269545215),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 877938438 ✓
W̃_1(807581509) = 1339902144, sum { add̃_1((807581509),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((807581509),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1339902144 ✓
W̃_1(1788827022) = 358656631, sum { add̃_1((1788827022),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1788827022),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 358656631 ✓
W̃_1(1187067000) = 960416653, sum { add̃_1((1187067000),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1187067000),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 960416653 ✓
W̃_1(2033724786) = 113758867, sum { add̃_1((2033724786),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2033724786),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 113758867 ✓
W̃_1(1715873719) = 431609934, sum { add̃_1((1715873719),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1715873719),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 431609934 ✓
W̃_1(311492959) = 1835990694, sum { add̃_1((311492959),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((311492959),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1835990694 ✓
W̃_1(807136593) = 1340347060, sum { add̃_1((807136593),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((807136593),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1340347060 ✓
W̃_1(148340679) = 1999142974, sum { add̃_1((148340679),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((148340679),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1999142974 ✓
W̃_1(1806859730) = 340623923, sum { add̃_1((1806859730),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1806859730),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 340623923 ✓
W̃_1(1352407350) = 795076303, sum { add̃_1((1352407350),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1352407350),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 795076303 ✓
W̃_1(1353558280) = 793925373, sum { add̃_1((1353558280),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1353558280),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 793925373 ✓
W̃_1(731028452) = 1416455201, sum { add̃_1((731028452),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((731028452),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1416455201 ✓
W̃_1(1498661839) = 648821814, sum { add̃_1((1498661839),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1498661839),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 648821814 ✓
W̃_1(646012227) = 1501471426, sum { add̃_1((646012227),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((646012227),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1501471426 ✓
W̃_1(1119219520) = 1028264133, sum { add̃_1((1119219520),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1119219520),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1028264133 ✓
W̃_1(687434684) = 1460048969, sum { add̃_1((687434684),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((687434684),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1460048969 ✓
W̃_1(325540649) = 1821943004, sum { add̃_1((325540649),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((325540649),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1821943004 ✓
W̃_1(2058859588) = 88624065, sum { add̃_1((2058859588),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2058859588),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 88624065 ✓
W̃_1(1749284641) = 398199012, sum { add̃_1((1749284641),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1749284641),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 398199012 ✓
W̃_1(569822306) = 1577661347, sum { add̃_1((569822306),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((569822306),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1577661347 ✓
W̃_1(1547465845) = 600017808, sum { add̃_1((1547465845),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1547465845),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 600017808 ✓
W̃_1(930400904) = 1217082749, sum { add̃_1((930400904),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((930400904),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1217082749 ✓
W̃_1(979887585) = 1167596068, sum { add̃_1((979887585),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((979887585),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1167596068 ✓
W̃_1(923485080) = 1223998573, sum { add̃_1((923485080),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((923485080),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1223998573 ✓
W̃_1(2008211873) = 139271780, sum { add̃_1((2008211873),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2008211873),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 139271780 ✓
W̃_1(626909330) = 1520574323, sum { add̃_1((626909330),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((626909330),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1520574323 ✓
W̃_1(1244103476) = 903380177, sum { add̃_1((1244103476),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1244103476),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 903380177 ✓
W̃_1(1564817998) = 582665655, sum { add̃_1((1564817998),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1564817998),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 582665655 ✓
W̃_1(457228468) = 1690255185, sum { add̃_1((457228468),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((457228468),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1690255185 ✓
W̃_1(183925269) = 1963558384, sum { add̃_1((183925269),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((183925269),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1963558384 ✓
W̃_1(81146554) = 2066337099, sum { add̃_1((81146554),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((81146554),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2066337099 ✓
W̃_1(1144694892) = 1002788761, sum { add̃_1((1144694892),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1144694892),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1002788761 ✓
W̃_1(704920934) = 1442562719, sum { add̃_1((704920934),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((704920934),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1442562719 ✓
W̃_1(1447846492) = 699637161, sum { add̃_1((1447846492),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1447846492),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 699637161 ✓
W̃_1(1680902939) = 466580714, sum { add̃_1((1680902939),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1680902939),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 466580714 ✓
W̃_1(1224525230) = 922958423, sum { add̃_1((1224525230),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1224525230),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 922958423 ✓
W̃_1(730897911) = 1416585742, sum { add̃_1((730897911),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((730897911),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1416585742 ✓
W̃_1(442780112) = 1704703541, sum { add̃_1((442780112),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((442780112),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1704703541 ✓
W̃_1(143314002) = 2004169651, sum { add̃_1((143314002),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((143314002),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 2004169651 ✓
W̃_1(1996561557) = 150922096, sum { add̃_1((1996561557),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1996561557),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 150922096 ✓
W̃_1(441306211) = 1706177442, sum { add̃_1((441306211),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((441306211),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1706177442 ✓
W̃_1(2135206666) = 12276987, sum { add̃_1((2135206666),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((2135206666),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 12276987 ✓
W̃_1(1323721974) = 823761679, sum { add̃_1((1323721974),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1323721974),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 823761679 ✓
W̃_1(1660465416) = 487018237, sum { add̃_1((1660465416),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1660465416),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 487018237 ✓
W̃_1(1121592950) = 1025890703, sum { add̃_1((1121592950),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1121592950),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1025890703 ✓
W̃_1(681666312) = 1465817341, sum { add̃_1((681666312),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((681666312),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 1465817341 ✓
W̃_1(1850470609) = 297013044, sum { add̃_1((1850470609),x,y) [ W̃_2(x) + W̃_2(y) ] + mult̃_1((1850470609),x,y) [ W̃_2(x) W̃_2(y)] } over (x,y) in {0,1}^2 × {0,1}^2 = 297013044 ✓
(Displayed 100 of 1000 checked equations.)
W̃_0() = 11, sum { add̃_0((),x,y) [ W̃_1(x) + W̃_1(y) ] + mult̃_0((),x,y) [ W̃_1(x) W̃_1(y)] } over (x,y) in {0,1}^1 × {0,1}^1 = 11 ✓
from gkr import gkr_example
gkr_example();
The arithmetic circuit C is defined over GF(2147483647) and has depth 2.
Layer sizes: S_0 = 1, S_1 = 2, S_2 = 4.
Gate-label bit-lengths: s_0 = 0, s_1 = 1, s_2 = 2.
(Layer 0 holds the output gate(s); layer 2 holds the inputs.)
Public information: the circuit topology -- and hence the wiring predicates add_i, mult_i and their multilinear extensions add̃_i, mult̃_i, which V can evaluate anywhere -- together with the inputs:
W_2(0, 0) = 3, W_2(0, 1) = 2, W_2(1, 0) = 4, W_2(1, 1) = 1.
In particular, V can compute W̃_2 directly. What V does NOT know (and does not want to compute) are the interior gate values and the output(s): verifying a claim about the output(s), without re-executing C, is the whole point of the protocol.
We display the true output(s) for the reader. In the protocol, V does not know these:
W_0() = 11.
P claims that the circuit output(s) are:
W*_0() = 11.
V forms the multilinear extension W̃*_0 of the claimed outputs.
If P's claims are correct, then W̃*_0 = W̃_0 (multilinear extensions are unique); otherwise W̃*_0 ≠ W̃_0.
Here s_0 = 0 (a single output gate), so ρ_0 := () and the point-claim is simply the output claim itself.
V computes α_0 := W̃*_0(ρ_0) = 11. The claim to be verified is now a single point-claim:
W̃_0(ρ_0) = α_0 = 11.
==========================
GKR LAYER 0 → 1: SUM-CHECK
==========================
At the start of this layer, V holds ρ_0 = () and the carried claim α_0 = 11 (the claim being that W̃_0(ρ_0) = α_0).
By Thaler's identity,
W̃_0(ρ_0) = sum g(x_0, y_0) over (x_0, y_0) in {0,1}^2,
where
g(x_0, y_0) := add̃_0(ρ_0, x_0, y_0)·[W̃_1(x_0) + W̃_1(y_0)] + mult̃_0(ρ_0, x_0, y_0)·[W̃_1(x_0)·W̃_1(y_0)].
V can evaluate add̃_0 and mult̃_0 anywhere (the wiring is public), but NOT W̃_1, so V cannot evaluate g pointwise. So we run the sum-check protocol on g, with claimed sum H* := α_0 = 11, deferring the evaluation of g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 2]. (Each variable has degree ≤ 1 in the wiring MLE and ≤ 1 in W̃_1, hence degree ≤ 2 in g.)
We display g for the reader. In the protocol, V cannot compute g (it involves W̃_1):
g(x_0, y_0) = x_0**2*y_0 + x_0*y_0**2 + 2147483634*x_0*y_0 + 2147483646*y_0**2 + 12*y_0.
Let
g_0(x_0) := sum g(x_0, b_1) over (b_1) in {0,1}^1
P claims that g_0(x_0) = g*_0(x_0), where
g*_0(x_0) = x_0**2 + 2147483635*x_0 + 11.
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* = 11. 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(2147483647); here r_0 = 991488846.
Let
g_1(y_0) := g(991488846, y_0)
P claims that g_1(y_0) = g*_1(y_0), where
g*_1(y_0) = 991488845*y_0**2 + 99440282*y_0.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(991488846) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 2 ≤ deg_1(g) = 2.
g*_0(991488846) = 1090929127
g*_1(0) + g*_1(1) = 1090929127
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(2147483647); here r_1 = 1258409338.
Unlike in the standalone sum-check protocol, V does not now evaluate g(r_x, r_y): g involves W̃_1, which V does not know. The transcript's terminal claim is
γ := g*_1(r_1) = 168502561,
the claim being that γ = g(r_x, r_y), where r_x = (991488846) and r_y = (1258409338).
V computes the (public) wiring values at this point:
A = add̃_0(ρ_0, r_x, r_y) = 1153746270
M = mult̃_0(ρ_0, r_x, r_y) = 0
Unpacking the definition of g, the claim γ = g(r_x, r_y) says exactly that
γ = A·[W̃_1(r_x) + W̃_1(r_y)] + M·[W̃_1(r_x)·W̃_1(r_y)] (the 'bridging equation').
V cannot check the bridging equation alone: it involves W̃_1(r_x) and W̃_1(r_y), which V cannot compute. So P supplies claimed values
z*_x (the claim: z*_x = W̃_1(r_x)) and z*_y (the claim: z*_y = W̃_1(r_y)).
P sends z*_x = 1155994807 and z*_y = 889074315.
V checks the bridging equation γ = A·(z*_x + z*_y) + M·z*_x·z*_y:
A·(z*_x + z*_y) + M·z*_x·z*_y = 168502561
V sees that P's claims so far are consistent.
Note: this check spends none of V's randomness. A and M are public and already fixed, so a P whose γ is false can always solve the bridging equation for forged endpoints (unless A = M = 0, when a false γ is caught outright). Consistency here is not evidence of honesty; the soundness budget lives entirely in the random challenges (ρ_0, the round challenges, and each fold challenge).
We now hold TWO claims about W̃_1 (at r_x and at r_y). To avoid the number of claims doubling at every layer, V folds them into ONE, as follows.
Let ℓ(t) := (1 - t)·r_x + t·r_y (the line through r_x = ℓ(0) and r_y = ℓ(1)), and let q_1(t) := W̃_1(ℓ(t)), a univariate polynomial of degree ≤ s_1 = 1.
P supplies a polynomial q*_1 (the claim: q*_1 = q_1). V checks that
(a) deg(q*_1) ≤ 1, and (b) q*_1(0) = z*_x and q*_1(1) = z*_y.
P claims that q_1(t) = q*_1(t), where
q*_1(t) = 1880563155*t + 1155994807.
V checks the degree bound: deg(q*_1) = 1 ≤ s_1 = 1.
q*_1(0) = 1155994807 (should be z*_x = 1155994807)
q*_1(1) = 889074315 (should be z*_y = 889074315)
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(2147483647); here τ_1 = 1393485243.
V sets ρ_1 := ℓ(τ_1) = (1497520673) and carries the single claim
α_1 := q*_1(τ_1) = 649962980
(the claim being that α_1 = W̃_1(ρ_1)). The protocol proceeds to the next layer.
==========================
GKR LAYER 1 → 2: SUM-CHECK
==========================
At the start of this layer, V holds ρ_1 = (1497520673) and the carried claim α_1 = 649962980 (the claim being that W̃_1(ρ_1) = α_1).
By Thaler's identity,
W̃_1(ρ_1) = sum g(x_0, x_1, y_0, y_1) over (x_0, x_1, y_0, y_1) in {0,1}^4,
where
g(x_0, x_1, y_0, y_1) := add̃_1(ρ_1, x_0, x_1, y_0, y_1)·[W̃_2(x_0, x_1) + W̃_2(y_0, y_1)] + mult̃_1(ρ_1, x_0, x_1, y_0, y_1)·[W̃_2(x_0, x_1)·W̃_2(y_0, y_1)].
V can evaluate add̃_1 and mult̃_1 anywhere (the wiring is public), but NOT W̃_2, so V cannot evaluate g pointwise. So we run the sum-check protocol on g, with claimed sum H* := α_1 = 649962980, deferring the evaluation of g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 2, 2, 2]. (Each variable has degree ≤ 1 in the wiring MLE and ≤ 1 in W̃_2, hence degree ≤ 2 in g.)
We display g for the reader. In the protocol, V cannot compute g (it involves W̃_2):
g(x_0, x_1, y_0, y_1) = 1695115394*x_0**2*x_1**2*y_0**2*y_1**2 + 1299925950*x_0**2*x_1**2*y_0**2*y_1 + 1299925950*x_0**2*x_1**2*y_0*y_1**2 + 1299925952*x_0**2*x_1**2*y_0*y_1 + 1299925950*x_0**2*x_1**2*y_1**2 + 395189444*x_0**2*x_1**2*y_1 + 1752294203*x_0**2*x_1*y_0**2*y_1**2 + 197594722*x_0**2*x_1*y_0**2*y_1 + 197594722*x_0**2*x_1*y_0*y_1**2 + 197594719*x_0**2*x_1*y_0*y_1 + 197594722*x_0**2*x_1*y_1**2 + 1554699481*x_0**2*x_1*y_1 + 847557697*x_0**2*y_0**2*y_1**2 + 649962975*x_0**2*y_0**2*y_1 + 649962975*x_0**2*y_0*y_1**2 + 649962976*x_0**2*y_0*y_1 + 649962975*x_0**2*y_1**2 + 197594722*x_0**2*y_1 + 1299925950*x_0*x_1**2*y_0**2*y_1**2 + 1497520672*x_0*x_1**2*y_0**2*y_1 + 1497520672*x_0*x_1**2*y_0*y_1**2 + 197594723*x_0*x_1**2*y_0*y_1 + 1497520672*x_0*x_1**2*y_1**2 + 1949888925*x_0*x_1**2*y_1 + 2*x_0*x_1*y_0**2*y_1** ... (truncated).
Let
g_0(x_0) := sum g(x_0, b_1, b_2, b_3) over (b_1, b_2, b_3) in {0,1}^3
P claims that g_0(x_0) = g*_0(x_0), where
g*_0(x_0) = 197594723*x_0**2 + 1242747145*x_0 + 1752294203.
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* = 649962980. V proceeds to compute:
g*_0(0) + g*_0(1) = 649962980
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(2147483647); here r_0 = 66834793.
Let
g_1(x_1) := sum g(66834793, x_1, b_2, b_3) over (b_2, b_3) in {0,1}^2
P claims that g_1(x_1) = g*_1(x_1), where
g*_1(x_1) = 820284973*x_1**2 + 1668838838*x_1 + 1805843483.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(66834793) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 2 ≤ deg_1(g) = 2.
g*_0(66834793) = 1805843483
g*_1(0) + g*_1(1) = 1805843483
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(2147483647); here r_1 = 1882412409.
Let
g_2(y_0) := sum g(66834793, 1882412409, y_0, b_3) over (b_3) in {0,1}^1
P claims that g_2(y_0) = g*_2(y_0), where
g*_2(y_0) = 1875404728*y_0**2 + 1902465874*y_0 + 332709644.
If P's last two claims are true, then deg(g*_2) ≤ deg_2(g) and g*_1(1882412409) = g*_2(0) + g*_2(1).
V checks the degree bound: deg(g*_2) = 2 ≤ deg_2(g) = 2.
g*_1(1882412409) = 148322596
g*_2(0) + g*_2(1) = 148322596
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(2147483647); here r_2 = 1013088078.
Let
g_3(y_1) := g(66834793, 1882412409, 1013088078, y_1)
P claims that g_3(y_1) = g*_3(y_1), where
g*_3(y_1) = 535000085*y_1**2 + 1943940717*y_1.
If P's last two claims are true, then deg(g*_3) ≤ deg_3(g) and g*_2(1013088078) = g*_3(0) + g*_3(1).
V checks the degree bound: deg(g*_3) = 2 ≤ deg_3(g) = 2.
g*_2(1013088078) = 331457155
g*_3(0) + g*_3(1) = 331457155
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(2147483647); here r_3 = 1407452798.
Unlike in the standalone sum-check protocol, V does not now evaluate g(r_x, r_y): g involves W̃_2, which V does not know. The transcript's terminal claim is
γ := g*_3(r_3) = 1016035939,
the claim being that γ = g(r_x, r_y), where r_x = (66834793, 1882412409) and r_y = (1013088078, 1407452798).
V computes the (public) wiring values at this point:
A = add̃_1(ρ_1, r_x, r_y) = 846365449
M = mult̃_1(ρ_1, r_x, r_y) = 1926900425
Unpacking the definition of g, the claim γ = g(r_x, r_y) says exactly that
γ = A·[W̃_2(r_x) + W̃_2(r_y)] + M·[W̃_2(r_x)·W̃_2(r_y)] (the 'bridging equation').
Layer 2 is the input layer. The inputs are public, so V can compute W̃_2 -- and hence both endpoint values -- directly, with no help from P:
z_x = W̃_2(r_x) = 1071311931
z_y = W̃_2(r_y) = 863673835
Nothing is left for P to forge: both endpoints are V's own, and there is no fold after the input layer. This last check spends no randomness -- a lie that survived to here is caught with certainty.
V checks the bridging equation γ = A·(z_x + z_y) + M·z_x·z_y:
A·(z_x + z_y) + M·z_x·z_y = 1016035939
P passes the final verification, and V ACCEPTS P's claimed output(s).
True circuit output(s):
W_0() = 11.
Prover claimed:
W*_0() = 11.
Soundness accounting. P is exposed to V's randomness in exactly three places: the draw of ρ_0, each sum-check round challenge, and each fold challenge. Union-bounding those exposures (see the notes), a dishonest P's chance of acceptance over this circuit and field is at most
(0 + 4·(1 + 2) + (1))/2147483647 = 13/2147483647 = 0.0000000061
(the three terms in that order: the draw of ρ_0, two chances per round across every sum-check, and one fold per intermediate layer).
The bridging equations and the final check spend no randomness at all: a consistent liar passes them for free, and the whole budget above is what stands between V and a false claim.
This was a TRUE POSITIVE: the claimed output(s) were correct.
gkr_example(dishonest=True);
The arithmetic circuit C is defined over GF(2147483647) and has depth 2.
Layer sizes: S_0 = 1, S_1 = 2, S_2 = 4.
Gate-label bit-lengths: s_0 = 0, s_1 = 1, s_2 = 2.
(Layer 0 holds the output gate(s); layer 2 holds the inputs.)
Public information: the circuit topology -- and hence the wiring predicates add_i, mult_i and their multilinear extensions add̃_i, mult̃_i, which V can evaluate anywhere -- together with the inputs:
W_2(0, 0) = 3, W_2(0, 1) = 2, W_2(1, 0) = 4, W_2(1, 1) = 1.
In particular, V can compute W̃_2 directly. What V does NOT know (and does not want to compute) are the interior gate values and the output(s): verifying a claim about the output(s), without re-executing C, is the whole point of the protocol.
We display the true output(s) for the reader. In the protocol, V does not know these:
W_0() = 11.
P claims that the circuit output(s) are:
W*_0() = 627755252.
In this run, P's claimed output(s) are intentionally false, and P will try to get away with it.
V forms the multilinear extension W̃*_0 of the claimed outputs.
If P's claims are correct, then W̃*_0 = W̃_0 (multilinear extensions are unique); otherwise W̃*_0 ≠ W̃_0.
Here s_0 = 0 (a single output gate), so ρ_0 := () and the point-claim is simply the output claim itself.
V computes α_0 := W̃*_0(ρ_0) = 627755252. The claim to be verified is now a single point-claim:
W̃_0(ρ_0) = α_0 = 627755252.
Since the claimed output is false and s_0 = 0, the point-claim is false with certainty: α_0 ≠ W̃_0(ρ_0).
==========================
GKR LAYER 0 → 1: SUM-CHECK
==========================
At the start of this layer, V holds ρ_0 = () and the carried claim α_0 = 627755252 (the claim being that W̃_0(ρ_0) = α_0).
By Thaler's identity,
W̃_0(ρ_0) = sum g(x_0, y_0) over (x_0, y_0) in {0,1}^2,
where
g(x_0, y_0) := add̃_0(ρ_0, x_0, y_0)·[W̃_1(x_0) + W̃_1(y_0)] + mult̃_0(ρ_0, x_0, y_0)·[W̃_1(x_0)·W̃_1(y_0)].
V can evaluate add̃_0 and mult̃_0 anywhere (the wiring is public), but NOT W̃_1, so V cannot evaluate g pointwise. So we run the sum-check protocol on g, with claimed sum H* := α_0 = 627755252, deferring the evaluation of g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 2]. (Each variable has degree ≤ 1 in the wiring MLE and ≤ 1 in W̃_1, hence degree ≤ 2 in g.)
We display g for the reader. In the protocol, V cannot compute g (it involves W̃_1):
g(x_0, y_0) = x_0**2*y_0 + x_0*y_0**2 + 2147483634*x_0*y_0 + 2147483646*y_0**2 + 12*y_0.
The carried claim is false: in fact W̃_0(ρ_0) = 11 ≠ 627755252 = α_0. To survive this sum-check, P is forced to forge round polynomials.
Let
g_0(x_0) := sum g(x_0, b_1) over (b_1) in {0,1}^1
P claims that g_0(x_0) = g*_0(x_0), where
g*_0(x_0) = 2*x_0**2 + 627755228*x_0 + 11.
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* = 627755252. V proceeds to compute:
g*_0(0) + g*_0(1) = 627755252
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(2147483647); here r_0 = 1827936545.
Let
g_1(y_0) := g(1827936545, y_0)
P claims that g_1(y_0) = g*_1(y_0), where
g*_1(y_0) = 1827936545*y_0**2 + 1899044856*y_0.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(1827936545) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 2 ≤ deg_1(g) = 2.
g*_0(1827936545) = 1579497754
g*_1(0) + g*_1(1) = 1579497754
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(2147483647); here r_1 = 1746020925.
Unlike in the standalone sum-check protocol, V does not now evaluate g(r_x, r_y): g involves W̃_1, which V does not know. The transcript's terminal claim is
γ := g*_1(r_1) = 775861556,
the claim being that γ = g(r_x, r_y), where r_x = (1827936545) and r_y = (1746020925).
V computes the (public) wiring values at this point:
A = add̃_0(ρ_0, r_x, r_y) = 1625356461
M = mult̃_0(ρ_0, r_x, r_y) = 0
Unpacking the definition of g, the claim γ = g(r_x, r_y) says exactly that
γ = A·[W̃_1(r_x) + W̃_1(r_y)] + M·[W̃_1(r_x)·W̃_1(r_y)] (the 'bridging equation').
V cannot check the bridging equation alone: it involves W̃_1(r_x) and W̃_1(r_y), which V cannot compute. So P supplies claimed values
z*_x (the claim: z*_x = W̃_1(r_x)) and z*_y (the claim: z*_y = W̃_1(r_y)).
The true endpoint values fail the bridging equation (γ is a surviving lie), so P keeps z*_x true and forges z*_y, choosing a pair consistent with γ.
P sends z*_x = 319547108 and z*_y = 2003375097.
V checks the bridging equation γ = A·(z*_x + z*_y) + M·z*_x·z*_y:
A·(z*_x + z*_y) + M·z*_x·z*_y = 775861556
V sees that P's claims so far are consistent.
Note: this check spends none of V's randomness. A and M are public and already fixed, so a P whose γ is false can always solve the bridging equation for forged endpoints (unless A = M = 0, when a false γ is caught outright). Consistency here is not evidence of honesty; the soundness budget lives entirely in the random challenges (ρ_0, the round challenges, and each fold challenge).
We now hold TWO claims about W̃_1 (at r_x and at r_y). To avoid the number of claims doubling at every layer, V folds them into ONE, as follows.
Let ℓ(t) := (1 - t)·r_x + t·r_y (the line through r_x = ℓ(0) and r_y = ℓ(1)), and let q_1(t) := W̃_1(ℓ(t)), a univariate polynomial of degree ≤ s_1 = 1.
P supplies a polynomial q*_1 (the claim: q*_1 = q_1). V checks that
(a) deg(q*_1) ≤ 1, and (b) q*_1(0) = z*_x and q*_1(1) = z*_y.
P forges q*_1 to match the claimed endpoints, planting as many agreement points with the true q_1 as the degree bound allows; the roots of q*_1 - q_1 are: 0.
The probability of V sampling one of these roots as τ_1 is 1/2147483647 = 0.0000000005.
In general, by Schwartz-Zippel, this probability cannot exceed s_1/#F = 1/2147483647 = 0.0000000005.
P claims that q_1(t) = q*_1(t), where
q*_1(t) = 1683827989*t + 319547108.
V checks the degree bound: deg(q*_1) = 1 ≤ s_1 = 1.
q*_1(0) = 319547108 (should be z*_x = 319547108)
q*_1(1) = 2003375097 (should be z*_y = 2003375097)
V sees that P's claims so far are consistent.
V samples an element uniformly at random from GF(2147483647); here τ_1 = 1385221882.
V sets ρ_1 := ℓ(τ_1) = (1856967517) and carries the single claim
α_1 := q*_1(τ_1) = 1725828964
(the claim being that α_1 = W̃_1(ρ_1)). The protocol proceeds to the next layer.
==========================
GKR LAYER 1 → 2: SUM-CHECK
==========================
At the start of this layer, V holds ρ_1 = (1856967517) and the carried claim α_1 = 1725828964 (the claim being that W̃_1(ρ_1) = α_1).
By Thaler's identity,
W̃_1(ρ_1) = sum g(x_0, x_1, y_0, y_1) over (x_0, x_1, y_0, y_1) in {0,1}^4,
where
g(x_0, x_1, y_0, y_1) := add̃_1(ρ_1, x_0, x_1, y_0, y_1)·[W̃_2(x_0, x_1) + W̃_2(y_0, y_1)] + mult̃_1(ρ_1, x_0, x_1, y_0, y_1)·[W̃_2(x_0, x_1)·W̃_2(y_0, y_1)].
V can evaluate add̃_1 and mult̃_1 anywhere (the wiring is public), but NOT W̃_2, so V cannot evaluate g pointwise. So we run the sum-check protocol on g, with claimed sum H* := α_1 = 1725828964, deferring the evaluation of g.
For soundness, V relies on degree bounds per variable (this is public information): [2, 2, 2, 2]. (Each variable has degree ≤ 1 in the wiring MLE and ≤ 1 in W̃_2, hence degree ≤ 2 in g.)
We display g for the reader. In the protocol, V cannot compute g (it involves W̃_2):
g(x_0, x_1, y_0, y_1) = 985419123*x_0**2*x_1**2*y_0**2*y_1**2 + 581032262*x_0**2*x_1**2*y_0**2*y_1 + 581032262*x_0**2*x_1**2*y_0*y_1**2 + 581032264*x_0**2*x_1**2*y_0*y_1 + 581032262*x_0**2*x_1**2*y_1**2 + 404386861*x_0**2*x_1**2*y_1 + 1743096786*x_0**2*x_1*y_0**2*y_1**2 + 1275935254*x_0**2*x_1*y_0**2*y_1 + 1275935254*x_0**2*x_1*y_0*y_1**2 + 1275935251*x_0**2*x_1*y_0*y_1 + 1275935254*x_0**2*x_1*y_1**2 + 467161532*x_0**2*x_1*y_1 + 1566451385*x_0**2*y_0**2*y_1**2 + 290516131*x_0**2*y_0**2*y_1 + 290516131*x_0**2*y_0*y_1**2 + 290516132*x_0**2*y_0*y_1 + 290516131*x_0**2*y_1**2 + 1275935254*x_0**2*y_1 + 581032262*x_0*x_1**2*y_0**2*y_1**2 + 1856967516*x_0*x_1**2*y_0**2*y_1 + 1856967516*x_0*x_1**2*y_0*y_1**2 + 1275935255*x_0*x_1**2*y_0*y_1 + 1856967516*x_0*x_1**2*y_1**2 + 871548393*x_0*x_1**2*y_1 + 2*x_0*x_1*y_0**2*y_1**2 ... (truncated).
The carried claim is false: in fact W̃_1(ρ_1) = 290516136 ≠ 1725828964 = α_1. To survive this sum-check, P is forced to forge round polynomials.
Let
g_0(x_0) := sum g(x_0, b_1, b_2, b_3) over (b_1, b_2, b_3) in {0,1}^3
P claims that g_0(x_0) = g*_0(x_0), where
g*_0(x_0) = 1275935256*x_0**2 + 1258667430*x_0 + 1743096786.
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* = 1725828964. V proceeds to compute:
g*_0(0) + g*_0(1) = 1725828964
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(2147483647); here r_0 = 1361344000.
Let
g_1(x_1) := sum g(1361344000, x_1, b_2, b_3) over (b_2, b_3) in {0,1}^2
P claims that g_1(x_1) = g*_1(x_1), where
g*_1(x_1) = 1865430163*x_1**2 + 2059951157*x_1 + 23428988.
If P's last two claims are true, then deg(g*_1) ≤ deg_1(g) and g*_0(1361344000) = g*_1(0) + g*_1(1).
V checks the degree bound: deg(g*_1) = 2 ≤ deg_1(g) = 2.
g*_0(1361344000) = 1824755649
g*_1(0) + g*_1(1) = 1824755649
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(2147483647); here r_1 = 1988579991.
Let
g_2(y_0) := sum g(1361344000, 1988579991, y_0, b_3) over (b_3) in {0,1}^1
P claims that g_2(y_0) = g*_2(y_0), where
g*_2(y_0) = 1338236208*y_0**2 + 1300921277*y_0 + 860839947.
If P's last two claims are true, then deg(g*_2) ≤ deg_2(g) and g*_1(1988579991) = g*_2(0) + g*_2(1).
V checks the degree bound: deg(g*_2) = 2 ≤ deg_2(g) = 2.
g*_1(1988579991) = 65870085
g*_2(0) + g*_2(1) = 65870085
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(2147483647); here r_2 = 470883011.
Let
g_3(y_1) := g(1361344000, 1988579991, 470883011, y_1)
P claims that g_3(y_1) = g*_3(y_1), where
g*_3(y_1) = 1521273513*y_1**2 + 1673034311*y_1.
If P's last two claims are true, then deg(g*_3) ≤ deg_3(g) and g*_2(470883011) = g*_3(0) + g*_3(1).
V checks the degree bound: deg(g*_3) = 2 ≤ deg_3(g) = 2.
g*_2(470883011) = 1046824177
g*_3(0) + g*_3(1) = 1046824177
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(2147483647); here r_3 = 1629507146.
Unlike in the standalone sum-check protocol, V does not now evaluate g(r_x, r_y): g involves W̃_2, which V does not know. The transcript's terminal claim is
γ := g*_3(r_3) = 1872139572,
the claim being that γ = g(r_x, r_y), where r_x = (1361344000, 1988579991) and r_y = (470883011, 1629507146).
V computes the (public) wiring values at this point:
A = add̃_1(ρ_1, r_x, r_y) = 1712801121
M = mult̃_1(ρ_1, r_x, r_y) = 1278784514
Unpacking the definition of g, the claim γ = g(r_x, r_y) says exactly that
γ = A·[W̃_2(r_x) + W̃_2(r_y)] + M·[W̃_2(r_x)·W̃_2(r_y)] (the 'bridging equation').
Layer 2 is the input layer. The inputs are public, so V can compute W̃_2 -- and hence both endpoint values -- directly, with no help from P:
z_x = W̃_2(r_x) = 1002120251
z_y = W̃_2(r_y) = 1936091212
Nothing is left for P to forge: both endpoints are V's own, and there is no fold after the input layer. This last check spends no randomness -- a lie that survived to here is caught with certainty.
V checks the bridging equation γ = A·(z_x + z_y) + M·z_x·z_y:
A·(z_x + z_y) + M·z_x·z_y = 754045340
P fails the final verification, and V REJECTS P's claimed output(s).
Interpretation: P can often keep each layer locally consistent, but the final evaluation against the public inputs ties the entire transcript to the true circuit and typically catches a lie.
True circuit output(s):
W_0() = 11.
Prover claimed:
W*_0() = 627755252.
Layer 0: the carried claim was false (α_0 = 627755252, true value 11); P forged round polynomials in the sum-check.
Layer 0 folding: P kept z*_x true and forged the other endpoint.
Layer 0 folding: P forged q*_1; roots of q*_1 - q_1: [0].
Layer 1: the carried claim was false (α_1 = 1725828964, true value 290516136); P forged round polynomials in the sum-check.
Layer 1: the final check against the public inputs failed.
Soundness accounting. P is exposed to V's randomness in exactly three places: the draw of ρ_0, each sum-check round challenge, and each fold challenge. Union-bounding those exposures (see the notes), a dishonest P's chance of acceptance over this circuit and field is at most
(0 + 4·(1 + 2) + (1))/2147483647 = 13/2147483647 = 0.0000000061
(the three terms in that order: the draw of ρ_0, two chances per round across every sum-check, and one fold per intermediate layer).
The bridging equations and the final check spend no randomness at all: a consistent liar passes them for free, and the whole budget above is what stands between V and a false claim.
This was a TRUE NEGATIVE: V rejected false claimed output(s).
Setup. Let C C C be a constant-input, strictly layered arithmetic circuit of depth d d d with fan-in two. For each layer i ∈ { 0 , … , d } i \in \{0,\ldots,d\} i ∈ { 0 , … , d } , let s i s_i s i denote the bit-length of gate labels at Layer i i i , and let
W i : { 0 , 1 } s i → F , W ~ i : F s i → F W_i : \{0,1\}^{s_i} \to \mathbb{F},
\qquad
\widetilde{W}_i : \mathbb{F}^{s_i} \to \mathbb{F} W i : { 0 , 1 } s i → F , W i : F s i → F be the gate-value function and its multilinear extension.
For each i ∈ { 0 , … , d − 1 } i \in \{0,\ldots,d-1\} i ∈ { 0 , … , d − 1 } , the circuit wiring is public and encoded by multilinear extensions
a d d ~ i , m u l t ~ i : F s i × F s i + 1 × F s i + 1 → F . \widetilde{\mathrm{add}}_i,\;\widetilde{\mathrm{mult}}_i :
\mathbb{F}^{s_i} \times \mathbb{F}^{s_{i+1}} \times \mathbb{F}^{s_{i+1}} \to \mathbb{F}. add i , mult i : F s i × F s i + 1 × F s i + 1 → F . Layer 0 (output layer).
P sends a polynomial function
W ~ 0 ∗ : F s 0 → F , \widetilde{W}_0^* : \mathbb{F}^{s_0} \to \mathbb{F}, W 0 ∗ : F s 0 → F , claimed to be the multilinear extension of the output gate-value function.
V samples
ρ 0 ← F s 0 \rho_0 \leftarrow \mathbb{F}^{s_0} ρ 0 ← F s 0 uniformly at random, and evaluates the claimed polynomial at that point.
Let
α 0 : = W ~ 0 ∗ ( ρ 0 ) ∈ F . \alpha_0 := \widetilde{W}_0^*(\rho_0) \in \mathbb{F}. α 0 := W 0 ∗ ( ρ 0 ) ∈ F . In an honest execution, W ~ 0 ∗ = ? W ~ 0 \widetilde{W}_0^* \overset{?}{=}\widetilde{W}_0 W 0 ∗ = ? W 0 , and hence α 0 = ? W ~ 0 ( ρ 0 ) \alpha_0\overset{?}{=}\widetilde{W}_0(\rho_0) α 0 = ? W 0 ( ρ 0 ) . The remainder of the protocol is devoted to justifying this value. (We place a question mark over an equality symbol to remind the reader that these equalities may not hold if P is dishonest.)
Layer i, 0 ≤ i ≤ d − 1 0 \le i \le d-1 0 ≤ i ≤ d − 1 . At the start of Layer i, V holds:
a point ρ i ∈ F s i \rho_i \in \mathbb{F}^{s_i} ρ i ∈ F s i ,
a scalar α i ∈ F \alpha_i \in \mathbb{F} α i ∈ F ,
which, in an honest execution, satisfy α i = ? W ~ i ( ρ i ) \alpha_i\overset{?}{=}\widetilde{W}_i(\rho_i) α i = ? W i ( ρ i ) . Define the polynomial function
g ( x , y ) : = a d d ~ i ( ρ i , x , y ) [ W ~ i + 1 ( x ) + W ~ i + 1 ( y ) ] + m u l t ~ i ( ρ i , x , y ) [ W ~ i + 1 ( x ) W ~ i + 1 ( y ) ] , g(\mathbf{x},\mathbf{y})
:=
\widetilde{\mathrm{add}}_i(\rho_i,\mathbf{x},\mathbf{y})
\big[\widetilde{W}_{i+1}(\mathbf{x})+\widetilde{W}_{i+1}(\mathbf{y})\big]
+
\widetilde{\mathrm{mult}}_i(\rho_i,\mathbf{x},\mathbf{y})
\big[\widetilde{W}_{i+1}(\mathbf{x})\widetilde{W}_{i+1}(\mathbf{y})\big], g ( x , y ) := add i ( ρ i , x , y ) [ W i + 1 ( x ) + W i + 1 ( y ) ] + mult i ( ρ i , x , y ) [ W i + 1 ( x ) W i + 1 ( y ) ] , a polynomial on F s i + 1 × F s i + 1 \mathbb{F}^{s_{i+1}} \times \mathbb{F}^{s_{i+1}} F s i + 1 × F s i + 1 . If P is honest, then by Thaler’s identity,
α i = ? ∑ ( x , y ) ∈ { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 g ( x , y ) , \alpha_i
\overset{?}{=}
\sum_{(\mathbf{x},\mathbf{y}) \in \{0,1\}^{s_{i+1}} \times \{0,1\}^{s_{i+1}}}
g(\mathbf{x},\mathbf{y}), α i = ? ( x , y ) ∈ { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 ∑ g ( x , y ) , and this equality must hold in order for the protocol to continue without rejection.
Sum-check at Layer i.
P and V run the sum-check protocol on the above sum.
Let m : = 2 s i + 1 m := 2s_{i+1} m := 2 s i + 1 be the number of Boolean variables.
V introduces random challenges
r 0 , … , r m − 1 ∈ F , r_0,\ldots,r_{m-1} \in \mathbb{F}, r 0 , … , r m − 1 ∈ F , grouped as
r x : = ( r 0 , … , r s i + 1 − 1 ) , r y : = ( r s i + 1 , … , r m − 1 ) . r_x := (r_0,\ldots,r_{s_{i+1}-1}),
\qquad
r_y := (r_{s_{i+1}},\ldots,r_{m-1}). r x := ( r 0 , … , r s i + 1 − 1 ) , r y := ( r s i + 1 , … , r m − 1 ) . P sends round polynomials g 0 ∗ , … , g m − 1 ∗ g_0^*,\ldots,g_{m-1}^* g 0 ∗ , … , g m − 1 ∗ .
V checks degree bounds and round-to-round consistency, with the initial consistency condition
α i = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . \alpha_i \overset{?}{=} g_0^*(0)+g_0^*(1). α i = ? g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) . In particular, V checks that each round polynomial satisfies
deg g j ∗ ≤ ? 2. \deg g_j^* \overset{?}{\le} 2. deg g j ∗ ≤ ? 2. This is a valid bound on the true round polynomials: each variable occurs to degree at most 1 in a d d ~ i ( ρ i , ⋅ , ⋅ ) \widetilde{\mathrm{add}}_i(\rho_i,\cdot,\cdot) add i ( ρ i , ⋅ , ⋅ ) and m u l t ~ i ( ρ i , ⋅ , ⋅ ) \widetilde{\mathrm{mult}}_i(\rho_i,\cdot,\cdot) mult i ( ρ i , ⋅ , ⋅ ) , and to degree at most 1 in W ~ i + 1 ( x ) \widetilde{W}_{i+1}(\mathbf{x}) W i + 1 ( x ) or W ~ i + 1 ( y ) \widetilde{W}_{i+1}(\mathbf{y}) W i + 1 ( y ) , so g g g has degree at most 2 in each of its 2 s i + 1 2s_{i+1} 2 s i + 1 variables. The tightness of this check is not bureaucracy: the degree bound V enforces reappears, round for round, in the soundness error below.
At the end of sum-check, correctness reduces to
g m − 1 ∗ ( r m − 1 ) = ? g ( r x , r y ) . g_{m-1}^*(r_{m-1}) \overset{?}{=} g(r_x,r_y). g m − 1 ∗ ( r m − 1 ) = ? g ( r x , r y ) . Bridging and folding. V cannot evaluate g ( r x , r y ) g(r_x,r_y) g ( r x , r y ) directly, since it depends on W ~ i + 1 \widetilde{W}_{i+1} W i + 1 . P therefore supplies two field elements
z x ∗ , z y ∗ ∈ F , z_x^*, \, z_y^* \in \mathbb{F}, z x ∗ , z y ∗ ∈ F , intended (in an honest execution) to equal
W ~ i + 1 ( r x ) , W ~ i + 1 ( r y ) . \widetilde{W}_{i+1}(r_x), \, \widetilde{W}_{i+1}(r_y). W i + 1 ( r x ) , W i + 1 ( r y ) . Using only public data, V checks
g m − 1 ∗ ( r m − 1 ) = ? a d d ~ i ( ρ i , r x , r y ) [ z x ∗ + z y ∗ ] + m u l t ~ i ( ρ i , r x , r y ) [ z x ∗ z y ∗ ] . g_{m-1}^*(r_{m-1}) \overset{?}{=} \widetilde{\mathrm{add}}_i(\rho_i,r_x,r_y)\big[z_x^*+z_y^*\big]
+
\widetilde{\mathrm{mult}}_i(\rho_i,r_x,r_y)\big[z_x^*z_y^*\big]. g m − 1 ∗ ( r m − 1 ) = ? add i ( ρ i , r x , r y ) [ z x ∗ + z y ∗ ] + mult i ( ρ i , r x , r y ) [ z x ∗ z y ∗ ] . (V computes both sides themself.) If this check fails, V rejects.
Assuming it passes, define the affine line
ℓ i + 1 : F → F s i + 1 , ℓ i + 1 ( t ) : = ( 1 − t ) r x + t r y , \ell_{i+1} : \mathbb{F} \to \mathbb{F}^{s_{i + 1}}, \quad \ell_{i+1}(t) := (1-t)r_x + t r_y, ℓ i + 1 : F → F s i + 1 , ℓ i + 1 ( t ) := ( 1 − t ) r x + t r y , and the associated ground-truth univariate polynomial function
q i + 1 : F → F , q i + 1 ( t ) : = W ~ i + 1 ( ℓ i + 1 ( t ) ) . q_{i + 1} : \mathbb{F} \to \mathbb{F}, \quad q_{i+1}(t) := \widetilde{W}_{i+1}(\ell_{i+1}(t)). q i + 1 : F → F , q i + 1 ( t ) := W i + 1 ( ℓ i + 1 ( t )) . P sends a univariate polynomial q i + 1 ∗ q_{i+1}^* q i + 1 ∗ , purported to equal q i + 1 q_{i+1} q i + 1 . V checks:
deg q i + 1 ∗ ≤ ? s i + 1 \deg q_{i+1}^* \overset{?}{\le} s_{i+1} deg q i + 1 ∗ ≤ ? s i + 1 ,
q i + 1 ∗ ( 0 ) = ? z x ∗ q_{i+1}^*(0) \overset{?}{=} z_x^* q i + 1 ∗ ( 0 ) = ? z x ∗ and q i + 1 ∗ ( 1 ) = ? z y ∗ q_{i+1}^*(1) \overset{?}{=} z_y^* q i + 1 ∗ ( 1 ) = ? z y ∗ .
If these checks pass, V samples
τ i + 1 ← F \tau_{i+1} \leftarrow \mathbb{F} τ i + 1 ← F uniformly at random, and sets
ρ i + 1 : = ℓ i + 1 ( τ i + 1 ) , α i + 1 : = q i + 1 ∗ ( τ i + 1 ) . \rho_{i+1} := \ell_{i+1}(\tau_{i+1}),
\qquad
\alpha_{i+1} := q_{i+1}^*(\tau_{i+1}). ρ i + 1 := ℓ i + 1 ( τ i + 1 ) , α i + 1 := q i + 1 ∗ ( τ i + 1 ) . In an honest execution, α i + 1 = ? W ~ i + 1 ( ρ i + 1 ) \alpha_{i+1}\overset{?}{=}\widetilde{W}_{i+1}(\rho_{i+1}) α i + 1 = ? W i + 1 ( ρ i + 1 ) . The protocol then proceeds to Layer i + 1.
Final layer. At Layer d - 1, the same procedure is followed through the sum-check. There is no folding step: the child layer d d d consists of input gates, so W ~ d \widetilde{W}_d W d is fully determined by the public inputs, and V computes z x = W ~ d ( r x ) z_x = \widetilde{W}_d(r_x) z x = W d ( r x ) and z y = W ~ d ( r y ) z_y = \widetilde{W}_d(r_y) z y = W d ( r y ) directly. V then checks the bridging equation with these true values. If it holds, V accepts; otherwise, V rejects.
Completeness and soundness ¶ Completeness. If P is honest and V’s calculations are accurate, V accepts with probability 1.
Proof. An honest P sends W ~ 0 ∗ = W ~ 0 \widetilde{W}_0^* = \widetilde{W}_0 W 0 ∗ = W 0 , so α 0 = W ~ 0 ( ρ 0 ) \alpha_0 = \widetilde{W}_0(\rho_0) α 0 = W 0 ( ρ 0 ) . Suppose inductively that α i = W ~ i ( ρ i ) \alpha_i = \widetilde{W}_i(\rho_i) α i = W i ( ρ i ) at the start of Layer i i i . By Thaler’s identity, α i \alpha_i α i really is the sum of g g g over { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 \{0,1\}^{s_{i+1}} \times \{0,1\}^{s_{i+1}} { 0 , 1 } s i + 1 × { 0 , 1 } s i + 1 , so the honest round polynomials satisfy every degree bound and every consistency condition of the sum-check, and the terminal value is g m − 1 ( r m − 1 ) = g ( r x , r y ) g_{m-1}(r_{m-1}) = g(r_x, r_y) g m − 1 ( r m − 1 ) = g ( r x , r y ) . The honest endpoints z x ∗ = W ~ i + 1 ( r x ) z_x^* = \widetilde{W}_{i+1}(r_x) z x ∗ = W i + 1 ( r x ) and z y ∗ = W ~ i + 1 ( r y ) z_y^* = \widetilde{W}_{i+1}(r_y) z y ∗ = W i + 1 ( r y ) make the bridging check the definition of g ( r x , r y ) g(r_x,r_y) g ( r x , r y ) , hence an identity. The honest q i + 1 ∗ = q i + 1 = W ~ i + 1 ∘ ℓ i + 1 q_{i+1}^* = q_{i+1} = \widetilde{W}_{i+1} \circ \ell_{i+1} q i + 1 ∗ = q i + 1 = W i + 1 ∘ ℓ i + 1 has degree at most s i + 1 s_{i+1} s i + 1 (a multilinear polynomial composed with an affine line: each monomial ∏ k ∈ T ℓ i + 1 ( t ) k \prod_{k \, \in \, T} \ell_{i+1}(t)_k ∏ k ∈ T ℓ i + 1 ( t ) k has degree ∣ T ∣ ≤ s i + 1 |T| \le s_{i+1} ∣ T ∣ ≤ s i + 1 in t t t ) and matches both endpoints, so the folding checks pass and
α i + 1 = q i + 1 ( τ i + 1 ) = W ~ i + 1 ( ℓ i + 1 ( τ i + 1 ) ) = W ~ i + 1 ( ρ i + 1 ) , \alpha_{i+1} = q_{i+1}(\tau_{i+1}) = \widetilde{W}_{i+1}(\ell_{i+1}(\tau_{i+1})) = \widetilde{W}_{i+1}(\rho_{i+1}), α i + 1 = q i + 1 ( τ i + 1 ) = W i + 1 ( ℓ i + 1 ( τ i + 1 )) = W i + 1 ( ρ i + 1 ) , closing the induction. At the final layer, V evaluates z x , z y z_x, z_y z x , z y itself from the public inputs, and the bridging check is again an identity. Every check is an equality between correctly computed quantities, so V accepts.
Soundness. A dishonest P may claim incorrect output values and still pass. We now bound the probability of this event and locate exactly where it can occur. There are only three places in the whole protocol where P is exposed to V’s randomness: the choice of ρ 0 \rho_0 ρ 0 , the challenge r j r_j r j of each sum-check round, and the challenge τ i + 1 \tau_{i+1} τ i + 1 of each fold. Everything else (the bridging equations, the endpoint claims z x ∗ , z y ∗ z_x^*, z_y^* z x ∗ , z y ∗ , the boundary conditions on q i + 1 ∗ q_{i+1}^* q i + 1 ∗ ), P can, and a clever P will, satisfy identically , by lying consistently. The soundness error is the union bound over those exposures and nothing more.
Suppose P’s claimed outputs are not all correct, so that W ~ 0 ∗ ≠ W ~ 0 \widetilde{W}_0^* \ne \widetilde{W}_0 W 0 ∗ = W 0 as multilinear polynomials. (In our implementation, V receives the claimed output values and forms the multilinear extension itself, so W ~ 0 ∗ \widetilde{W}_0^* W 0 ∗ is multilinear by construction; if instead P sends a polynomial, V enforces multilinearity.) Then
Pr [ V accepts ] ≤ s 0 + ∑ i = 0 d − 1 2 ⋅ ( 2 s i + 1 ) + ∑ i = 0 d − 2 s i + 1 # F = s 0 + 4 ∑ i = 1 d s i + ∑ i = 1 d − 1 s i # F ≤ s 0 + 5 ∑ i = 1 d s i # F . \Pr[\text{V accepts}]
\;\le\;
\frac{s_0 \;+\; \displaystyle\sum_{i=0}^{d-1} 2 \cdot (2 s_{i+1}) \;+\; \sum_{i=0}^{d-2} s_{i+1}}{\#\mathbb{F}}
\;=\;
\frac{s_0 \;+\; 4\displaystyle\sum_{i=1}^{d} s_i \;+\; \sum_{i=1}^{d-1} s_i}{\#\mathbb{F}}
\;\le\;
\frac{s_0 + 5\displaystyle\sum_{i=1}^{d} s_i}{\#\mathbb{F}}. Pr [ V accepts ] ≤ # F s 0 + i = 0 ∑ d − 1 2 ⋅ ( 2 s i + 1 ) + i = 0 ∑ d − 2 s i + 1 = # F s 0 + 4 i = 1 ∑ d s i + i = 1 ∑ d − 1 s i ≤ # F s 0 + 5 i = 1 ∑ d s i . The three numerator terms are the three exposures: ρ 0 \rho_0 ρ 0 , then 2 s i + 1 2s_{i+1} 2 s i + 1 sum-check rounds per layer each carrying the enforced degree bound 2, then one fold of degree at most s i + 1 s_{i+1} s i + 1 per non-final layer. Writing S i = 2 s i S_i = 2^{s_i} S i = 2 s i for the width of Layer i i i and S = max i S i S = \max_i S_i S = max i S i ,
Pr [ V accepts ] = O ( d log S # F ) , \Pr[\text{V accepts}] \;=\; O\!\left(\frac{d \log S}{\#\mathbb{F}}\right), Pr [ V accepts ] = O ( # F d log S ) , the bound stated in 3 (p. 65). (More generally, if V enforces round-degree bounds B j ≥ deg j g B_j \ge \deg_j g B j ≥ deg j g , the middle term of (19) becomes ∑ i ∑ j B j \sum_i \sum_j B_j ∑ i ∑ j B j : the check V performs is the price V pays.)
Notation for the proof. Fix a layer i i i and drop the layer superscript. As in the sum-check notebook , the true round polynomials of the Layer i i i sum-check are
g j ( u ) : = ∑ b ∈ { 0 , 1 } m − 1 − j g ( r 0 , … , r j − 1 , u , b ) , 0 ≤ j ≤ m − 1 , \begin{align}
g_j(u) &:= \sum_{\mathbf{b} \, \in \, \{0,1\}^{m-1-j}} g(r_0,\ldots,r_{j-1},u,\mathbf{b}), \qquad 0 \le j \le m-1,
\end{align} g j ( u ) := b ∈ { 0 , 1 } m − 1 − j ∑ g ( r 0 , … , r j − 1 , u , b ) , 0 ≤ j ≤ m − 1 , so that
g 0 ( 0 ) + g 0 ( 1 ) = ∑ ( x , y ) g ( x , y ) = W ~ i ( ρ i ) (Thaler’s identity) , g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) , 1 ≤ j ≤ m − 1 , g m − 1 ( r m − 1 ) = g ( r x , r y ) , \begin{align}
g_0(0) + g_0(1) &= \sum_{(\mathbf{x},\mathbf{y})} g(\mathbf{x},\mathbf{y}) = \widetilde{W}_i(\rho_i) \quad \text{(Thaler's identity)}, \\
g_{j-1}(r_{j-1}) &= g_j(0) + g_j(1), \qquad 1 \le j \le m-1, \\
g_{m-1}(r_{m-1}) &= g(r_x, r_y),
\end{align} g 0 ( 0 ) + g 0 ( 1 ) g j − 1 ( r j − 1 ) g m − 1 ( r m − 1 ) = ( x , y ) ∑ g ( x , y ) = W i ( ρ i ) (Thaler’s identity) , = g j ( 0 ) + g j ( 1 ) , 1 ≤ j ≤ m − 1 , = g ( r x , r y ) , and deg g j ≤ deg j g ≤ 2 \deg g_j \le \deg_j g \le 2 deg g j ≤ deg j g ≤ 2 , as observed in the protocol description. We say the carried claim at Layer i i i is false if α i ≠ W ~ i ( ρ i ) \alpha_i \ne \widetilde{W}_i(\rho_i) α i = W i ( ρ i ) . P is of course free to send whatever it likes; the objects above are the honest ones, well-defined whether or not anyone computes them, and V’s checks are comparisons against P’s actual messages g 0 ∗ , … , g m − 1 ∗ , z x ∗ , z y ∗ , q i + 1 ∗ g_0^*, \ldots, g_{m-1}^*, z_x^*, z_y^*, q_{i+1}^* g 0 ∗ , … , g m − 1 ∗ , z x ∗ , z y ∗ , q i + 1 ∗ .
Two families of lucky events will carry the whole error budget:
L i , j : g j ∗ ≠ g j and g j ∗ ( r j ) = g j ( r j ) (round j of Layer i ’s sum-check) , M i : q i + 1 ∗ ≠ q i + 1 and q i + 1 ∗ ( τ i + 1 ) = q i + 1 ( τ i + 1 ) (the fold, 0 ≤ i ≤ d − 2 ) . \begin{align}
L_{i,j} &: \quad g_j^* \ne g_j \;\text{ and }\; g_j^*(r_j) = g_j(r_j) \qquad \text{(round $j$ of Layer $i$'s sum-check)}, \\
M_i &: \quad q_{i+1}^* \ne q_{i+1} \;\text{ and }\; q_{i+1}^*(\tau_{i+1}) = q_{i+1}(\tau_{i+1}) \qquad \text{(the fold, $0 \le i \le d-2$)}.
\end{align} L i , j M i : g j ∗ = g j and g j ∗ ( r j ) = g j ( r j ) (round j of Layer i ’s sum-check) , : q i + 1 ∗ = q i + 1 and q i + 1 ∗ ( τ i + 1 ) = q i + 1 ( τ i + 1 ) (the fold, 0 ≤ i ≤ d − 2) . Fix i ∈ { 0 , … , d − 1 } i \in \{0,\ldots,d-1\} i ∈ { 0 , … , d − 1 } and suppose the carried claim at Layer i i i is false. Then at least one of the following holds:
V rejects during Layer i i i ;
L i , j L_{i,j} L i , j occurs for some round j j j , or (i ≤ d − 2 i \le d-2 i ≤ d − 2 ) M i M_i M i occurs;
i ≤ d − 2 i \le d-2 i ≤ d − 2 and the carried claim at Layer i + 1 i+1 i + 1 is false.
Moreover, for i = d − 1 i = d-1 i = d − 1 the third alternative is empty: V rejects outright unless some L d − 1 , j L_{d-1,j} L d − 1 , j occurs.
Suppose V does not reject during Layer i i i and no L i , j L_{i,j} L i , j occurs; we show the lie must survive intact to the next layer (or be caught at the final one).
The sum-check. We claim g j ∗ ≠ g j g_j^* \ne g_j g j ∗ = g j and g j ∗ ( r j ) ≠ g j ( r j ) g_j^*(r_j) \ne g_j(r_j) g j ∗ ( r j ) = g j ( r j ) for every j j j , by induction. For j = 0 j = 0 j = 0 : V’s initial consistency check gives α i = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) \alpha_i = g_0^*(0) + g_0^*(1) α i = g 0 ∗ ( 0 ) + g 0 ∗ ( 1 ) ; if g 0 ∗ = g 0 g_0^* = g_0 g 0 ∗ = g 0 , then α i = g 0 ( 0 ) + g 0 ( 1 ) = W ~ i ( ρ i ) \alpha_i = g_0(0) + g_0(1) = \widetilde{W}_i(\rho_i) α i = g 0 ( 0 ) + g 0 ( 1 ) = W i ( ρ i ) , contradicting the false carried claim; so g 0 ∗ ≠ g 0 g_0^* \ne g_0 g 0 ∗ = g 0 , and since L i , 0 L_{i,0} L i , 0 does not occur, 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 ) . For j ≥ 1 j \ge 1 j ≥ 1 : the round-j j j consistency check and the inductive hypothesis give
g j ∗ ( 0 ) + g j ∗ ( 1 ) = g j − 1 ∗ ( r j − 1 ) ≠ g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) , g_j^*(0) + g_j^*(1) = g_{j-1}^*(r_{j-1}) \ne g_{j-1}(r_{j-1}) = g_j(0) + g_j(1), g j ∗ ( 0 ) + g j ∗ ( 1 ) = g j − 1 ∗ ( r j − 1 ) = g j − 1 ( r j − 1 ) = g j ( 0 ) + g j ( 1 ) , so g j ∗ ≠ g j g_j^* \ne g_j g j ∗ = g j , and since L i , j L_{i,j} L i , j does not occur, g j ∗ ( r j ) ≠ g j ( r j ) g_j^*(r_j) \ne g_j(r_j) g j ∗ ( r j ) = g j ( r j ) . In particular, writing γ ∗ : = g m − 1 ∗ ( r m − 1 ) \gamma^* := g_{m-1}^*(r_{m-1}) γ ∗ := g m − 1 ∗ ( r m − 1 ) for the terminal value,
γ ∗ ≠ g m − 1 ( r m − 1 ) = g ( r x , r y ) . \gamma^* \;\ne\; g_{m-1}(r_{m-1}) \;=\; g(r_x, r_y). γ ∗ = g m − 1 ( r m − 1 ) = g ( r x , r y ) . Note what did not happen here: unlike in the standalone protocol, V performs no oracle check at the end of the sum-check, so nothing yet forces a rejection: the lie survives to the terminal claim.
The bridge. Write A : = a d d ~ i ( ρ i , r x , r y ) A := \widetilde{\mathrm{add}}_i(\rho_i, r_x, r_y) A := add i ( ρ i , r x , r y ) , M : = m u l t ~ i ( ρ i , r x , r y ) M := \widetilde{\mathrm{mult}}_i(\rho_i, r_x, r_y) M := mult i ( ρ i , r x , r y ) , and let z x : = W ~ i + 1 ( r x ) z_x := \widetilde{W}_{i+1}(r_x) z x := W i + 1 ( r x ) , z y : = W ~ i + 1 ( r y ) z_y := \widetilde{W}_{i+1}(r_y) z y := W i + 1 ( r y ) be the true endpoint values. By the definition of g g g ,
g ( r x , r y ) = A [ z x + z y ] + M [ z x z y ] . g(r_x, r_y) = A\,[z_x + z_y] + M\,[z_x z_y]. g ( r x , r y ) = A [ z x + z y ] + M [ z x z y ] . V’s bridging check is γ ∗ = ? A [ z x ∗ + z y ∗ ] + M [ z x ∗ z y ∗ ] \gamma^* \overset{?}{=} A[z_x^* + z_y^*] + M[z_x^* z_y^*] γ ∗ = ? A [ z x ∗ + z y ∗ ] + M [ z x ∗ z y ∗ ] . If P sent the true endpoints, the right-hand side would equal g ( r x , r y ) ≠ γ ∗ g(r_x,r_y) \ne \gamma^* g ( r x , r y ) = γ ∗ and V would reject. Hence, if V does not reject at the bridge,
( z x ∗ , z y ∗ ) ≠ ( z x , z y ) . (z_x^*, z_y^*) \ne (z_x, z_y). ( z x ∗ , z y ∗ ) = ( z x , z y ) . The fold (i ≤ d − 2 i \le d-2 i ≤ d − 2 ). The true polynomial q i + 1 = W ~ i + 1 ∘ ℓ i + 1 q_{i+1} = \widetilde{W}_{i+1} \circ \ell_{i+1} q i + 1 = W i + 1 ∘ ℓ i + 1 satisfies q i + 1 ( 0 ) = z x q_{i+1}(0) = z_x q i + 1 ( 0 ) = z x and q i + 1 ( 1 ) = z y q_{i+1}(1) = z_y q i + 1 ( 1 ) = z y , while V’s boundary checks force q i + 1 ∗ ( 0 ) = z x ∗ q_{i+1}^*(0) = z_x^* q i + 1 ∗ ( 0 ) = z x ∗ and q i + 1 ∗ ( 1 ) = z y ∗ q_{i+1}^*(1) = z_y^* q i + 1 ∗ ( 1 ) = z y ∗ . Since the endpoint pairs differ, q i + 1 ∗ ≠ q i + 1 q_{i+1}^* \ne q_{i+1} q i + 1 ∗ = q i + 1 . If M i M_i M i does not occur, then
α i + 1 = q i + 1 ∗ ( τ i + 1 ) ≠ q i + 1 ( τ i + 1 ) = W ~ i + 1 ( ℓ i + 1 ( τ i + 1 ) ) = W ~ i + 1 ( ρ i + 1 ) : \alpha_{i+1} = q_{i+1}^*(\tau_{i+1}) \;\ne\; q_{i+1}(\tau_{i+1}) = \widetilde{W}_{i+1}(\ell_{i+1}(\tau_{i+1})) = \widetilde{W}_{i+1}(\rho_{i+1}): α i + 1 = q i + 1 ∗ ( τ i + 1 ) = q i + 1 ( τ i + 1 ) = W i + 1 ( ℓ i + 1 ( τ i + 1 )) = W i + 1 ( ρ i + 1 ) : the carried claim at Layer i + 1 i+1 i + 1 is false, which is alternative 3.
The final layer (i = d − 1 i = d-1 i = d − 1 ). Here V computes z x = W ~ d ( r x ) z_x = \widetilde{W}_d(r_x) z x = W d ( r x ) and z y = W ~ d ( r y ) z_y = \widetilde{W}_d(r_y) z y = W d ( r y ) itself from the public inputs, and its last check is
γ ∗ = ? A [ z x + z y ] + M [ z x z y ] = g ( r x , r y ) ≠ γ ∗ , \gamma^* \overset{?}{=} A[z_x + z_y] + M[z_x z_y] = g(r_x, r_y) \ne \gamma^*, γ ∗ = ? A [ z x + z y ] + M [ z x z y ] = g ( r x , r y ) = γ ∗ , so V rejects.
First, the output claim itself. Since W ~ 0 ∗ ≠ W ~ 0 \widetilde{W}_0^* \ne \widetilde{W}_0 W 0 ∗ = W 0 and both are multilinear in s 0 s_0 s 0 variables, their difference is a nonzero polynomial of total degree at most s 0 s_0 s 0 , fixed before ρ 0 \rho_0 ρ 0 is sampled. Let E 0 E_0 E 0 be the event W ~ 0 ∗ ( ρ 0 ) = W ~ 0 ( ρ 0 ) \widetilde{W}_0^*(\rho_0) = \widetilde{W}_0(\rho_0) W 0 ∗ ( ρ 0 ) = W 0 ( ρ 0 ) . By the Schwartz-Zippel lemma (see the multilinear-extensions notebook ),
Pr [ E 0 ] ≤ s 0 # F . \Pr[E_0] \le \frac{s_0}{\#\mathbb{F}}. Pr [ E 0 ] ≤ # F s 0 . (When s 0 = 0 s_0 = 0 s 0 = 0 , as in our worked example, the difference is a nonzero constant and Pr [ E 0 ] = 0 \Pr[E_0] = 0 Pr [ E 0 ] = 0 : a false output claim about a single output gate cannot get lucky at Layer 0.)
If E 0 E_0 E 0 does not occur, then α 0 = W ~ 0 ∗ ( ρ 0 ) ≠ W ~ 0 ( ρ 0 ) \alpha_0 = \widetilde{W}_0^*(\rho_0) \ne \widetilde{W}_0(\rho_0) α 0 = W 0 ∗ ( ρ 0 ) = W 0 ( ρ 0 ) : the carried claim at Layer 0 is false. Applying the lemma at Layers 0 , 1 , … , d − 1 0, 1, \ldots, d-1 0 , 1 , … , d − 1 in turn: as long as no lucky event occurs and V does not reject, the false carried claim propagates, and at Layer d − 1 d-1 d − 1 the lemma leaves no third alternative. Therefore
{ V accepts } ⊆ E 0 ∪ ⋃ i , j L i , j ∪ ⋃ i ≤ d − 2 M i . \{\text{V accepts}\} \;\subseteq\; E_0 \;\cup\; \bigcup_{i,\,j} L_{i,\,j} \;\cup\; \bigcup_{i \,\le\, d-2} M_i. { V accepts } ⊆ E 0 ∪ i , j ⋃ L i , j ∪ i ≤ d − 2 ⋃ M i . Now the probabilities, exactly as in the sum-check analysis. For L i , j L_{i,j} L i , j : the polynomials g j ∗ g_j^* g j ∗ and g j g_j g j are fixed after the transcript ( ρ i ; r 0 , … , r j − 1 ) (\rho_i; r_0, \ldots, r_{j-1}) ( ρ i ; r 0 , … , r j − 1 ) but before r j r_j r j is chosen, so they are independent of r j r_j r j ; V’s degree check bounds deg g j ∗ ≤ 2 \deg g_j^* \le 2 deg g j ∗ ≤ 2 , and deg g j ≤ 2 \deg g_j \le 2 deg g j ≤ 2 ; their difference is a nonzero univariate polynomial of degree at most 2, and r j r_j r j is uniform in F \mathbb{F} F , so by the univariate root bound
Pr [ L i , j ] ≤ 2 # F . \Pr[L_{i,\,j}] \le \frac{2}{\#\mathbb{F}}. Pr [ L i , j ] ≤ # F 2 . For M i M_i M i : the polynomials q i + 1 ∗ q_{i+1}^* q i + 1 ∗ and q i + 1 q_{i+1} q i + 1 are fixed before τ i + 1 \tau_{i+1} τ i + 1 is chosen; V’s degree check bounds deg q i + 1 ∗ ≤ s i + 1 \deg q_{i+1}^* \le s_{i+1} deg q i + 1 ∗ ≤ s i + 1 , and deg q i + 1 ≤ s i + 1 \deg q_{i+1} \le s_{i+1} deg q i + 1 ≤ s i + 1 ; their difference is nonzero of degree at most s i + 1 s_{i+1} s i + 1 , and τ i + 1 \tau_{i+1} τ i + 1 is uniform, so
Pr [ M i ] ≤ s i + 1 # F . \Pr[M_i] \le \frac{s_{i+1}}{\#\mathbb{F}}. Pr [ M i ] ≤ # F s i + 1 . There are 2 s i + 1 2s_{i+1} 2 s i + 1 rounds at Layer i i i for 0 ≤ i ≤ d − 1 0 \le i \le d-1 0 ≤ i ≤ d − 1 , and one fold for each 0 ≤ i ≤ d − 2 0 \le i \le d-2 0 ≤ i ≤ d − 2 . The union bound gives (19) , and (20) follows since s i = log 2 S i ≤ log 2 S s_i = \log_2 S_i \le \log_2 S s i = log 2 S i ≤ log 2 S .
Two features of the proof deserve emphasis, because both are visible in the implementation’s narration (run gkr_example(dishonest=True) and read the invisible-to-V blocks and the ground-truth ledger).
The deterministic parts really are deterministic. The bridging equation contributes nothing to the error budget: a P whose lie survived the sum-check simply solves γ ∗ = A [ z x ∗ + z y ∗ ] + M [ z x ∗ z y ∗ ] \gamma^* = A[z_x^* + z_y^*] + M[z_x^* z_y^*] γ ∗ = A [ z x ∗ + z y ∗ ] + M [ z x ∗ z y ∗ ] for forged endpoints (one equation, two unknowns, solvable whenever ( A , M ) ≠ ( 0 , 0 ) (A, M) \ne (0,0) ( A , M ) = ( 0 , 0 ) ), and threads any degree-s i + 1 s_{i+1} s i + 1 polynomial through the two forged boundary values. (In the degenerate case A = M = 0 A = M = 0 A = M = 0 , the right-hand side is 0 for every choice of endpoints, but then g ( r x , r y ) = 0 ≠ γ ∗ g(r_x,r_y) = 0 \ne \gamma^* g ( r x , r y ) = 0 = γ ∗ too, and V rejects with certainty: the degenerate bridge only ever helps V.) This is the precise sense in which a dishonest P can “lie consistently” from one sum-check to the next: between the random challenges, nothing stops it.
Each lucky event fully converts. Conversely, the moment any L i , j L_{i,\,j} L i , j or M i M_i M i occurs, P can revert to honesty (send the true polynomials, true endpoints, and true folds from that point on), and V accepts with certainty, exactly as in the standalone sum-check protocol (the implementation calls this laundering the lie). So the union in the proof is over events each of which suffices alone. Moreover P can typically realize each event’s maximal probability: to plant two agreement points a , b a, b a , b in round j j j , P sends g j ∗ = g j + c ( X − a ) ( X − b ) g_j^* = g_j + c\,(X-a)(X-b) g j ∗ = g j + c ( X − a ) ( X − b ) and uses the one free scalar c c c to satisfy the consistency condition, which is possible whenever 2 a b − a − b + 1 ≠ 0 2ab - a - b + 1 \ne 0 2 ab − a − b + 1 = 0 . The implementation’s cheating prover does exactly this (the advice blocks report the roots of g j ∗ − g j g_j^* - g_j g j ∗ − g j ), which is why the measured false-positive rates below sit so close to the bound: the worst-case prover the theorem imagines is, almost always, the prover we actually implemented.
For the worked example ( 3 × 2 ) + ( 4 + 1 ) (3 \times 2) + (4 + 1) ( 3 × 2 ) + ( 4 + 1 ) we have d = 2 d = 2 d = 2 and ( s 0 , s 1 , s 2 ) = ( 0 , 1 , 2 ) (s_0, s_1, s_2) = (0, 1, 2) ( s 0 , s 1 , s 2 ) = ( 0 , 1 , 2 ) , so (19) reads
Pr [ V accepts a false output claim ] ≤ 0 + 4 ( 1 + 2 ) + 1 # F = 13 # F , \Pr[\text{V accepts a false output claim}] \le \frac{0 + 4(1 + 2) + 1}{\#\mathbb{F}} = \frac{13}{\#\mathbb{F}}, Pr [ V accepts a false output claim ] ≤ # F 0 + 4 ( 1 + 2 ) + 1 = # F 13 , thirteen chances: none at ρ 0 \rho_0 ρ 0 , two per sum-check round (2 rounds at Layer 0, 4 at Layer 1), and one at the single fold. For the two-output circuit ( 1 + 2 ) ( 3 + 4 ) ; ( 5 + 6 ) + ( 7 × 8 ) (1+2)(3+4);\ (5+6)+(7 \times 8) ( 1 + 2 ) ( 3 + 4 ) ; ( 5 + 6 ) + ( 7 × 8 ) , with ( s 0 , s 1 , s 2 ) = ( 1 , 2 , 3 ) (s_0, s_1, s_2) = (1, 2, 3) ( s 0 , s 1 , s 2 ) = ( 1 , 2 , 3 ) : 1 + 4 ( 2 + 3 ) + 2 = 23 1 + 4(2+3) + 2 = 23 1 + 4 ( 2 + 3 ) + 2 = 23 chances.
Over F = G F ( 101 ) \mathbb{F} = \mathrm{GF}(101) F = GF ( 101 ) , deliberately tiny, the bounds are 13 / 101 ≈ 0.129 13/101 \approx 0.129 13/101 ≈ 0.129 and 23 / 101 ≈ 0.228 23/101 \approx 0.228 23/101 ≈ 0.228 , and Monte Carlo agrees (the cell below reproduces the first line):
circuit union bound measured false-positive rate ( 3 × 2 ) + ( 4 + 1 ) (3 \times 2)+(4+1) ( 3 × 2 ) + ( 4 + 1 ) 13 / 101 ≈ 0.129 13/101 \approx 0.129 13/101 ≈ 0.129 0.125 ± 0.032 0.125 \pm 0.032 0.125 ± 0.032 (400 runs)( 1 + 2 ) ( 3 + 4 ) ; ( 5 + 6 ) + ( 7 × 8 ) (1+2)(3+4);\ (5+6)+(7 \times 8) ( 1 + 2 ) ( 3 + 4 ) ; ( 5 + 6 ) + ( 7 × 8 ) 23 / 101 ≈ 0.228 23/101 \approx 0.228 23/101 ≈ 0.228 0.215 ± 0.040 0.215 \pm 0.040 0.215 ± 0.040 (400 runs)
Two lessons. First, the 1 / # F 1/\#\mathbb{F} 1/# F intuition from a single Schwartz-Zippel event misleads badly here: a GKR run offers many independent chances to be fooled, and the soundness error grows linearly with circuit size (d log S d \log S d log S chances, roughly). Second, this is precisely why GKR wants a large field: over G F ( 2 31 − 1 ) \mathrm{GF}(2^{31}-1) GF ( 2 31 − 1 ) , the very same 23 chances amount to 23 / ( 2 31 − 1 ) ≈ 1.1 × 1 0 − 8 23/(2^{31}-1) \approx 1.1 \times 10^{-8} 23/ ( 2 31 − 1 ) ≈ 1.1 × 1 0 − 8 .
# Reproduce the first row of the table: the worked example over GF(101).
# A dishonest machine prover corrupts the output claim and plants maximal
# roots at every opportunity; we count how often V accepts. Takes ~10 s.
import random
from gkr.ac import ArithmeticCircuit
from gkr.protocol import Sink, RandomVerifier, run_gkr
from gkr.protocol.gkr_parties import GkrMachineProver
from gkr.utils.display import TerminalOutput
random.seed(2026)
quiet = TerminalOutput(enable_paging=False)
quiet.print = lambda *a, **k: None # discard the narration
ac = ArithmeticCircuit('(3*2) + (4 + 1)', prime=101)
N, accepted = 400, 0
for _ in range(N):
sink = Sink(lambda e: True)
prover = GkrMachineProver(ac, sink, secret_mode=False, dishonest_claim=True, out=quiet)
result = run_gkr(ac, prover=prover, verifier=RandomVerifier(ac.field, out=quiet),
sink=sink, out=quiet)
accepted += (result.status == "accept")
rate = accepted / N
half = 1.96 * (rate * (1 - rate) / N) ** 0.5
print(f"union bound: 13/101 = {13/101:.4f}")
print(f"measured: {accepted}/{N} = {rate:.4f} (+/- {half:.4f} at 95%)")union bound: 13/101 = 0.1287
measured: 50/400 = 0.1250 (+/- 0.0324 at 95%)
Costs ¶ We do not develop the cost analysis here. See 3 for a full account of the verifier’s and prover’s runtimes, the round complexity and communication cost, and 3 for the separate question of evaluating a d d ~ i \widetilde{\mathrm{add}}_i add i and m u l t ~ i \widetilde{\mathrm{mult}}_i mult i efficiently, which is the delicate term in V’s runtime and the reason the protocol is usually stated for circuits whose wiring has repeated structure. The techniques that bring P’s runtime down to O ( S log S ) O(S\log S) O ( S log S ) are due to 4 .
A note on this implementation. The code accompanying these notes makes no attempt at any of this. It constructs a d d ~ i \widetilde{\mathrm{add}}_i add i ,
m u l t ~ i \widetilde{\mathrm{mult}}_i mult i and W ~ i \widetilde{W}_i W i symbolically over the whole Boolean hypercube, which is exponential in the label lengths. The object here is to watch the protocol’s structure, not to run it at scale, but it is why the worked examples are small.
Goldwasser, S., Kalai, Y. T., & Rothblum, G. N. (2008). Delegating computation: Interactive proofs for muggles. Proceedings of the 40th Annual ACM Symposium on Theory of Computing (STOC) , 113–122. 10.1145/1374376.1374396 Goldwasser, S., Kalai, Y. T., & Rothblum, G. N. (2015). Delegating computation: Interactive proofs for muggles. Journal of the ACM , 62 (4), 1–64. 10.1145/2699436 Thaler, J. (2022). Proofs, Arguments, and Zero-Knowledge. Foundations and Trends in Privacy and Security , 4 (2–4), 117–660. 10.1561/3300000030 Cormode, G., Mitzenmacher, M., & Thaler, J. (2012). Practical verified computation with streaming interactive proofs. Proceedings of the 3rd Innovations in Theoretical Computer Science Conference (ITCS) , 90–112. 10.1145/2090236.2090245