new.lisp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (def! x "73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000")
  2. (def! one "0000000000000000000000000000000000000000000000000000000000000001")
  3. (defzk! circuit ())
  4. ;;(def! bits (unpack-bits x))
  5. (def! bits [one x one])
  6. ;;zkcons add a constraints instruction to the circuit
  7. ;; (zkcons! circuit (
  8. ;; (add lc0 one)
  9. ;; (sub lc0 x)
  10. ;; )
  11. ;; )
  12. (map (fn* [b] (
  13. (zkcons! circuit (
  14. (add lc0 one)
  15. (sub lc0 b)
  16. (add lc1 x))
  17. ;; 'enforce)
  18. ))) bits)
  19. ;; (zkcons! circuit (map (fn* [b] (
  20. ;; (add lc0 one)
  21. ;; (sub lc0 b)
  22. ;; (add lc1 x)
  23. ;; 'enforce)
  24. ;; )) bits))
  25. ;; (def! enforce-loop-const (map (fn* [b] (
  26. ;; (add lc0 one)
  27. ;; (sub lc0 b)
  28. ;; (add lc1 x)
  29. ;; 'enforce)
  30. ;; )) bits))
  31. ;; (zkcons! circuit enforce-loop-const)
  32. ;; (zkcons! circuit (
  33. ;; 'reset-coeff-lc
  34. ;; '(sub lc0 x)
  35. ;; '(add lc1 one)
  36. ;; 'enforce)
  37. ;; )
  38. ;;(println circuit)
  39. ;;(println enforce-loop-const)