Check if two sets of certificates are mutually unequivocal.
This is similar to certificate-set-unequivocalp (note the singular `set' vs. the plural `sets'), but it checks certificates from different sets. It requires that if both sets have certificates with the same author and round, the certificates are equal.
This is an invariant that applies across DAGs of different validators. Here we just define the predicate.
Note that this invariant does not imply that the two sets are unequivocal: one set may well have multiple different certificates with the same author and round, so long as that combination of author and round does not appear in the other set.
The rule
The theorem
Theorem:
(defthm certificate-sets-unequivocalp-necc (implies (not (if (and (in cert1 certs1) (in cert2 certs2) (equal (certificate->author cert1) (certificate->author cert2)) (equal (certificate->round cert1) (certificate->round cert2))) (if (equal cert1 cert2) t nil) t)) (not (certificate-sets-unequivocalp certs1 certs2))))
Theorem:
(defthm booleanp-of-certificate-sets-unequivocalp (b* ((yes/no (certificate-sets-unequivocalp certs1 certs2))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm certificate-sets-unequivocalp-commutative (equal (certificate-sets-unequivocalp certs1 certs2) (certificate-sets-unequivocalp certs2 certs1)))
Theorem:
(defthm certificate-sets-unequivocalp-when-subsets (implies (and (certificate-sets-unequivocalp certs1 certs2) (subset certs01 certs1) (subset certs02 certs2)) (certificate-sets-unequivocalp certs01 certs02)))
Theorem:
(defthm certificate-sets-unequivocalp-when-emptyp (implies (or (emptyp certs1) (emptyp certs2)) (certificate-sets-unequivocalp certs1 certs2)))
Theorem:
(defthm certificate-sets-unequivocalp-of-same-set (equal (certificate-sets-unequivocalp certs certs) (certificate-set-unequivocalp certs)))
Theorem:
(defthm certificate-sets-unequivocalp-of-same-set-converse (equal (certificate-set-unequivocalp certs) (certificate-sets-unequivocalp certs certs)))
Theorem:
(defthm certificate-sets-unequivocalp-of-insert (implies (and (certificate-setp certs2) (certificate-set-unequivocalp certs2)) (equal (certificate-sets-unequivocalp (insert cert certs1) certs2) (and (certificate-sets-unequivocalp certs1 certs2) (or (in cert certs1) (in cert certs2) (not (cert-with-author+round (certificate->author cert) (certificate->round cert) certs2)))))))
Theorem:
(defthm certificate-set-unequivocalp-of-union (implies (and (certificate-set-unequivocalp certs1) (certificate-set-unequivocalp certs2) (certificate-sets-unequivocalp certs1 certs2)) (certificate-set-unequivocalp (union certs1 certs2))))