(q-xor a b &rest args) constructs a UBDD representing the exclusive OR of its arguments.
Function:
(defun q-binary-xor (x y) (declare (xargs :guard t)) (cond ((atom x) (if x (q-not y) y)) ((atom y) (if y (q-not x) x)) ((hons-equal x y) nil) (t (qcons (q-binary-xor (car x) (car y)) (q-binary-xor (cdr x) (cdr y))))))
Function:
(defun q-binary-xor-memoize-condition (x y) (declare (ignorable x y) (xargs :guard 't)) (and (consp x) (consp y)))
Function:
(defun q-xor-macro-fn (args) (declare (xargs :guard (consp args))) (if (atom (cdr args)) (car args) (cons 'prog2$ (cons '(last-chance-wash-memory) (cons (cons 'q-binary-xor (cons (car args) (cons (q-xor-macro-fn (cdr args)) 'nil))) 'nil)))))
Theorem:
(defthm ubddp-of-q-xor (implies (and (force (ubddp x)) (force (ubddp y))) (equal (ubddp (q-xor x y)) t)))
Theorem:
(defthm eval-bdd-of-q-xor (equal (eval-bdd (q-xor x y) values) (if (eval-bdd x values) (not (eval-bdd y values)) (eval-bdd y values))))
Theorem:
(defthm q-xor-of-self (equal (q-xor x x) nil))
Theorem:
(defthm canonicalize-q-xor (implies (and (force (ubddp x)) (force (ubddp y))) (equal (q-xor x y) (q-ite x (q-not y) y))))