Fixing function for maybe-integer structures.
(maybe-integer-fix x) → new-x
Function:
(defun maybe-integer-fix$inline (x) (declare (xargs :guard (maybe-integer-p x))) (let ((acl2::__function__ 'maybe-integer-fix)) (declare (ignorable acl2::__function__)) (mbe :logic (cond ((not x) nil) (t (b* ((fty::val (ifix x))) fty::val))) :exec x)))
Theorem:
(defthm maybe-integer-p-of-maybe-integer-fix (b* ((new-x (maybe-integer-fix$inline x))) (maybe-integer-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm maybe-integer-fix-when-maybe-integer-p (implies (maybe-integer-p x) (equal (maybe-integer-fix x) x)))
Function:
(defun maybe-integer-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (maybe-integer-p acl2::x) (maybe-integer-p acl2::y)))) (equal (maybe-integer-fix acl2::x) (maybe-integer-fix acl2::y)))
Theorem:
(defthm maybe-integer-equiv-is-an-equivalence (and (booleanp (maybe-integer-equiv x y)) (maybe-integer-equiv x x) (implies (maybe-integer-equiv x y) (maybe-integer-equiv y x)) (implies (and (maybe-integer-equiv x y) (maybe-integer-equiv y z)) (maybe-integer-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm maybe-integer-equiv-implies-equal-maybe-integer-fix-1 (implies (maybe-integer-equiv acl2::x x-equiv) (equal (maybe-integer-fix acl2::x) (maybe-integer-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm maybe-integer-fix-under-maybe-integer-equiv (maybe-integer-equiv (maybe-integer-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-maybe-integer-fix-1-forward-to-maybe-integer-equiv (implies (equal (maybe-integer-fix acl2::x) acl2::y) (maybe-integer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-maybe-integer-fix-2-forward-to-maybe-integer-equiv (implies (equal acl2::x (maybe-integer-fix acl2::y)) (maybe-integer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm maybe-integer-equiv-of-maybe-integer-fix-1-forward (implies (maybe-integer-equiv (maybe-integer-fix acl2::x) acl2::y) (maybe-integer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm maybe-integer-equiv-of-maybe-integer-fix-2-forward (implies (maybe-integer-equiv acl2::x (maybe-integer-fix acl2::y)) (maybe-integer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)