(undup x) → new-x
Function:
(defun undup (x) (declare (xargs :guard (true-listp x))) (let ((__function__ 'undup)) (declare (ignorable __function__)) (mbe :logic (if (atom x) nil (cons (car x) (undup (remove-equal (car x) (cdr x))))) :exec (undup-exec x nil))))
Theorem:
(defthm true-listp-of-undup (b* ((new-x (undup x))) (true-listp new-x)) :rule-classes :rewrite)
Theorem:
(defthm undup-exec-is-undup (b* ((?new-x (undup-exec x acc))) (equal new-x (revappend (alist-keys acc) (undup (set-difference-equal x (alist-keys acc)))))))
Theorem:
(defthm element-list-p-of-undup (implies (acl2::element-list-p x) (acl2::element-list-p (undup x))) :rule-classes :rewrite)
Theorem:
(defthm consp-of-undup (b* ((?new-x (undup x))) (iff (consp new-x) (consp x))))
Theorem:
(defthm undup-of-remove (equal (remove k (undup x)) (undup (remove k x))))
Theorem:
(defthm undup-of-undup (equal (undup (undup x)) (undup x)))
Theorem:
(defthm undup-of-append (equal (undup (append x y)) (append (undup x) (undup (set-difference$ y x)))))
Theorem:
(defthm member-of-undup (iff (member k (undup x)) (member k x)))
Theorem:
(defthm undup-under-set-equiv (set-equiv (undup x) x))
Theorem:
(defthm undup-of-set-difference (equal (undup (set-difference$ x y)) (set-difference$ (undup x) y)))
Theorem:
(defthm undup-of-list-fix-x (equal (undup (list-fix x)) (undup x)))
Theorem:
(defthm undup-list-equiv-congruence-on-x (implies (list-equiv x x-equiv) (equal (undup x) (undup x-equiv))) :rule-classes :congruence)