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