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