(q-iff a b &rest args) constructs a UBDD representing an equality/iff-equivalence.
In the logic, for instance,
(q-iff x1 x2 x3 x4) = (q-and (q-binary-iff x1 x2) (q-binary-iff x1 x3) (q-binary-iff x1 x4))
We do not see how to use short-circuiting to improve upon
Function:
(defun q-binary-iff (x y) (declare (xargs :guard t)) (cond ((atom x) (if x y (q-not y))) ((atom y) (if y x (q-not x))) ((hons-equal x y) t) (t (qcons (q-binary-iff (car x) (car y)) (q-binary-iff (cdr x) (cdr y))))))
Function:
(defun q-binary-iff-memoize-condition (x y) (declare (ignorable x y) (xargs :guard 't)) (and (consp x) (consp y)))
Function:
(defun q-iff-macro-guts (a x) (if (consp x) (cons (cons 'q-binary-iff (cons a (cons (car x) 'nil))) (q-iff-macro-guts a (cdr x))) nil))
Function:
(defun q-iff-macro-fn (args) (if (equal (len args) 2) (cons 'prog2$ (cons '(last-chance-wash-memory) (cons (cons 'q-binary-iff (cons (car args) (cons (cadr args) 'nil))) 'nil))) (mv-let (cheap expensive) (cheap-and-expensive-arguments args) (let ((reordered-args (append cheap expensive))) (cons 'let (cons (cons (cons 'a-for-q-iff-do-not-use-elsewhere (cons (car reordered-args) 'nil)) 'nil) (cons (cons 'prog2$ (cons '(last-chance-wash-memory) (cons (cons 'q-and (q-iff-macro-guts 'a-for-q-iff-do-not-use-elsewhere (cdr reordered-args))) 'nil))) 'nil)))))))
Theorem:
(defthm ubddp-of-q-iff (implies (and (force (ubddp x)) (force (ubddp y))) (equal (ubddp (q-iff x y)) t)))
Theorem:
(defthm eval-bdd-of-q-iff (equal (eval-bdd (q-iff x y) values) (iff (eval-bdd x values) (eval-bdd y values))))
Theorem:
(defthm canonicalize-q-iff (implies (and (force (ubddp x)) (force (ubddp y))) (equal (q-iff x y) (q-ite x y (q-ite y nil t)))))