Recognizer for well-formed ubdds.
Note: memoized for efficiency.
Function:
(defun ubddp (x) (declare (xargs :guard t)) (mbe :logic (if (atom x) (booleanp x) (and (ubddp (car x)) (ubddp (cdr x)) (if (atom (car x)) (not (equal (car x) (cdr x))) t))) :exec (cond ((eq x t) t) ((eq x nil) t) ((atom x) nil) (t (let ((a (car x)) (d (cdr x))) (cond ((eq a t) (cond ((eq d nil) t) ((eq d t) nil) (t (ubddp d)))) ((eq a nil) (cond ((eq d nil) nil) ((eq d t) t) (t (ubddp d)))) (t (and (ubddp a) (ubddp d)))))))))
Function:
(defun ubddp-memoize-condition (x) (declare (ignorable x) (xargs :guard 't)) (consp x))
Theorem:
(defthm ubddp-compound-recognizer (implies (ubddp x) (or (consp x) (booleanp x))) :rule-classes :compound-recognizer)