Reduction logical AND of a 3vec.
See 4vec-reduction-and for some additional discussion. We assume there are no Z bits and in that case, following the boolean-convention, we return:
Function:
(defun 3vec-reduction-and (x) (declare (xargs :guard (4vec-p x))) (let ((__function__ '3vec-reduction-and)) (declare (ignorable __function__)) (if-2vec-p (x) (2vec (bool->vec (int= (2vec->val x) -1))) (b* (((4vec x))) (4vec (bool->vec (int= x.upper -1)) (bool->vec (int= x.lower -1)))))))
Theorem:
(defthm 4vec-p-of-3vec-reduction-and (b* ((and-x (3vec-reduction-and x))) (4vec-p and-x)) :rule-classes :rewrite)
Theorem:
(defthm 3vec-p-of-3vec-reduction-and (b* ((?and-x (3vec-reduction-and x))) (implies (3vec-p x) (3vec-p and-x))))
Theorem:
(defthm 3vec-reduction-and-recursive (implies (3vec-p! x) (equal (3vec-reduction-and x) (b* (((4vec x))) (if (and (or (zip x.upper) (eql x.upper -1)) (or (zip x.lower) (eql x.lower -1))) (4vec-fix x) (4v->4vec-bit (acl2::4v-and (4vec-idx->4v 0 x) (4vec-idx->4v 0 (3vec-reduction-and (4vec (logcdr x.upper) (logcdr x.lower)))))))))) :rule-classes ((:definition :install-body nil :clique (3vec-reduction-and) :controller-alist ((3vec-reduction-and t)))))
Theorem:
(defthm 3vec-reduction-and-of-4vec-fix-x (equal (3vec-reduction-and (4vec-fix x)) (3vec-reduction-and x)))
Theorem:
(defthm 3vec-reduction-and-4vec-equiv-congruence-on-x (implies (4vec-equiv x x-equiv) (equal (3vec-reduction-and x) (3vec-reduction-and x-equiv))) :rule-classes :congruence)