Fixing function for aexp structures.
Function:
(defun aexp-fix$inline (x) (declare (xargs :guard (aexpp x))) (let ((__function__ 'aexp-fix)) (declare (ignorable __function__)) (mbe :logic (case (aexp-kind x) (:const (b* ((value (ifix (std::da-nth 0 (cdr x))))) (cons :const (list value)))) (:var (b* ((name (str-fix (std::da-nth 0 (cdr x))))) (cons :var (list name)))) (:add (b* ((left (aexp-fix (std::da-nth 0 (cdr x)))) (right (aexp-fix (std::da-nth 1 (cdr x))))) (cons :add (list left right)))) (:mul (b* ((left (aexp-fix (std::da-nth 0 (cdr x)))) (right (aexp-fix (std::da-nth 1 (cdr x))))) (cons :mul (list left right))))) :exec x)))
Theorem:
(defthm aexpp-of-aexp-fix (b* ((new-x (aexp-fix$inline x))) (aexpp new-x)) :rule-classes :rewrite)
Theorem:
(defthm aexp-fix-when-aexpp (implies (aexpp x) (equal (aexp-fix x) x)))
Function:
(defun aexp-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (aexpp acl2::x) (aexpp acl2::y)))) (equal (aexp-fix acl2::x) (aexp-fix acl2::y)))
Theorem:
(defthm aexp-equiv-is-an-equivalence (and (booleanp (aexp-equiv x y)) (aexp-equiv x x) (implies (aexp-equiv x y) (aexp-equiv y x)) (implies (and (aexp-equiv x y) (aexp-equiv y z)) (aexp-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm aexp-equiv-implies-equal-aexp-fix-1 (implies (aexp-equiv acl2::x x-equiv) (equal (aexp-fix acl2::x) (aexp-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm aexp-fix-under-aexp-equiv (aexp-equiv (aexp-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-aexp-fix-1-forward-to-aexp-equiv (implies (equal (aexp-fix acl2::x) acl2::y) (aexp-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-aexp-fix-2-forward-to-aexp-equiv (implies (equal acl2::x (aexp-fix acl2::y)) (aexp-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm aexp-equiv-of-aexp-fix-1-forward (implies (aexp-equiv (aexp-fix acl2::x) acl2::y) (aexp-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm aexp-equiv-of-aexp-fix-2-forward (implies (aexp-equiv acl2::x (aexp-fix acl2::y)) (aexp-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm aexp-kind$inline-of-aexp-fix-x (equal (aexp-kind$inline (aexp-fix x)) (aexp-kind$inline x)))
Theorem:
(defthm aexp-kind$inline-aexp-equiv-congruence-on-x (implies (aexp-equiv x x-equiv) (equal (aexp-kind$inline x) (aexp-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-aexp-fix (consp (aexp-fix x)) :rule-classes :type-prescription)