R1CS to QAP
In this module I explored R1CS arithmetization and it transformation to QAP
Last updated
In this module I explored R1CS arithmetization and it transformation to QAP
Last updated
This section would be diving how a problem represented R1CS
can be transformed into QAP
Explore these chapter of the Rareskill book:
let's play with a quick example on transforming R1CS to QAP.
The Rank one constraint system is a very flexible way to represent an arithmetic circuit and to most proving systems, R1CS is the data structure in which the compute is presented to to the proving system.
In this write-up, I will be exploring how to go from an arithmetic circuit (in polynomial form) to QAP.
Example;
reducing this equation to a format that can be reduced to R1CS
this is what the witness would look like, recall the witness consists of the;
to represent this in this format;
The R1CS representation of this would be given as;
Now transforming this R1CS to its QAP representation.
In QAP we would be representing the R1CS structure using polynomials, but these polynomials completely implement the same logic done by the R1CS.
In the construction used, the number of polynomials & their degree would depend on the length of the solution vector & the number of gates. The solution vector contains 5 elements, so we can construct 5 polynomials. Each gate contributes 1 point to each polynomial. We have 3 gates here, we get 3 points per polynomial. 3 points allows us to define a polynomial of maximum degree 2. So we can construct 5 polynomials each with a maximum degree of 2. So we can transform our matrices collectively into 5 polynomials, each of degree 2.
for the second column, there is no need to do this, because this would result in a Zero polynomial.
This construct the QAP representation of C, we would be making use of the co-efficient of these vectors;
This is how C
would be represented in QAP form;
But we are not done yet, there is just one more step,
It is truly epic seeing these huge matrices reduced to a single polynomial!
recall the R1CS format is as follows;
would be influenced by would be influenced by would be influenced by
for the first column of C;
for the 3rd column of C;
for the 4th column of C;
for the 5th column of C;
We have to multiply and , is of the dimension of and is of the dimension of this would result in a matrix of dimension , take this array as the co-efficient of a polynomial, that Polynomial is the QAP representation of .