scipr-lab / libsnark

C++ library for zkSNARKs
Other
1.8k stars 570 forks source link

confusion about majority_gadget<FieldT>::generate_r1cs_constraints() #191

Closed tjchern closed 2 years ago

tjchern commented 2 years ago

Hi, dear libsnark developers: I am confuse about the majority qap circuit. maj(x, y, z) = xy xor yz xor xz. in code, it represents: / 2result + aux = x + y + z x, y, z, aux -- bits aux = x + y + z - 2result / why is it correct? thanks very much!