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