new.lisp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. (zkcons! circuit (map (fn* [b] (
  13. (add lc0 one)
  14. (sub lc0 b)
  15. (add lc1 x)
  16. ;; 'enforce)
  17. )) bits))
  18. (def! enforce-loop-const (map (fn* [b] (
  19. (add lc0 one)
  20. (sub lc0 b)
  21. (add lc1 x)
  22. ;; 'enforce)
  23. )) bits))
  24. (zkcons! circuit enforce-loop-const)
  25. ;; (zkcons! circuit (
  26. ;; 'reset-coeff-lc
  27. ;; '(sub lc0 x)
  28. ;; '(add lc1 one)
  29. ;; 'enforce)
  30. ;; )
  31. ;;(println circuit)
  32. ;;(println enforce-loop-const)