Check if a certificate creation event is possible, from the point of view of a correct endorser.
(create-endorser-possiblep cert vstate) → yes/no
The input
In addition to the conditions formalized in create-signer-possiblep, a correct validator endorses a certificate if additional conditions are satisfied. This function puts these additional conditions together with the conditions of that function.
Recall that, as noted in create-signer-possiblep, an endorser does not have access to the endorser addresses component of a certificate, because it only sees the proposal.
While create-signer-possiblep checks that the DAG has no certificate already with the same author and round, which is sufficient for the author to check, an endorser must also check that the set of endorsed author-round pairs does not already contain the author-round pair of the certificate. The presence of a pair in this set indicates that the validator has already endorsed a certificate with that author and round, but has not yet received the actual certificate from the network, and incorporated it into its own DAG. This check is not needed for the author, because it is an invariant, proved elsewhere, that the set of endorsed author-round pairs does not contain any pair with the validator as author.
Function:
(defun create-endorser-possiblep (cert vstate) (declare (xargs :guard (and (certificatep cert) (validator-statep vstate)))) (let ((__function__ 'create-endorser-possiblep)) (declare (ignorable __function__)) (b* (((certificate cert) cert) ((validator-state vstate) vstate) ((unless (create-signer-possiblep cert vstate)) nil) ((when (in (make-address+pos :address cert.author :pos cert.round) vstate.endorsed)) nil)) t)))
Theorem:
(defthm booleanp-of-create-endorser-possiblep (b* ((yes/no (create-endorser-possiblep cert vstate))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm create-endorser-possiblep-of-certificate-fix-cert (equal (create-endorser-possiblep (certificate-fix cert) vstate) (create-endorser-possiblep cert vstate)))
Theorem:
(defthm create-endorser-possiblep-certificate-equiv-congruence-on-cert (implies (certificate-equiv cert cert-equiv) (equal (create-endorser-possiblep cert vstate) (create-endorser-possiblep cert-equiv vstate))) :rule-classes :congruence)
Theorem:
(defthm create-endorser-possiblep-of-validator-state-fix-vstate (equal (create-endorser-possiblep cert (validator-state-fix vstate)) (create-endorser-possiblep cert vstate)))
Theorem:
(defthm create-endorser-possiblep-validator-state-equiv-congruence-on-vstate (implies (validator-state-equiv vstate vstate-equiv) (equal (create-endorser-possiblep cert vstate) (create-endorser-possiblep cert vstate-equiv))) :rule-classes :congruence)