The function
This returns the scalar that is used in the Jubjub multiplication,
i.e.
Function:
(defun pedersen-segment-scalar-loop (j segment) (declare (xargs :guard (and (posp j) (bit-listp segment)))) (declare (xargs :guard (integerp (/ (len segment) 3)))) (let ((__function__ 'pedersen-segment-scalar-loop)) (declare (ignorable __function__)) (if (consp segment) (+ (* (pedersen-enc (take 3 segment)) (expt 2 (* 4 (1- j)))) (pedersen-segment-scalar-loop (1+ j) (nthcdr 3 segment))) 0)))
Theorem:
(defthm integerp-of-pedersen-segment-scalar-loop (implies (posp j) (b* ((i (pedersen-segment-scalar-loop j segment))) (integerp i))) :rule-classes (:type-prescription :rewrite))
Function:
(defun pedersen-segment-scalar (segment) (declare (xargs :guard (bit-listp segment))) (declare (xargs :guard (integerp (/ (len segment) 3)))) (let ((__function__ 'pedersen-segment-scalar)) (declare (ignorable __function__)) (pedersen-segment-scalar-loop 1 segment)))
Theorem:
(defthm integerp-of-pedersen-segment-scalar (b* ((i (pedersen-segment-scalar segment))) (integerp i)) :rule-classes (:type-prescription :rewrite))