Get a sorted list of candidate IDs currently in the election
(candidate-ids xs) → cids
Function:
(defun candidate-ids (xs) (declare (xargs :guard (irv-ballot-p xs))) (let ((__function__ 'candidate-ids)) (declare (ignorable __function__)) (acl2::<-sort (remove-duplicates-equal (acl2::flatten xs)))))
Theorem:
(defthm true-listp-of-candidate-ids (b* ((cids (candidate-ids xs))) (true-listp cids)) :rule-classes :type-prescription)
Theorem:
(defthm nat-listp-of-candidate-ids (implies (irv-ballot-p xs) (nat-listp (candidate-ids xs))))
Theorem:
(defthm consp-of-candidate-ids (implies (and (non-empty-true-list-listp xs) (consp xs)) (consp (candidate-ids xs))) :rule-classes :type-prescription)
Theorem:
(defthm subset-of-candidate-ids-cdr (subsetp-equal (candidate-ids (cdr xs)) (candidate-ids xs)))
Theorem:
(defthm nat-listp-and-subsetp-equal (implies (and (subsetp-equal x y) (true-listp x) (nat-listp y)) (nat-listp x)))
Theorem:
(defthm nat-listp-and-set-equiv (implies (and (acl2::set-equiv x y) (true-listp x) (true-listp y)) (iff (nat-listp x) (nat-listp y))))
Theorem:
(defthm duplicity-of-element-in-no-duplicatesp-list (implies (and (member-equal e x) (no-duplicatesp-equal x)) (equal (acl2::duplicity e x) 1)))
Theorem:
(defthm cdr-no-duplicatesp-equal (implies (no-duplicatesp-equal xs) (no-duplicatesp-equal (cdr xs))))
Theorem:
(defthm no-duplicatesp-equal-of-remove-equal (implies (no-duplicatesp-equal x) (no-duplicatesp-equal (remove-equal id x))))
Theorem:
(defthm remove-equal-car-lst-no-duplicatesp-equal (implies (and (no-duplicatesp-equal lst) (true-listp lst)) (equal (remove-equal (car lst) (cdr lst)) (cdr lst))))
Theorem:
(defthm subset-member-remove-equal-lemma (implies (and (subsetp-equal y (cons e x)) (member-equal e y)) (subsetp-equal (remove-equal e y) x)))
Theorem:
(defthm equal-len-of-no-duplicates-set-equivs (implies (and (acl2::set-equiv x y) (no-duplicatesp-equal x) (no-duplicatesp-equal y)) (equal (len x) (len y))))
Theorem:
(defthm candidate-ids-nat-listp-smaller (implies (nat-listp (candidate-ids xs)) (nat-listp (candidate-ids (cdr xs)))))
Theorem:
(defthm subset-of-flatten (implies (subsetp-equal ys xs) (subsetp-equal (acl2::flatten ys) (acl2::flatten xs))))
Theorem:
(defthm subsetp-of-irv-ballots-implies-subsetp-of-candidate-ids (implies (subsetp-equal ys xs) (subsetp-equal (candidate-ids ys) (candidate-ids xs))))
Theorem:
(defthm no-duplicates-in-candidate-ids (no-duplicatesp-equal (candidate-ids xs)))