Bitwise logical XOR of 3vecs.
Function:
(defun 3vec-bitxor (x y) (declare (xargs :guard (and (4vec-p x) (4vec-p y)))) (let ((__function__ '3vec-bitxor)) (declare (ignorable __function__)) (if-2vec-p (x y) (2vec (logxor (2vec->val x) (2vec->val y))) (b* (((4vec x)) ((4vec y)) (xmask (logior (logand x.upper (lognot x.lower)) (logand y.upper (lognot y.lower))))) (4vec (logior xmask (logxor x.upper y.upper)) (logand (lognot xmask) (logxor x.lower y.lower)))))))
Theorem:
(defthm 4vec-p-of-3vec-bitxor (b* ((x^y (3vec-bitxor x y))) (4vec-p x^y)) :rule-classes :rewrite)
Theorem:
(defthm 3vec-p-of-3vec-bitxor (b* ((?x^y (3vec-bitxor x y))) (implies (and (3vec-p x) (3vec-p y)) (3vec-p x^y))))
Theorem:
(defthm 3vec-bitxor-bits (implies (and (3vec-p! x) (3vec-p! y)) (equal (4vec-idx->4v n (3vec-bitxor x y)) (acl2::4v-xor (4vec-idx->4v n (3vec-fix x)) (4vec-idx->4v n (3vec-fix y))))))
Theorem:
(defthm 3vec-bitxor-of-4vec-fix-x (equal (3vec-bitxor (4vec-fix x) y) (3vec-bitxor x y)))
Theorem:
(defthm 3vec-bitxor-4vec-equiv-congruence-on-x (implies (4vec-equiv x x-equiv) (equal (3vec-bitxor x y) (3vec-bitxor x-equiv y))) :rule-classes :congruence)
Theorem:
(defthm 3vec-bitxor-of-4vec-fix-y (equal (3vec-bitxor x (4vec-fix y)) (3vec-bitxor x y)))
Theorem:
(defthm 3vec-bitxor-4vec-equiv-congruence-on-y (implies (4vec-equiv y y-equiv) (equal (3vec-bitxor x y) (3vec-bitxor x y-equiv))) :rule-classes :congruence)