(alist-vals x) collects all values bound in an alist.
This is a "modern" equivalent of strip-cdrs, which properly respects the non-alist convention; see std/alists for discussion of this convention.
Note that the list of values returned by
Function:
(defun alist-vals (x) (declare (xargs :guard t)) (cond ((atom x) nil) ((atom (car x)) (alist-vals (cdr x))) (t (cons (cdar x) (alist-vals (cdr x))))))
Theorem:
(defthm alist-vals-when-atom (implies (atom x) (equal (alist-vals x) nil)))
Theorem:
(defthm alist-vals-of-cons (equal (alist-vals (cons a x)) (if (consp a) (cons (cdr a) (alist-vals x)) (alist-vals x))))
Theorem:
(defthm list-equiv-implies-equal-alist-vals-1 (implies (list-equiv x x-equiv) (equal (alist-vals x) (alist-vals x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm true-listp-of-alist-vals (true-listp (alist-vals x)) :rule-classes :type-prescription)
Theorem:
(defthm alist-vals-of-hons-acons (equal (alist-vals (hons-acons key val x)) (cons val (alist-vals x))))
Theorem:
(defthm alist-vals-of-pairlis$ (implies (equal (len keys) (len vals)) (equal (alist-vals (pairlis$ keys vals)) (list-fix vals))))
Theorem:
(defthm len-of-alist-vals (equal (len (alist-vals x)) (len (alist-keys x))))
Theorem:
(defthm alist-vals-of-append (equal (alist-vals (append x y)) (append (alist-vals x) (alist-vals y))))
Theorem:
(defthm alist-vals-of-revappend (equal (alist-vals (revappend x y)) (revappend (alist-vals x) (alist-vals y))))
Theorem:
(defthm member-equal-of-cdr-when-hons-assoc-equal (implies (hons-assoc-equal key map) (member-equal (cdr (hons-assoc-equal key map)) (alist-vals map))))