Encode

Encode #

Relation #

Rmult3:={(KArr1,KArr2,|Arr1=[a(1,0),a(1,1),a(1,2),,a(1,n1)],Arr2=[a(2,0),a(2,1),a(2,2),,a(2,n1)],PolyArr1=FFT.Interp(ω,Arr1),PolyArr2=FFT.Interp(ω,Arr2),KArr1=KZG.Commit(PolyArr1),KArr2=KZG.Commit(PolyArr2),}

Intuition #

The prover (P) holds two arrays Arr1 and Arr2 of n integers from Zq: [a0,a1,a2,,an1]. It wishes to map the pairs of elements, {Arr1[i],Arr2[i]} into a single element, Arr3[i] without collisions. It will produce a succinct (independent of n) proof that Arr3 contains the encoding of Arr1 and Arr2 according to this mapping.

For the mapping scheme, we use random linear combinations, since it is both collision resistant and it can be proven in zero knowledge. To do so, the prover defines fi(X)=Arr1[i]+Arr2[i]X for i[0,n1]. Then, the the prover calculates Arr3[i]=fi(r) for a random field element r. Assuming fi is committed to before r is know, this scheme is collision resistant by the Schwartz-Zippel lemma; if two polynomials are equal at r then with overwhelming probability they are the same polynomial. However, to ensure negligible probability of collisions, n may need to be smaller relative to the field size than initially thought. This is due to the birthday paradox. We are not evaluating the probability that a single one of the n polynomials collides with one of the other n1 polynomials, but rather the probability than any one polynomial out of n collides with any other of the n1 polynomials. The value of the latter is significantly larger, since it compares every possible pair of the n polynomials, instead of just comparing one of the polynomials with the n1 other polynomials. The probability of collisions can, however, still be made sufficiently small by bounding how large n can be relative to the field size.

In order to prove the relation, the prover will encode the three arrays into three polynomials: PolyArr1, PolyArr2, and PolyArr3 (using evaluation points on the domain Hκ). It will commit to each polynomial: KArr1, KArr2, and KArr3. The verifier (V) cannot check any of the Arri or PolyArri values directly (they may contain secret information, and even if they do not, they are too long to check) so the verifier only sees KArr1,KArr2, and KArr3. It will use these commitments to verified the constraint Arr3[i]=Arr1[i]+Arr2[i]r.

Protocol Details #

Array Level #

  • P holds an array Arr1=[a(1,0),a(1,1),a(1,2),,a(1,n1)]
  • P holds an array Arr2=[a(2,0),a(2,1),a(2,2),,a(2,n1)]
  • P generates the random challenge r, then computes Arr3 as follows:
    • Arr3[i]=Arr1[i]+Arr2[i]r

Polynomial Level #

We assume that Arr1, Arr2, and Arr3 are encoded as the y-coordinates into a univariant polynomial where the x-coordinates (called the domain Hκ) are chosen as the multiplicative group of order κ with generator ωGκ (see Background for more). In short, ω0 is the first element and ωκ1 is the last element of Hκ. If κ is larger than the length of the arrays, the arrays can be padded with zeros.

Recall the constraint we want to prove:

  1. Arr3[i]=fi(X)=Arr1[i]+Arr2[i]r

We write the constraint in polynomial form:

  1. For all X from ω0 to ωκ1: PolyArr3(X)=PolyArr1(X)+PolyArr2(X)r

We adjust the constraint to show an equality with 0 and label it:

  1. PolyVanish(X)=PolyArr3(X)(PolyArr1(X)+PolyArr2(X)r)=0

This equation is true for every value of XHκ (but not necessarily true outside of these values). To show this, we divide the polynomial by Xκ1, which is a minimal vanishing polynomial for Hκ that does not require interpolation to create. If the quotient is polynomial (and not a rational function), then PolyVanish(X) must be vanishing on Hκ too. Specifically, the prover computes:

  1. Q(X)=PolyVanish(X)Xκ1

By rearranging, we can get PolyZero(X) as a true zero polynomial (zero at every value both in Hκ and outside of it):

PolyZero(X)=PolyVanish(X)Q(X)(Xκ1)=0

Ultimately the rotate argument will satisfy the following constraints at the Commitment Level:

  1. Show Q(X) exists (as a polynomial that evenly divides the divisor)
  2. Show PolyZero(X) is correctly constructed from PolyArr1(X), PolyArr2, and PolyArr3(X)
  3. Show PolyZero(X) is the zero polynomial

Commitment Level #

The verifier will never see the arrays or polynomials themselves. They are undisclosed because they either (i) contain private data or (ii) they are too large to examine and maintain a succinct proof system. Instead the prover will use commitments.

The prover will write the following commitments to the transcript:

  • KArr1=KZG.Commit(PolyArr1(X))
  • KArr2=KZG.Commit(PolyArr2(X))

The prover will generate a random challenge evaluation point (using strong Fiat-Shamir) on the polynomials that is outside of Hκ. Call this point r. We note that since Arr1 and Arr2 were committed to before r was know, fi is committed to before r is known. This is important for the collision resistance of our encoding scheme. Now, using r, the prover can compute and commit to the following polynomials:

  • KArr3=KZG.Commit(PolyArr3(X))
  • KQ=KZG.Commit(Q(X))

The prover will generate a random challenge evaluation point (using strong Fiat-Shamir) on the polynomials that is outside of Hκ. Call this point ζ. The prover will write the point and opening proofs to the transcript:

  • ζ
  • PolyArr1(ζ)=KZG.Open(KArr1,ζ)
  • PolyArr2(ζ)=KZG.Open(KArr2,ζ)
  • PolyArr3(ζ)=KZG.Open(KArr3,ζ)
  • Q(ζ)=KZG.Open(KQ,ζ)

To check the proof, the verifier uses the transcript to construct the value YZero as follows:

  • YVanish=PolyArr3(ζ)(PolyArr1(ζ)+PolyArr2(ζ)r)
  • YZero=YVanishQ(ζ)(ζκ1)

Finally, if the constraint system is true, the following constraint will be true (and will be false otherwise with overwhelming probability, due to the Schwartz-Zippel lemma on ζ) :

  • YZero=?0

Implementations #

Security Proof #

Completeness #

If YZero is zero, then V will accept. Therefore, to show completeness, we show that any prover who holds Arr3 that is a random linear combination of Arr1 and Arr2 using r, can follow the steps outlined in the above protocol and the resulting YZero will be equal to zero. To see this, observed that YZero

=YVanishQ(ζ)(ζκ1)

=PolyArr3(ζ)(PolyArr1(ζ)+PolyArr2(ζ)r)Q(ζ)(ζκ1)

=PolyArr3(ζ)(PolyArr1(ζ)+PolyArr2(ζ)r)PolyVanish(ζ)ζκ1(ζκ1)

=PolyArr3(ζ)(PolyArr1(ζ)+PolyArr2(ζ)r)(PolyArr3(ζ)(PolyArr1(ζ)+PolyArr2(ζ))r)

=0

Where the third equality relies on the fact that PolyVanish(X) is divisible by Xκ1. This is true if PolyVanish(ζ) is vanishing on Hκ, i.e. if (PolyArr3(X)(PolyArr1(X)+PolyArr2(X))r)=0 XHκ. This is true if if Arr3(Arr1+Arr2r)=0 i[0,κ1], since Polyj(ωi)=Arrj[i] i[0,κ1]. But this is precisely the condition we assumed held for our prover, so the YZero it creates by following the protocol is zero, and the transcript will be accepted.

Soundness #

We prove knowledge soundness in the Algebraic Group Model (AGM). To do so, we must prove that there exists an efficient extractor E such that for any algebraic adversary A, the probability of A winning the following game is negl(λ).

  1. Given [g,gτ,gτ2,,gτn1] A outputs commitments to PolyArr1(X), PolyArr2(X), PolyArr3(X) , Q(X)

  2. E, given access to A’s outputs from the previous step, outputs PolyArr1(X), PolyArr2(X), PolyArr3(X), Q(X)

  3. A plays the part of the prover in showing that YZero is zero at a random challenge ζ

  4. A wins if:

    i) V accepts at the end of the protocol

    ii) Arr3[i]Arr1[i]+Arr1[i]r for some i[0,n1]

Our proof is as follows:

For the second win condition to be fulfilled, there must be some i[0,n1] such that Arr3[i]Arr1[i]+Arr1[i]r. But then PolyVanish(X) is not vanishing on Hκ, so Q(X) is not a polynomial (it is a rational function). This means that A cannot calculated the correct commitment value gQ(τ) without solving the t-SDH. Thus, A chooses an arbitrary value for Q(τ) and writes KQ=gQ(τ) to the transcript. Before this, it also writes commitments to PolyArr1(X), PolyArr2(X), and PolyArr3(X). All commitments A has written are linear combinations of the elements in [g,gτ,gτ2,,gτn1]. E is given these coefficients (since A is an algebraic adversary) so E can output the original polynomials.

A then obtains the random challenge ζ (using strong Fiat-Shamir). By the binding property of KZG commitments, PolyArr1(ζ), PolyArr2(ζ), and PolyArr3(ζ) can each only feasibly be opened to one value. For A to have the verifier accept, it must produce a proof that Q(ζ) opens to Q(ζ)=YVanish(ζκ1). This means being able to produce gq(τ) where q(τ)=Q(τ)Q(ζ)τζ and Q(ζ)=YVanish(ζκ1). Since Q(τ) and Q(ζ) are known, this implies knowing g1τζ. Thus A would have found ζ,g1τζ, which is the t-SDH problem. We have shown that creating an accepting proof reduces to the t-SDH, so A’s probability of success is negligible.

Zero-Knowledge #

We prove that the above protocol is zero-knowledge when PolyCommitPed (from the KZG paper) is used for the polynomial commitments. We do so by constructing a probabilistic polynomial time simulator S that knows the trapdoor τ, which, for every (possibly malicious) verifier V, can output a view of the execution of the protocol that is indistinguishable from the view produced by the real execution of the program.

The simulator S chooses arbitrary values for PolyArr1(τ), PolyArr2(τ), and PolyArr3(τ), then computes gPolyArr1(τ), gPolyArr2(τ), and gPolyArr3(τ) to write as the commitments KArr1, KArr2 and KArr3. S computes Q(τ) using the values it chose for PolyArr1(τ), PolyArr2(τ), and PolyArr3(τ). S writes the commitment KQ=gQ(τ).

Now, S generates the random challenge point ζ (which we assume is not in Hκ; if it is in Hκ, S simply restarts and runs from the beginning). This is by strong Fiat-Shamir. S then create fake opening proofs for PolyArr1(ζ), PolyArr2(ζ), and PolyArr3(ζ), to arbitrary values. This is done using the knowledge of τ, calculating the respective witness q(τ)=f(τ)f(ζ)τζ for each of the polynomials.

Finally, S creates a fake opening proof for Q(ζ)=YVanish(ζκ1). This is done using knowledge of τ to calculate an accepting witness q(τ), as above. This means that YZero will be zero, and the transcript will be accepted by the verifier. It is indistinguishable from a transcript generates from a real execution, since PolyCommitPed has the property of Indistinguishability of Commitments due to the randomization by hϕ^(x).