Skip to content

Commit

Permalink
fix: added bit decomposition constraints & generic base X decompositi…
Browse files Browse the repository at this point in the history
…on constraints
  • Loading branch information
OlivierBBB committed Oct 30, 2024
1 parent d84bb09 commit 4770b25
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stdlib.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,17 @@
(if-not-zero ct
(remained-constant! X)))

;; byte decomposition constraint
(defpurefun (byte-decomposition ct acc bytes)
;; base-X decomposition constraints
(defpurefun (base-X-decomposition ct base acc digits)
(if-zero ct
(eq! acc bytes)
(eq! acc (+ (* 256 (prev acc)) bytes))))
(eq! acc (+ (* base (prev acc)) digits))))

;; byte decomposition constraint
(defpurefun (byte-decomposition ct acc bytes) (base-X-decomposition ct 256 acc bytes))

;; bit decomposition constraint
(defpurefun (bit-decomposition ct acc bits) (base-X-decomposition ct 2 acc bits))

;; plateau constraints
(defpurefun (plateau-constraint CT (X :binary) C)
Expand Down

0 comments on commit 4770b25

Please sign in to comment.