Bitwise logical exclusive or of zero or more integers
When integers are viewed in their two's complement representation,
logxor returns their bitwise logical exclusive or. In ACL2 logxor
is a macro that expands into calls of the binary function binary-logxor,
except that (logxor) expands to 0 and (logxor x) expands to
(the integer x).
The guard for binary-logxor requires its arguments to be
integers. Logxor is defined in Common Lisp. See any Common Lisp
documentation for more information.
(defmacro logxor (&rest args)
(cond ((null args) 0)
((null (cdr args))
(cons 'integer (cons (car args) 'nil))))
(t (xxxjoin 'binary-logxor args))))
(defun binary-logxor (i j)
(declare (xargs :guard (and (integerp i) (integerp j))))
(lognot (logeqv i j)))
- Lemmas about logxor from the logops-lemmas book.
- Behavior of logxor on bad inputs.
- Recursive definition of logxor.