Fixing function for int structures.
Function:
(defun int-fix$inline (x) (declare (xargs :guard (intp x))) (let ((__function__ 'int-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((size (bit-size-fix (std::da-nth 0 (cdr x)))) (value (ifix (std::da-nth 1 (cdr x))))) (let ((value (signed-byte-fix size value))) (cons :int (list size value)))) :exec x)))
Theorem:
(defthm intp-of-int-fix (b* ((new-x (int-fix$inline x))) (intp new-x)) :rule-classes :rewrite)
Theorem:
(defthm int-fix-when-intp (implies (intp x) (equal (int-fix x) x)))
Function:
(defun int-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (intp acl2::x) (intp acl2::y)))) (equal (int-fix acl2::x) (int-fix acl2::y)))
Theorem:
(defthm int-equiv-is-an-equivalence (and (booleanp (int-equiv x y)) (int-equiv x x) (implies (int-equiv x y) (int-equiv y x)) (implies (and (int-equiv x y) (int-equiv y z)) (int-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm int-equiv-implies-equal-int-fix-1 (implies (int-equiv acl2::x x-equiv) (equal (int-fix acl2::x) (int-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm int-fix-under-int-equiv (int-equiv (int-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-int-fix-1-forward-to-int-equiv (implies (equal (int-fix acl2::x) acl2::y) (int-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-int-fix-2-forward-to-int-equiv (implies (equal acl2::x (int-fix acl2::y)) (int-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm int-equiv-of-int-fix-1-forward (implies (int-equiv (int-fix acl2::x) acl2::y) (int-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm int-equiv-of-int-fix-2-forward (implies (int-equiv acl2::x (int-fix acl2::y)) (int-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)