Varun Thakore

Variants of KZG: Part II, Multilinear Commitments with PST

This is Part II of a five-part series on different variations of the KZG protocol. The original appeared on the ZK Security blog.


In Part I, we studied KZG commitments in the univariate setting, i.e., the prover wants to prove to a verifier that f^(u)=v\hat f(u)=v, where f^\hat f is a univariate polynomial. In this and the subsequent parts of the series, we will explore KZG-based polynomial commitments for multilinear polynomials. A multilinear polynomial is a multivariate polynomial with degree at most one in each of its variables.

The key question we want to study throughout the remainder of this series is:

Can we construct an opening argument for a multilinear polynomial f(X0,…,Xn−1)f(X_0,\ldots,X_{n-1}) at a point (u0,…,un−1)(u_0,\ldots,u_{n-1}), proving that f(u0,…,un−1)=vf(u_0,\ldots,u_{n-1})=v?

Such commitments can be used with a multilinear IOP, such as Spartan, to construct a SNARK. In this part, we will study the Papamanthou-Shi-Tamassia (PST) commitment scheme.

Notation. We continue to use the notation from Part I. Write X⃗=(X0,…,Xn−1)\vec{X}=(X_0,\ldots,X_{n-1}) and u⃗=(u0,…,un−1)\vec{u}=(u_0,\ldots,u_{n-1}). Univariate polynomials are denoted with a hat, while multilinear polynomials are denoted without a hat.

Before we dive into the construction, let us study a polynomial identity for the multilinear setting.

Multilinear Polynomial Identity#

In Part I, we looked at a polynomial identity in the univariate setting based on the factor theorem. If f^(u)=v\hat f(u)=v, then there exists a unique quotient polynomial:

q^(X)=f^(X)−vX−u. \hat q(X)=\frac{\hat f(X)-v}{X-u}.

The key idea was to check the identity f^(X)−v=(X−u)q^(X)\hat f(X)-v=(X-u)\hat q(X) at the randomly sampled hidden setup value. If the identity is false, then it holds at the random setup value only with small probability, by the Schwartz-Zippel Lemma. The verifier performs this check using the public parameters, the commitments to f^\hat f and q^\hat q, and bilinear pairings.

We want a similar identity in the multilinear setting. Let us specialize the variables in the reverse order Xn−1,Xn−2,…,X0X_{n-1},X_{n-2},\ldots,X_0. Consider the partial evaluation of f(X0,…,Xn−1)f(X_0,\ldots,X_{n-1}) obtained by setting Xn−1=un−1X_{n-1}=u_{n-1}:

fn−1(X0,…,Xn−2)=f(X0,…,Xn−2,un−1). f_{n-1}(X_0,\ldots,X_{n-2}) = f(X_0,\ldots,X_{n-2},u_{n-1}).

Now the difference

f(X0,…,Xn−1)−fn−1(X0,…,Xn−2)=f(X0,…,Xn−1)−f(X0,…,Xn−2,un−1) f(X_0,\ldots,X_{n-1})-f_{n-1}(X_0,\ldots,X_{n-2}) = f(X_0,\ldots,X_{n-1})-f(X_0,\ldots,X_{n-2},u_{n-1})

vanishes when Xn−1=un−1X_{n-1}=u_{n-1}. Thus, by the factor theorem for multivariate polynomials, it is divisible by (Xn−1−un−1)(X_{n-1}-u_{n-1}), and there exists a quotient qn−1q_{n-1} such that

qn−1(X0,…,Xn−2)=f(X0,…,Xn−1)−fn−1(X0,…,Xn−2)Xn−1−un−1. q_{n-1}(X_0,\ldots,X_{n-2}) = \frac{f(X_0,\ldots,X_{n-1})-f_{n-1}(X_0,\ldots,X_{n-2})} {X_{n-1}-u_{n-1}}.

Thus,

f(X0,…,Xn−1)−fn−1(X0,…,Xn−2)=(Xn−1−un−1)⋅qn−1(X0,…,Xn−2)(1) f(X_0,\ldots,X_{n-1})-f_{n-1}(X_0,\ldots,X_{n-2}) =(X_{n-1}-u_{n-1}) \cdot q_{n-1}(X_0,\ldots,X_{n-2}) \tag{1}

Next, consider the partial evaluation of fn−1(X0,…,Xn−2)f_{n-1}(X_0,\ldots,X_{n-2}),

fn−2(X0,…,Xn−3)=fn−1(X0,…,Xn−3,un−2), f_{n-2}(X_0,\ldots,X_{n-3}) = f_{n-1}(X_0,\ldots,X_{n-3},u_{n-2}),

obtained by setting Xn−2=un−2X_{n-2}=u_{n-2}. Applying the factor theorem again gives

fn−1(X0,…,Xn−2)−fn−2(X0,…,Xn−3)=(Xn−2−un−2)⋅qn−2(X0,…,Xn−3)(2) f_{n-1}(X_0,\ldots,X_{n-2})-f_{n-2}(X_0,\ldots,X_{n-3}) =(X_{n-2}-u_{n-2}) \cdot q_{n-2}(X_0,\ldots,X_{n-3}) \tag{2}

Adding the equations (1)(1) and (2)(2), we get

f(X0,…,Xn−1)−fn−2(X0,…,Xn−3)=(Xn−1−un−1)⋅qn−1(X0,…,Xn−2)+(Xn−2−un−2)⋅qn−2(X0,…,Xn−3). \begin{aligned} f(X_0,\ldots,X_{n-1})-f_{n-2}(X_0,\ldots,X_{n-3}) ={}&(X_{n-1}-u_{n-1}) \cdot q_{n-1}(X_0,\ldots,X_{n-2})\\ &+(X_{n-2}-u_{n-2}) \cdot q_{n-2}(X_0,\ldots,X_{n-3}). \end{aligned}

Continuing in the same way down to X0=u0X_0=u_0, we obtain the following identity:

f(X0,…,Xn−1)−f(u0,…,un−1)=∑k=0n−1(Xk−uk)⋅qk(X0,…,Xk−1). f(X_0,\ldots,X_{n-1})-f(u_0,\ldots,u_{n-1}) = \sum_{k=0}^{n-1}(X_k-u_k) \cdot q_k(X_0,\ldots,X_{k-1}).

Here, qkq_k depends only on the first kk variables, X0,…,Xk−1X_0,\ldots,X_{k-1}, and is multilinear in those variables, while q0q_0 is constant. For the fixed specialization order Xn−1,Xn−2,…,X0X_{n-1},X_{n-2},\ldots,X_0, these quotient polynomials are unique.

Thus, proving f(u0,…,un−1)=?vf(u_0,\ldots,u_{n-1})\stackrel{?}{=}v reduces to proving that there exist multilinear polynomials qkq_k satisfying the following identity:

f(X0,…,Xn−1)−v  =?  ∑k=0n−1(Xk−uk)⋅qk(X0,…,Xk−1). f(X_0,\ldots,X_{n-1}) - v \; \stackrel{?}{=} \; \sum_{k=0}^{n-1}(X_k-u_k) \cdot q_k(X_0,\ldots,X_{k-1}).

We will use this as the starting point for PST. With the basics aside, we will now look at the construction.

PST Commitment Scheme#

PST is a direct multivariate generalization of KZG. The original construction supports general multivariate polynomials, but we focus on its multilinear specialization, which is more common in practice.

We need to check the following identity:

f(X0,…,Xn−1)−v  =?  ∑k=0n−1(Xk−uk)qk(X0,…,Xk−1). f(X_0,\ldots,X_{n-1})-v \; \stackrel{?}{=} \; \sum_{k=0}^{n-1}(X_k-u_k)q_k(X_0,\ldots,X_{k-1}).

By the Schwartz-Zippel Lemma, if the above equation is not a valid polynomial identity, then it holds at a randomly chosen point only with small probability.

Thus, during setupsetup, we sample a random point τ⃗=(τ0,…,τn−1)\vec{\tau}=(\tau_0,\ldots,\tau_{n-1}) at which the above equation will be checked. The verifier performs this check using the public parameters, commitments to ff and the qkq_k, and bilinear pairings.

The algorithms for the construction are defined as follows.

  • setup(n)→ppsetup(n) \rightarrow pp

    • Sample τ0,…,τn−1∈Fp\tau_0,\ldots,\tau_{n-1}\in\mathbb{F}_p and let τ⃗=(τ0,…,τn−1)\vec{\tau}=(\tau_0,\ldots,\tau_{n-1}).
    • Compute the commitment key ckck containing encodings of all 2n2^n monomials of τ⃗\vec{\tau}: ck=({[∏i=0n−1τibi]1:b⃗∈{0,1}n}). ck=\left( \left\{\left[\prod_{i=0}^{n-1}\tau_i^{b_i}\right]_1: \vec{b}\in\{0,1\}^n\right\} \right).
    • Compute the verification key vkvk containing an encoding of each τi\tau_i: vk=([1]1,[1]2,[τ0]2,…,[τn−1]2). vk=\left( [1]_1,[1]_2,[\tau_0]_2,\ldots,[\tau_{n-1}]_2 \right).
    • Output pp=(ck,vk). pp=\left(ck, vk\right).
    • Discard τ⃗\vec{\tau}.
  • commit(pp,f)→comfcommit(pp,f) \rightarrow com_f

    • Write f(X⃗)=∑b⃗∈{0,1}nfb⃗∏i=0n−1Xibi. f(\vec{X})=\sum_{\vec{b}\in\{0,1\}^n}f_{\vec{b}}\prod_{i=0}^{n-1}X_i^{b_i}.
    • Compute comf=[f(τ⃗)]1=∑b⃗∈{0,1}nfb⃗[∏i=0n−1τibi]1. com_f=[f(\vec{\tau})]_1 =\sum_{\vec{b}\in\{0,1\}^n}f_{\vec{b}} \left[\prod_{i=0}^{n-1}\tau_i^{b_i}\right]_1.
  • open(P,V)→0/1open(\mathcal{P},\mathcal{V}) \rightarrow 0/1

    • P\mathcal{P} sends comfcom_f to V\mathcal{V}.
    • V\mathcal{V} samples u⃗=(u0,…,un−1)∈Fpn\vec{u}=(u_0,\ldots,u_{n-1})\in\mathbb{F}_p^n and requests an opening at u⃗\vec{u}.
    • P\mathcal{P} computes v=f(u⃗)v=f(\vec{u}) and quotient polynomials q0,…,qn−1q_0,\ldots,q_{n-1} satisfying f(X⃗)−v=∑k=0n−1(Xk−uk)qk(X0,…,Xk−1). f(\vec{X})-v=\sum_{k=0}^{n-1}(X_k-u_k)q_k(X_0,\ldots,X_{k-1}). P\mathcal{P} sends vv and πk=com⁡qk\pi_k=\operatorname{com}_{q_k} for every k=0,…,n−1k=0,\ldots,n-1.
    • V\mathcal{V} accepts if and only if e(comf−v[1]1,[1]2)=?∏k=0n−1e(πk,[τk]2−uk[1]2). e(com_f-v[1]_1,[1]_2) \stackrel{?}{=} \prod_{k=0}^{n-1}e\left(\pi_k,[\tau_k]_2-u_k[1]_2\right).

Complexity of the Opening Protocol#

For an nn-variate multilinear polynomial with 2n2^n coefficients, the complexity of the opening protocol is explained as follows.

  • Proof Size: The prover sends one quotient commitment πk\pi_k for each variable. Therefore, the opening proof contains nn elements in G1\mathbb{G}_1. Assuming, G1\mathbb{G}_1-element is encoded by two field elements, the proof size in O(n)O(n) field elements.
  • Prover Cost: The major prover costs include the following operations:
    • Compute the quotient polynomials: At step kk, the quotient polynomial is as follows: qk(X0,…,Xk−1)=fk+1(X0,…,Xk)−fk(X0,…,Xk−1)Xk−uk, q_k(X_0,\ldots,X_{k-1}) = \frac{f_{k+1}(X_0,\ldots,X_k)-f_k(X_0,\ldots,X_{k-1})} {X_k-u_k}, where fkf_k is obtained from fk+1f_{k+1} by setting Xk=ukX_k=u_k. Since fk+1f_{k+1} has degree at most one in XkX_k, we can split it as fk+1(X0,…,Xk)=Ak(X0,…,Xk−1)+XkBk(X0,…,Xk−1). f_{k+1}(X_0,\ldots,X_k) = A_k(X_0,\ldots,X_{k-1}) + X_kB_k(X_0,\ldots,X_{k-1}). Setting Xk=ukX_k=u_k gives fk=Ak+ukBkf_k=A_k+u_kB_k. Now substituting these into the quotient gives qk=fk+1−fkXk−uk=Ak+XkBk−(Ak+ukBk)Xk−uk=Bk. \begin{aligned} q_k &= \frac{f_{k+1}-f_k}{X_k-u_k}\\ &= \frac{A_k+X_kB_k-(A_k+u_kB_k)} {X_k-u_k}\\ &=B_k. \end{aligned} The prover takes BkB_k as the quotient qkq_k and computes fk=Ak+ukBkf_k=A_k+u_kB_k. Both AkA_k and BkB_k have at most 2k2^k coefficients. Computing Ak+ukBkA_k+u_kB_k requires one multiplication and one addition per coefficient, giving O(2k)O(2^k) field operations. Repeating this for every kk gives a total cost of ∑k=0n−1O(2k)=O(2n) \sum_{k=0}^{n-1}O(2^k)=O(2^n) field operations. The final partial evaluation is f0=f(u⃗)f_0=f(\vec{u}), so this same computation also produces the claimed value vv.
    • Commit to the multilinear polynomial ff and quotients qkq_k: Since ff has at most 2n2^n coefficients, committing to ff requires an MSM of size at most 2n2^n. Committing to qkq_k requires an MSM of size at most 2k2^k. Therefore, committing to ff and all the quotients requires n+1n+1 MSMs with a combined size of 2n+∑k=0n−12k=2n+1−1, 2^n+\sum_{k=0}^{n-1}2^k=2^{n+1}-1, giving O(2n)O(2^n) group scalar multiplications.
  • Verifier Cost: For each k=0,…,n−1k=0,\ldots,n-1, the verifier computes [τk]2−uk[1]2[\tau_k]_2-u_k[1]_2. This requires O(n)O(n) group scalar multiplications. The final pairing check has n+1n+1 pairing terms: one involving the commitment comfcom_f and claimed evaluation vv, and one for each of the nn quotient commitments.

Equivalently, the costs can be summarized as follows:

ComponentCost
Proof sizeO(n)O(n) field elements
Prover WorkO(2n)O(2^n) field operations, O(2n)O(2^n) group scalar mults
Verifier WorkO(n)O(n) group scalar mults, n+1n+1 pairings

Limitations of PST#

  • PST requires a commitment key containing cross-products of hidden values. It could be deployed by performing a separate trusted setup ceremony for its public parameters. However, such ceremonies are an operational burden and require significant coordination, implementation and auditing. Moreover, existing univariate KZG parameters do not directly contain the cross-products of independent hidden values required by PST. This motivates us to construct a multilinear PCS using the established univariate powers-of-τ\tau setup structure and ceremony infrastructure.
  • PST verification has n+1n + 1 pairing terms. Thus, its verification cost grows linearly with the number of variables.

Conclusion#

PST extends the KZG quotient argument directly to multilinear polynomials. For an evaluation claim f(u⃗)=vf(\vec{u})=v, the prover commits to one multilinear quotient polynomial for each variable, and the verifier checks the resulting identity using bilinear pairings.

This direct approach is conceptually simple, but it requires a specialized multivariate setup and a number of pairing terms that grows linearly with the number of variables. This motivates a different question:

Can we retain the multilinear quotient identity while using univariate polynomial commitments?

In the next part, we will study Zeromorph, which constructs a multilinear PCS using an additively homomorphic univariate PCS (like univariate KZG) and a degree check protocol.