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