Function:
(defun s4vec-bit-index (n x) (declare (xargs :guard (and (natp n) (s4vec-p x)))) (let ((__function__ 's4vec-bit-index)) (declare (ignorable __function__)) (if-s2vec-p (x) (s2vec (int-to-sparseint (sparseint-bit n (s2vec->val x)))) (make-s4vec :upper (int-to-sparseint (sparseint-bit n (s4vec->upper x))) :lower (int-to-sparseint (sparseint-bit n (s4vec->lower x)))))))
Theorem:
(defthm s4vec-p-of-s4vec-bit-index (b* ((bit (s4vec-bit-index n x))) (s4vec-p bit)) :rule-classes :rewrite)
Theorem:
(defthm s4vec-bit-index-correct (b* ((common-lisp::?bit (s4vec-bit-index n x))) (equal (s4vec->4vec bit) (4vec-bit-index n (s4vec->4vec x)))))
Theorem:
(defthm s4vec-bit-index-of-nfix-n (equal (s4vec-bit-index (nfix n) x) (s4vec-bit-index n x)))
Theorem:
(defthm s4vec-bit-index-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (s4vec-bit-index n x) (s4vec-bit-index n-equiv x))) :rule-classes :congruence)
Theorem:
(defthm s4vec-bit-index-of-s4vec-fix-x (equal (s4vec-bit-index n (s4vec-fix x)) (s4vec-bit-index n x)))
Theorem:
(defthm s4vec-bit-index-s4vec-equiv-congruence-on-x (implies (s4vec-equiv x x-equiv) (equal (s4vec-bit-index n x) (s4vec-bit-index n x-equiv))) :rule-classes :congruence)