Measure for recurring over bexp structures.
Function:
(defun bexp-count (x) (declare (xargs :guard (bexpp x))) (let ((__function__ 'bexp-count)) (declare (ignorable __function__)) (case (bexp-kind x) (:const 1) (:equal 1) (:less 1) (:not (+ 2 (bexp-count (bexp-not->arg x)))) (:and (+ 3 (bexp-count (bexp-and->left x)) (bexp-count (bexp-and->right x)))))))
Theorem:
(defthm natp-of-bexp-count (b* ((count (bexp-count x))) (natp count)) :rule-classes :type-prescription)
Theorem:
(defthm bexp-count-of-bexp-fix-x (equal (bexp-count (bexp-fix x)) (bexp-count x)))
Theorem:
(defthm bexp-count-bexp-equiv-congruence-on-x (implies (bexp-equiv x x-equiv) (equal (bexp-count x) (bexp-count x-equiv))) :rule-classes :congruence)
Theorem:
(defthm bexp-count-of-bexp-not (implies t (< (+ (bexp-count arg)) (bexp-count (bexp-not arg)))) :rule-classes :linear)
Theorem:
(defthm bexp-count-of-bexp-not->arg (implies (equal (bexp-kind x) :not) (< (bexp-count (bexp-not->arg x)) (bexp-count x))) :rule-classes :linear)
Theorem:
(defthm bexp-count-of-bexp-and (implies t (< (+ (bexp-count left) (bexp-count right)) (bexp-count (bexp-and left right)))) :rule-classes :linear)
Theorem:
(defthm bexp-count-of-bexp-and->left (implies (equal (bexp-kind x) :and) (< (bexp-count (bexp-and->left x)) (bexp-count x))) :rule-classes :linear)
Theorem:
(defthm bexp-count-of-bexp-and->right (implies (equal (bexp-kind x) :and) (< (bexp-count (bexp-and->right x)) (bexp-count x))) :rule-classes :linear)