Create a count-alistp for
(create-nth-choice-count-alist n cids xs) → count-alst
Function:
(defun create-nth-choice-count-alist (n cids xs) (declare (xargs :guard (and (natp n) (nat-listp cids) (irv-ballot-p xs)))) (let ((__function__ 'create-nth-choice-count-alist)) (declare (ignorable __function__)) (b* ((choice-lst (make-nth-choice-list n xs)) (count-alst (create-count-alist cids choice-lst))) count-alst)))
Theorem:
(defthm alistp-of-create-nth-choice-count-alist (b* ((count-alst (create-nth-choice-count-alist n cids xs))) (alistp count-alst)) :rule-classes :rewrite)
Theorem:
(defthm count-alistp-of-create-nth-choice-count-alist (b* ((?count-alst (create-nth-choice-count-alist n cids xs))) (implies (nat-listp cids) (count-alistp count-alst))))
Theorem:
(defthm strip-cars-of-create-nth-choice-count-alist-is-sorted-if-cids-is-sorted (b* ((?count-alst (create-nth-choice-count-alist n cids xs))) (implies (acl2::<-ordered-p cids) (acl2::<-ordered-p (strip-cars count-alst)))))
Theorem:
(defthm consp-of-create-nth-choice-count-alist (equal (consp (create-nth-choice-count-alist n cids xs)) (consp cids)))
Theorem:
(defthm strip-cars-of-create-nth-choice-count-alist-equal-under-set-equiv (b* ((?count-alst (create-nth-choice-count-alist n cids xs))) (acl2::set-equiv (strip-cars count-alst) cids)))
Theorem:
(defthm no-duplicatesp-equal-of-strip-cars-of-create-nth-choice-count-alist (implies (no-duplicatesp-equal cids) (no-duplicatesp-equal (strip-cars (create-nth-choice-count-alist n cids xs)))))
Theorem:
(defthm member-of-strip-cars-of-create-nth-choice-count-alist (implies (member-equal id cids) (member-equal id (strip-cars (create-nth-choice-count-alist n cids xs)))))
Theorem:
(defthm member-of-strip-cdrs-of-create-nth-choice-count-alist (b* ((count-alst (create-nth-choice-count-alist n cids xs))) (implies (member-equal id cids) (member-equal (cdr (assoc-equal id count-alst)) (strip-cdrs count-alst)))))
Theorem:
(defthm len-of-create-nth-choice-count-alist-0th-choice (equal (len (create-nth-choice-count-alist 0 cids xs)) (len cids)))