Fixing function for rlp-error structures.
(rlp-error-fix x) → new-x
Function:
(defun rlp-error-fix$inline (x) (declare (xargs :guard (rlp-error-p x))) (let ((__function__ 'rlp-error-fix)) (declare (ignorable __function__)) (mbe :logic (case (rlp-error-kind x) (:no-bytes (cons :no-bytes (list))) (:fewer-bytes-than-short-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x)))) (required (nfix (std::da-nth 1 (cdr x)))) (available (nfix (std::da-nth 2 (cdr x))))) (cons :fewer-bytes-than-short-length (list fragment required available)))) (:fewer-bytes-than-length-of-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x)))) (required (nfix (std::da-nth 1 (cdr x)))) (available (nfix (std::da-nth 2 (cdr x))))) (cons :fewer-bytes-than-length-of-length (list fragment required available)))) (:fewer-bytes-than-long-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x)))) (required (nfix (std::da-nth 1 (cdr x)))) (available (nfix (std::da-nth 2 (cdr x))))) (cons :fewer-bytes-than-long-length (list fragment required available)))) (:leading-zeros-in-long-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :leading-zeros-in-long-length (list fragment)))) (:non-optimal-short-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :non-optimal-short-length (list fragment)))) (:non-optimal-long-length (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :non-optimal-long-length (list fragment)))) (:subtree (b* ((error (rlp-error-fix (std::da-nth 0 (cdr x))))) (cons :subtree (list error)))) (:extra-bytes (b* ((bytes (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :extra-bytes (list bytes)))) (:branch-tree (b* ((fragment (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :branch-tree (list fragment)))) (:leading-zeros-in-scalar (b* ((bytes (byte-list-fix (std::da-nth 0 (cdr x))))) (cons :leading-zeros-in-scalar (list bytes))))) :exec x)))
Theorem:
(defthm rlp-error-p-of-rlp-error-fix (b* ((new-x (rlp-error-fix$inline x))) (rlp-error-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm rlp-error-fix-when-rlp-error-p (implies (rlp-error-p x) (equal (rlp-error-fix x) x)))
Function:
(defun rlp-error-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (rlp-error-p acl2::x) (rlp-error-p acl2::y)))) (equal (rlp-error-fix acl2::x) (rlp-error-fix acl2::y)))
Theorem:
(defthm rlp-error-equiv-is-an-equivalence (and (booleanp (rlp-error-equiv x y)) (rlp-error-equiv x x) (implies (rlp-error-equiv x y) (rlp-error-equiv y x)) (implies (and (rlp-error-equiv x y) (rlp-error-equiv y z)) (rlp-error-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm rlp-error-equiv-implies-equal-rlp-error-fix-1 (implies (rlp-error-equiv acl2::x x-equiv) (equal (rlp-error-fix acl2::x) (rlp-error-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm rlp-error-fix-under-rlp-error-equiv (rlp-error-equiv (rlp-error-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-rlp-error-fix-1-forward-to-rlp-error-equiv (implies (equal (rlp-error-fix acl2::x) acl2::y) (rlp-error-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-rlp-error-fix-2-forward-to-rlp-error-equiv (implies (equal acl2::x (rlp-error-fix acl2::y)) (rlp-error-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm rlp-error-equiv-of-rlp-error-fix-1-forward (implies (rlp-error-equiv (rlp-error-fix acl2::x) acl2::y) (rlp-error-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm rlp-error-equiv-of-rlp-error-fix-2-forward (implies (rlp-error-equiv acl2::x (rlp-error-fix acl2::y)) (rlp-error-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm rlp-error-kind$inline-of-rlp-error-fix-x (equal (rlp-error-kind$inline (rlp-error-fix x)) (rlp-error-kind$inline x)))
Theorem:
(defthm rlp-error-kind$inline-rlp-error-equiv-congruence-on-x (implies (rlp-error-equiv x x-equiv) (equal (rlp-error-kind$inline x) (rlp-error-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-rlp-error-fix (consp (rlp-error-fix x)) :rule-classes :type-prescription)