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