Fixing function for string-result structures.
(string-result-fix x) → new-x
Function:
(defun string-result-fix$inline (x) (declare (xargs :guard (string-resultp x))) (let ((__function__ 'string-result-fix)) (declare (ignorable __function__)) (mbe :logic (case (string-result-kind x) (:ok (b* ((get (str-fix x))) get)) (:err (b* ((get (fty::reserr-fix x))) get))) :exec x)))
Theorem:
(defthm string-resultp-of-string-result-fix (b* ((new-x (string-result-fix$inline x))) (string-resultp new-x)) :rule-classes :rewrite)
Theorem:
(defthm string-result-fix-when-string-resultp (implies (string-resultp x) (equal (string-result-fix x) x)))
Function:
(defun string-result-equiv$inline (x y) (declare (xargs :guard (and (string-resultp x) (string-resultp y)))) (equal (string-result-fix x) (string-result-fix y)))
Theorem:
(defthm string-result-equiv-is-an-equivalence (and (booleanp (string-result-equiv x y)) (string-result-equiv x x) (implies (string-result-equiv x y) (string-result-equiv y x)) (implies (and (string-result-equiv x y) (string-result-equiv y z)) (string-result-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm string-result-equiv-implies-equal-string-result-fix-1 (implies (string-result-equiv x x-equiv) (equal (string-result-fix x) (string-result-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm string-result-fix-under-string-result-equiv (string-result-equiv (string-result-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-string-result-fix-1-forward-to-string-result-equiv (implies (equal (string-result-fix x) y) (string-result-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-string-result-fix-2-forward-to-string-result-equiv (implies (equal x (string-result-fix y)) (string-result-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm string-result-equiv-of-string-result-fix-1-forward (implies (string-result-equiv (string-result-fix x) y) (string-result-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm string-result-equiv-of-string-result-fix-2-forward (implies (string-result-equiv x (string-result-fix y)) (string-result-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm string-result-kind$inline-of-string-result-fix-x (equal (string-result-kind$inline (string-result-fix x)) (string-result-kind$inline x)))
Theorem:
(defthm string-result-kind$inline-string-result-equiv-congruence-on-x (implies (string-result-equiv x x-equiv) (equal (string-result-kind$inline x) (string-result-kind$inline x-equiv))) :rule-classes :congruence)