Score:3

Arithmetic Circuit to Square Arithmetic Program (SAP)

tl flag

I'm trying to figure out how to convert a circuit into a Square Arithmetic Program (SAP). This is to eventually use it for zk-SNARKs such as Groth16. I do however understand how to convert arithmetic circuits into Quadratic Arithmetic Programs (QAP). As an example if we have the following circuit $c_1 \cdot c_2 = c_3$. Here we would define the following three polynomials: $L_1 = R_2 = O_3 = x$ (where L denotes left, R denotes right and O denotes output). Thus the final polynomial $$P = L \cdot R-O = c_1 \cdot x \cdot c_2 \cdot x - c_3 \cdot x$$ Therefore we have P(1)=0 whenever the circuit is satisfied. Now for SAPs we want to eliminate multiplication gates, such that we do not require the 3 lists of polynomials (L,R,O), but rather 2. In Appendix A of: https://eprint.iacr.org/2017/540.pdf they explain how to write the product in terms of squares of the two operands: $$ c_1\cdot c_2 = \frac{(c_1+c_2)^2-(c_1-c_2)^2}{4} $$ It also shows the two new constraints that appear, but I can't translate this into some polynomials for where the new equation $P = I^2 - O$ (where I now denotes input) holds.

Hopefully one of you can lead me in the right direction.

et flag
Did you mean to have the abbreviation QAP in the title or SAP?
Dontmilkme avatar
tl flag
Yes SAP, my bad
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.