This is similar to the fixtype set::set of osets.
Function:
(defun bequiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (bagp acl2::x) (bagp acl2::y)))) (equal (bfix acl2::x) (bfix acl2::y)))
Theorem:
(defthm bequiv-is-an-equivalence (and (booleanp (bequiv x y)) (bequiv x x) (implies (bequiv x y) (bequiv y x)) (implies (and (bequiv x y) (bequiv y z)) (bequiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm bequiv-implies-equal-bfix-1 (implies (bequiv acl2::x x-equiv) (equal (bfix acl2::x) (bfix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm bfix-under-bequiv (bequiv (bfix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-bfix-1-forward-to-bequiv (implies (equal (bfix acl2::x) acl2::y) (bequiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-bfix-2-forward-to-bequiv (implies (equal acl2::x (bfix acl2::y)) (bequiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm bequiv-of-bfix-1-forward (implies (bequiv (bfix acl2::x) acl2::y) (bequiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm bequiv-of-bfix-2-forward (implies (bequiv acl2::x (bfix acl2::y)) (bequiv acl2::x acl2::y)) :rule-classes :forward-chaining)