Retrieve, from a set of certificates, the subset of certificates with author in a given set and with a given round.
(certs-with-authors+round authors round certs) → certs-with-authors-and-round
Function:
(defun certs-with-authors+round (authors round certs) (declare (xargs :guard (and (address-setp authors) (posp round) (certificate-setp certs)))) (let ((__function__ 'certs-with-authors+round)) (declare (ignorable __function__)) (b* (((when (emptyp certs)) nil) ((certificate cert) (head certs))) (if (and (in cert.author (address-set-fix authors)) (equal cert.round (pos-fix round))) (insert (certificate-fix cert) (certs-with-authors+round authors round (tail certs))) (certs-with-authors+round authors round (tail certs))))))
Theorem:
(defthm certificate-setp-of-certs-with-authors+round (b* ((certs-with-authors-and-round (certs-with-authors+round authors round certs))) (certificate-setp certs-with-authors-and-round)) :rule-classes :rewrite)
Theorem:
(defthm certs-with-authors+round-of-address-set-fix-authors (equal (certs-with-authors+round (address-set-fix authors) round certs) (certs-with-authors+round authors round certs)))
Theorem:
(defthm certs-with-authors+round-address-set-equiv-congruence-on-authors (implies (address-set-equiv authors authors-equiv) (equal (certs-with-authors+round authors round certs) (certs-with-authors+round authors-equiv round certs))) :rule-classes :congruence)
Theorem:
(defthm certs-with-authors+round-of-pos-fix-round (equal (certs-with-authors+round authors (pos-fix round) certs) (certs-with-authors+round authors round certs)))
Theorem:
(defthm certs-with-authors+round-pos-equiv-congruence-on-round (implies (acl2::pos-equiv round round-equiv) (equal (certs-with-authors+round authors round certs) (certs-with-authors+round authors round-equiv certs))) :rule-classes :congruence)
Theorem:
(defthm certs-with-authors+round-subset (implies (certificate-setp certs) (b* ((?certs-with-authors-and-round (certs-with-authors+round authors round certs))) (subset certs-with-authors-and-round certs))))
Theorem:
(defthm certs-with-authors+round-of-nil-certs (equal (certs-with-authors+round authors round nil) nil))
Theorem:
(defthm certs-with-authors+round-when-emptyp-authors (implies (emptyp authors) (equal (certs-with-authors+round authors round certs) nil)))
Theorem:
(defthm in-of-certs-with-authors+round (implies (certificate-setp certs) (equal (in cert (certs-with-authors+round authors round certs)) (and (in cert certs) (equal (certificate->round cert) (pos-fix round)) (in (certificate->author cert) (address-set-fix authors))))))
Theorem:
(defthm certs-with-authors+round-to-authors-of-round (implies (certificate-setp certs) (equal (certs-with-authors+round authors round certs) (certs-with-authors authors (certs-with-round round certs)))))
Theorem:
(defthm certs-with-authors+round-to-round-of-authors (implies (certificate-setp certs) (equal (certs-with-authors+round authors round certs) (certs-with-round round (certs-with-authors authors certs)))))
Theorem:
(defthm certificate-set->round-set-of-certs-with-authors+round (equal (certificate-set->round-set (certs-with-authors+round authors round certs)) (if (emptyp (certs-with-authors+round authors round certs)) nil (insert (pos-fix round) nil))))
Theorem:
(defthm certificate-set->round-set-of-certs-with-authors+round-not-empty (b* ((rounds (certificate-set->round-set (certs-with-authors+round authors round certs)))) (implies (not (emptyp rounds)) (equal rounds (insert (pos-fix round) nil)))))