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