Bitwise exclusive disjunction of signed integer values.
Function:
(defun int-xor (left-operand right-operand) (declare (xargs :guard (and (intp left-operand) (intp right-operand)))) (b* ((size (int->size left-operand)) (x (int->value left-operand)) (y (int->value right-operand))) (make-int :size (int->size left-operand) :value (logext size (logxor x y)))))
Theorem:
(defthm intp-of-int-xor (b* ((result (int-xor left-operand right-operand))) (intp result)) :rule-classes :rewrite)
Theorem:
(defthm int-xor-of-int-fix-left-operand (equal (int-xor (int-fix left-operand) right-operand) (int-xor left-operand right-operand)))
Theorem:
(defthm int-xor-int-equiv-congruence-on-left-operand (implies (int-equiv left-operand left-operand-equiv) (equal (int-xor left-operand right-operand) (int-xor left-operand-equiv right-operand))) :rule-classes :congruence)
Theorem:
(defthm int-xor-of-int-fix-right-operand (equal (int-xor left-operand (int-fix right-operand)) (int-xor left-operand right-operand)))
Theorem:
(defthm int-xor-int-equiv-congruence-on-right-operand (implies (int-equiv right-operand right-operand-equiv) (equal (int-xor left-operand right-operand) (int-xor left-operand right-operand-equiv))) :rule-classes :congruence)