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