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