Fixing function for const structures.
Function:
(defun const-fix$inline (x) (declare (xargs :guard (constp x))) (let ((__function__ 'const-fix)) (declare (ignorable __function__)) (mbe :logic (case (const-kind x) (:int (b* ((get (iconst-fix (std::da-nth 0 (cdr x))))) (cons :int (list get)))) (:float (cons :float (list))) (:enum (b* ((get (ident-fix (std::da-nth 0 (cdr x))))) (cons :enum (list get)))) (:char (cons :char (list)))) :exec x)))
Theorem:
(defthm constp-of-const-fix (b* ((new-x (const-fix$inline x))) (constp new-x)) :rule-classes :rewrite)
Theorem:
(defthm const-fix-when-constp (implies (constp x) (equal (const-fix x) x)))
Function:
(defun const-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (constp acl2::x) (constp acl2::y)))) (equal (const-fix acl2::x) (const-fix acl2::y)))
Theorem:
(defthm const-equiv-is-an-equivalence (and (booleanp (const-equiv x y)) (const-equiv x x) (implies (const-equiv x y) (const-equiv y x)) (implies (and (const-equiv x y) (const-equiv y z)) (const-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm const-equiv-implies-equal-const-fix-1 (implies (const-equiv acl2::x x-equiv) (equal (const-fix acl2::x) (const-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm const-fix-under-const-equiv (const-equiv (const-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-const-fix-1-forward-to-const-equiv (implies (equal (const-fix acl2::x) acl2::y) (const-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-const-fix-2-forward-to-const-equiv (implies (equal acl2::x (const-fix acl2::y)) (const-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm const-equiv-of-const-fix-1-forward (implies (const-equiv (const-fix acl2::x) acl2::y) (const-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm const-equiv-of-const-fix-2-forward (implies (const-equiv acl2::x (const-fix acl2::y)) (const-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm const-kind$inline-of-const-fix-x (equal (const-kind$inline (const-fix x)) (const-kind$inline x)))
Theorem:
(defthm const-kind$inline-const-equiv-congruence-on-x (implies (const-equiv x x-equiv) (equal (const-kind$inline x) (const-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-const-fix (consp (const-fix x)) :rule-classes :type-prescription)