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