Function:
(defun s3vec-bit? (test then else) (declare (xargs :guard (and (s4vec-p test) (s4vec-p then) (s4vec-p else)))) (let ((__function__ 's3vec-bit?)) (declare (ignorable __function__)) (b* (((s4vec test)) ((s4vec then)) ((s4vec else)) (test-x (sparseint-bitandc2 test.upper test.lower))) (s4vec (sparseint-bitor (sparseint-bitandc1 test.upper else.upper) (sparseint-bitor (sparseint-bitand test.lower then.upper) (sparseint-bitand test-x (sparseint-bitor (sparseint-bitor then.upper then.lower) (sparseint-bitor else.upper else.lower))))) (sparseint-bitor (sparseint-bitandc1 test.upper else.lower) (sparseint-bitor (sparseint-bitand test.lower then.lower) (sparseint-bitand test-x (sparseint-bitand (sparseint-bitand then.upper then.lower) (sparseint-bitand else.upper else.lower)))))))))
Theorem:
(defthm s4vec-p-of-s3vec-bit? (b* ((res (s3vec-bit? test then else))) (s4vec-p res)) :rule-classes :rewrite)
Theorem:
(defthm s3vec-bit?-correct (b* ((?res (s3vec-bit? test then else))) (equal (s4vec->4vec res) (3vec-bit? (s4vec->4vec test) (s4vec->4vec then) (s4vec->4vec else)))))
Theorem:
(defthm s3vec-bit?-of-s4vec-fix-test (equal (s3vec-bit? (s4vec-fix test) then else) (s3vec-bit? test then else)))
Theorem:
(defthm s3vec-bit?-s4vec-equiv-congruence-on-test (implies (s4vec-equiv test test-equiv) (equal (s3vec-bit? test then else) (s3vec-bit? test-equiv then else))) :rule-classes :congruence)
Theorem:
(defthm s3vec-bit?-of-s4vec-fix-then (equal (s3vec-bit? test (s4vec-fix then) else) (s3vec-bit? test then else)))
Theorem:
(defthm s3vec-bit?-s4vec-equiv-congruence-on-then (implies (s4vec-equiv then then-equiv) (equal (s3vec-bit? test then else) (s3vec-bit? test then-equiv else))) :rule-classes :congruence)
Theorem:
(defthm s3vec-bit?-of-s4vec-fix-else (equal (s3vec-bit? test then (s4vec-fix else)) (s3vec-bit? test then else)))
Theorem:
(defthm s3vec-bit?-s4vec-equiv-congruence-on-else (implies (s4vec-equiv else else-equiv) (equal (s3vec-bit? test then else) (s3vec-bit? test then else-equiv))) :rule-classes :congruence)