Fixing function for expr-grade structures.
(expr-grade-fix x) → new-x
Function:
(defun expr-grade-fix$inline (x) (declare (xargs :guard (expr-gradep x))) (let ((__function__ 'expr-grade-fix)) (declare (ignorable __function__)) (mbe :logic (case (expr-grade-kind x) (:top (cons :top (list))) (:assignment (cons :assignment (list))) (:conditional (cons :conditional (list))) (:logical-or (cons :logical-or (list))) (:logical-and (cons :logical-and (list))) (:ior (cons :ior (list))) (:xor (cons :xor (list))) (:and (cons :and (list))) (:equality (cons :equality (list))) (:relational (cons :relational (list))) (:shift (cons :shift (list))) (:additive (cons :additive (list))) (:multiplicative (cons :multiplicative (list))) (:cast (cons :cast (list))) (:unary (cons :unary (list))) (:postfix (cons :postfix (list))) (:primary (cons :primary (list)))) :exec x)))
Theorem:
(defthm expr-gradep-of-expr-grade-fix (b* ((new-x (expr-grade-fix$inline x))) (expr-gradep new-x)) :rule-classes :rewrite)
Theorem:
(defthm expr-grade-fix-when-expr-gradep (implies (expr-gradep x) (equal (expr-grade-fix x) x)))
Function:
(defun expr-grade-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (expr-gradep acl2::x) (expr-gradep acl2::y)))) (equal (expr-grade-fix acl2::x) (expr-grade-fix acl2::y)))
Theorem:
(defthm expr-grade-equiv-is-an-equivalence (and (booleanp (expr-grade-equiv x y)) (expr-grade-equiv x x) (implies (expr-grade-equiv x y) (expr-grade-equiv y x)) (implies (and (expr-grade-equiv x y) (expr-grade-equiv y z)) (expr-grade-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm expr-grade-equiv-implies-equal-expr-grade-fix-1 (implies (expr-grade-equiv acl2::x x-equiv) (equal (expr-grade-fix acl2::x) (expr-grade-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm expr-grade-fix-under-expr-grade-equiv (expr-grade-equiv (expr-grade-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-expr-grade-fix-1-forward-to-expr-grade-equiv (implies (equal (expr-grade-fix acl2::x) acl2::y) (expr-grade-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-expr-grade-fix-2-forward-to-expr-grade-equiv (implies (equal acl2::x (expr-grade-fix acl2::y)) (expr-grade-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm expr-grade-equiv-of-expr-grade-fix-1-forward (implies (expr-grade-equiv (expr-grade-fix acl2::x) acl2::y) (expr-grade-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm expr-grade-equiv-of-expr-grade-fix-2-forward (implies (expr-grade-equiv acl2::x (expr-grade-fix acl2::y)) (expr-grade-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm expr-grade-kind$inline-of-expr-grade-fix-x (equal (expr-grade-kind$inline (expr-grade-fix x)) (expr-grade-kind$inline x)))
Theorem:
(defthm expr-grade-kind$inline-expr-grade-equiv-congruence-on-x (implies (expr-grade-equiv x x-equiv) (equal (expr-grade-kind$inline x) (expr-grade-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-expr-grade-fix (consp (expr-grade-fix x)) :rule-classes :type-prescription)