Try   HackMD

Soundness of music

This week's puzzle is all about soundness - the requirement of a proof system that it should not be possible to prove false statements.

Here, we use a toy proof system based on BCTV14 which is unsound.

The proof system

This proof system is intended to allow a prover to show that a certain set of arithmetic constraints is satisfiable. Each constraint is of the form:

[a1,,am][v1,,vm]T+[a1,,am][v1,,vm]T=[c1,,cm][v1,,vm]T

If you're familiar with the concept of rank-1 constraint systems, the format of an R1CS constraint may look similar. However, our constraints are much more limited: our kind of constraint system can only describe a very specific kind of arithmetic relations. In particular, it is not universal, since multiplication of variables is not possible. However, we can still prove statements such as 1+1+1+1=4.

Constraints to polynomials

Each variable can be represented by a pair of polynomials, one which encodes every time that variable is an input in a constraint, and one polynomial which encodes every time that variable is an output in a constraint.

First, let's fix a domain

ω1,,ωmF, one field element for each constraint. (In general, these will be roots of unity; for our purposes, they only need to be distinct from each other)

Then the input polynomial

Ai for
vi
is defined as a polynomial of degree
n+1
such that for all
j{1,,n}
, if

Ai(ωj)=ai

where

ai comes from constraint
Cj
.

We can think of this polynomial as encoding the coefficients of the variable in each constraint.

Similarly, the output polynomial

Ci for each variable is defined as a polynomial of degree
n+1
such that for all
j{1,,n}

Ci(ωj)=ci

where

ci comes from constraint
Cj
.

Together with the vanishing polynomial

Z=(xω1)(xωn), defined so
Z(ωj)=0
for all
j
, the polynomials
A1,C1,,Am,Cm,Z
define what we will call the "circuit" for our proving system.

Trusted setup

Our succinct proving system requires a trusted setup.

Suppose we have

n constraints over
m
variables, with polynomials
A1,C1,,Am,Cm,Z
. We use the pairing-friendly BLS12-381 elliptic curve, with groups
G1,G2
.

Using the notation

[x]1=[x]G and
[x]2=[x]H
, where
G
is a generator in
G1
and
H
is a generator in
G2
and
[x]G
refers to scalar multiplication by
x
.

Trusted setup elements
Powers of tau
[1]1,[τ]1,[τ2]1,,[τm]1
Input polynomial commitments
[ρA1(τ)]1,,[ρAm(τ)]1
α
Input polynomial commitments
[αIρA1(τ)]1,,[αIρAm(τ)]1
Output polynomial commitments
[ρC1(τ)]1,,[ρCm(τ)]1
α
Output polynomial commitments
[αOρCj(τ)]1,,[αOρCm(τ)]1
K
βρ(A1(τ)+C1(τ))]1,,[βρ(Am(τ)+Cm(τ))]1
αI
[αI]2
αO
[αO]2
γ
[γ]2
βγ
[βγ]2
Vanishing polynomial
[ρZ(τ)]2

This trusted setup mostly copies the BCTV14 trusted setup, with minor modifications to the constraint format. In theory, the elements of the trusted setup help the verifier check that a proof is properly constructed.

For the puzzle, there was no multi-party computation ceremony, or any other special measures taken; random values of

τ,ρ,αI,αO,β,γ are taken and the trusted setup values computed directly and honestly.

Creating a proof

Suppose an assignment of values

x1,,xm to the variables
v1,,vm
satisfies all constraints. Then equality:

(x1A1(ω1)++xmAm(ω1))+(x1A1(ω1)++xmAm(ω1))=x1C1(ω1)++xmCm(ω1)

must hold, because it simplifies to:

[a1,,am][x1,,xm]T+[a1,,am][x1,,xm]T=[c1,,cm][x1,,xm]T

which is simply constraint 1. Therefore, the polynomial equation:

(x1A1(x)++xmAm(x))+(x1A1(x)++xmAm(x))=x1C1(x)++xmCm(x)

must hold over the entire domain

ω1,,ωn. Further, this polynomial equation holds over the domain if and only if the assignment
x1,,xm
actually satisfies every constraint; therefore, we can simply prove that this polynomial equation holds over this domain, and then conclude the constraint system is satisfied.

Rearranging everything to the left and denoting it as

P(x):

P(x)=(x1A1(x)++xmAm(x))+(x1A1(x)++xmAm(x))(x1C1(x)++xmCm(x))

We get that

P(x)=0 for all
x{ω1,,ωn}
. Therefore,
P(x)
is divisible by the vanishing polynomial
Z(x)
; put another way, there exists a polynomial
H(x)
such that
P(x)=H(x)Z(x)
.

Therefore, if we compute a polynomial commitment

πH=[P(τ)/Z(τ)]1, a verifier should be able to confirm that
P(x)=0
over the correct domain.

We also compute some additional proof elements, which encode the private inputs and also help the verifier verify this fact:

πI=xi is privatexi[ρAi(τ)]
πI=xi is privatexi[αIρAi(τ)]

πO=xixi[ρCi(τ)]

πO=xixi[αOρOi(τ)]

πK=xi[βρ(A1(τ)+C1(τ))]1,,[βρ(Am(τ)+Cm(τ))]1

The final proof is

(πI,πI,πO,πO,πK,πH)

Verifier

The given verifier takes in the public inputs

x1,,xp. The public inputs get encoded into:

πPI=xi is publicxi[ρAi(τ)]

The verifier checks, where

e(,) is the pairing operation:

e(πI,H)=e(πI,[αI]2)
e(πO,H)=e(πO,[αO]2)

e(πK,[γ]2)=e(πPI+πI+πO,[βγ]2)

e(πPI+πI+πPI+πIπO)=e(πH,[ρZ(τ)]2)

The final pairing effectively checks the condition that

P(x)=H(x)Z(x) as required.

Soundness Bugs

The proof system in this puzzle has two soundness bugs; the verifier accepts proofs even when the constraint system is unsatisfiable with given public inputs.

Bug 1

The first bug is an implementation bug. Recall that for variable

vi, the polynomials
Ai
and
Ci
were defined as a polynomial of degree
n+1
with certain values on a domain. In the puzzle,
Ai
and
Ci
were interpolated without regard to the resulting degree, which meant that
Ai
sometimes was degenerate. When this happens for a public input variable, the verifier may ignore this public input.

The correct fix is to ensure that every polynomial is actually degree

n+1. This can be achieved by taking the polynomial mod
Z(x)
and adding
Z(x)
, since
Z(x)
is known to be exactly degree
n+1
. Since zero-knowledge blinding wasn't necessary for this puzzle, this necessary step was omitted.

Bug 2

The second bug is a conceptual bug, based on the one that occurs in BCTV14. The trusted setup includes terms:

[αIρA1(τ)]1,,[αIρAp(τ)]1

which are not used anywhere by the prover or verifier.

However, these elements can be used to alter any valid proof for public input

x1,,xp to work for an arbitrary public input:

ηI=πI+i=0p(xixi)[ρAi(τ)]1

ηI=πI+i=0p(xixi)[αIρAi(τ)]1

The proof

(ηI,ηI,πO,πO,πK,πH) will verify against the arbitrarily-chosen public input
x1,,xp
.

The fix for this bug is to remove the unnecessary elements of the trusted setup.