Fixing function for num-val structures.
Function:
(defun num-val-fix$inline (x) (declare (xargs :guard (num-val-p x))) (let ((__function__ 'num-val-fix)) (declare (ignorable __function__)) (mbe :logic (case (num-val-kind x) (:direct (b* ((base (num-base-fix (std::da-nth 0 (cdr x)))) (get (nat-list-fix (std::da-nth 1 (cdr x))))) (cons :direct (list base get)))) (:range (b* ((base (num-base-fix (std::da-nth 0 (cdr x)))) (min (nfix (std::da-nth 1 (cdr x)))) (max (nfix (std::da-nth 2 (cdr x))))) (cons :range (list base min max))))) :exec x)))
Theorem:
(defthm num-val-p-of-num-val-fix (b* ((new-x (num-val-fix$inline x))) (num-val-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm num-val-fix-when-num-val-p (implies (num-val-p x) (equal (num-val-fix x) x)))
Function:
(defun num-val-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (num-val-p acl2::x) (num-val-p acl2::y)))) (equal (num-val-fix acl2::x) (num-val-fix acl2::y)))
Theorem:
(defthm num-val-equiv-is-an-equivalence (and (booleanp (num-val-equiv x y)) (num-val-equiv x x) (implies (num-val-equiv x y) (num-val-equiv y x)) (implies (and (num-val-equiv x y) (num-val-equiv y z)) (num-val-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm num-val-equiv-implies-equal-num-val-fix-1 (implies (num-val-equiv acl2::x x-equiv) (equal (num-val-fix acl2::x) (num-val-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm num-val-fix-under-num-val-equiv (num-val-equiv (num-val-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-num-val-fix-1-forward-to-num-val-equiv (implies (equal (num-val-fix acl2::x) acl2::y) (num-val-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-num-val-fix-2-forward-to-num-val-equiv (implies (equal acl2::x (num-val-fix acl2::y)) (num-val-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm num-val-equiv-of-num-val-fix-1-forward (implies (num-val-equiv (num-val-fix acl2::x) acl2::y) (num-val-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm num-val-equiv-of-num-val-fix-2-forward (implies (num-val-equiv acl2::x (num-val-fix acl2::y)) (num-val-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm num-val-kind$inline-of-num-val-fix-x (equal (num-val-kind$inline (num-val-fix x)) (num-val-kind$inline x)))
Theorem:
(defthm num-val-kind$inline-num-val-equiv-congruence-on-x (implies (num-val-equiv x x-equiv) (equal (num-val-kind$inline x) (num-val-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-num-val-fix (consp (num-val-fix x)) :rule-classes :type-prescription)