You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
583 B

6 years ago
  1. template BabyAdd() {
  2. signal input x1;
  3. signal input y1;
  4. signal input x2;
  5. signal input y2;
  6. signal output xout;
  7. signal output yout;
  8. signal beta;
  9. signal gamma;
  10. signal delta;
  11. signal epsilon;
  12. signal tau;
  13. var a = 168700;
  14. var d = 168696;
  15. beta <== x1*y2;
  16. gamma <== y1*x2;
  17. delta <== y1*y2;
  18. epsilon <== x1*x2;
  19. tau <== delta * epsilon;
  20. xout <-- (beta + gamma) / (1+ d*tau);
  21. (1+ d*tau) * xout === (beta + gamma);
  22. yout <-- (delta - a * epsilon) / (1-d*tau);
  23. (1-d*tau)*yout === (delta - a * epsilon);
  24. }