(maybe-posp-fix x) is the identity for maybe-posps, or
coerces any non-posp to
Performance note. In the execution this is just an inlined identity function, i.e., it should have zero runtime cost.
(defun maybe-posp-fix$inline (x) (declare (xargs :guard (maybe-posp x))) (mbe :logic (if x (pos-fix x) nil) :exec x))
(defthm maybe-posp-of-maybe-posp-fix (maybe-posp (maybe-posp-fix x)) :rule-classes (:rewrite :type-prescription))
(defthm maybe-posp-fix-when-maybe-posp (implies (maybe-posp x) (equal (maybe-posp-fix x) x)))
(defthm maybe-posp-fix-under-iff (iff (maybe-posp-fix x) x))
(defthm maybe-posp-fix-under-pos-equiv (pos-equiv (maybe-posp-fix x) x))