# Why are logic gates assigned integers when checking QAP in zkSNARK algo?

I am trying to understand how zkSNARKs work. Going through this article by Vitalik, in the section on 'Checking the QAP' he says " If the resulting polynomial, evaluated at every x coordinate that we used above to represent a logic gate, is equal to zero, then that means that all of the checks pass;" -

Can somebody help me understand why logic gates correspond to numbers 1,2,3,4?

• Can you clarify your question a bit ? Is your question about the first transformation (i.e. the R1CS transformation, which includes 4 "arithmetic gates" in his example) ? If you understood the R1CS transformation, the QAP one is just a way to translate several vectors into a polynomial that evaluates to those vector coordinates. In this way, one can easily check that equalities hold by performing polynomial arithmetic instead of integer arithmetic. Jul 25, 2018 at 8:57
• It is not about R1CS transformation, its about the QAP which needs the resulting polynomial to be 0 at input gates. All that is fine, I was wondering, why the input gates are assigned number 1,2,3,4 respectively. I think what Vadym has answered below makes sense. Jul 26, 2018 at 9:08