Fixing function for obags.
This is similar to sfix for osets.
Function:
(defun bfix (x) (declare (xargs :guard (bagp x))) (let ((__function__ 'bfix)) (declare (ignorable __function__)) (mbe :logic (if (bagp x) x nil) :exec x)))
Theorem:
(defthm bagp-of-bfix (b* ((fixed-x (bfix x))) (bagp fixed-x)) :rule-classes :rewrite)
Theorem:
(defthm bfix-when-bagp (implies (bagp x) (equal (bfix x) x)))