Function:
(defun s4vec-parity (x) (declare (xargs :guard (s4vec-p x))) (let ((__function__ 's4vec-parity)) (declare (ignorable __function__)) (b* (((unless (s4vec-2vec-p x)) (s4vec-x)) (xint (s4vec->upper x)) ((when (sparseint-< xint 0)) (s4vec-x)) (xval (s4vec-sparseint-val (s4vec->upper x)))) (s2vec (int-to-sparseint (- (fast-parity (+ 1 (integer-length xval)) xval)))))))
Theorem:
(defthm s4vec-p-of-s4vec-parity (b* ((res (s4vec-parity x))) (s4vec-p res)) :rule-classes :rewrite)
Theorem:
(defthm s4vec-parity-correct (b* ((?res (s4vec-parity x))) (equal (s4vec->4vec res) (4vec-parity (s4vec->4vec x)))))
Theorem:
(defthm s4vec-parity-of-s4vec-fix-x (equal (s4vec-parity (s4vec-fix x)) (s4vec-parity x)))
Theorem:
(defthm s4vec-parity-s4vec-equiv-congruence-on-x (implies (s4vec-equiv x x-equiv) (equal (s4vec-parity x) (s4vec-parity x-equiv))) :rule-classes :congruence)