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