(set-equiv x y) is an equivalence relation that determines
whether
This is a very useful equivalence relation; typically any function
that treats lists as sets will have good
We prove various congruences and rewrites relating
Function:
(defun set-equiv (x y) (declare (xargs :guard (and (true-listp x) (true-listp y)))) (and (subsetp-equal x y) (subsetp-equal y x)))
Theorem:
(defthm set-equiv-asym (equal (set-equiv x y) (set-equiv y x)))
Theorem:
(defthm set-equiv-is-an-equivalence (and (booleanp (set-equiv x y)) (set-equiv x x) (implies (set-equiv x y) (set-equiv y x)) (implies (and (set-equiv x y) (set-equiv y z)) (set-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm list-equiv-refines-set-equiv (implies (list-equiv x y) (set-equiv x y)) :rule-classes (:refinement))
Theorem:
(defthm set-equiv-congruence-over-elementlist-projection (implies (set-equiv x y) (set-equiv (elementlist-projection x) (elementlist-projection y))) :rule-classes :congruence)
Theorem:
(defthm set-equiv-of-nil (equal (set-equiv nil x) (atom x)))