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