Add an author-round pair to the set of endorsed pairs of all the correct validators in a given set of endorsers.
(add-endorsed endorsers author round systate) → new-systate
When a new certificate is created by a (correct or faulty) validator,
it must have been signed by the validators
whose addresses are in the
Function:
(defun add-endorsed (endorsers author round systate) (declare (xargs :guard (and (address-setp endorsers) (addressp author) (posp round) (system-statep systate)))) (declare (xargs :guard (subset endorsers (all-addresses systate)))) (let ((__function__ 'add-endorsed)) (declare (ignorable __function__)) (b* (((when (emptyp endorsers)) (system-state-fix systate)) (endorser (head endorsers)) (vstate (get-validator-state endorser systate)) (systate (if vstate (b* ((new-vstate (add-endorsed-val author round vstate))) (update-validator-state endorser new-vstate systate)) systate))) (add-endorsed (tail endorsers) author round systate))))
Theorem:
(defthm system-statep-of-add-endorsed (b* ((new-systate (add-endorsed endorsers author round systate))) (system-statep new-systate)) :rule-classes :rewrite)
Theorem:
(defthm add-endorsed-of-system-state-fix-systate (equal (add-endorsed endorsers author round (system-state-fix systate)) (add-endorsed endorsers author round systate)))
Theorem:
(defthm add-endorsed-system-state-equiv-congruence-on-systate (implies (system-state-equiv systate systate-equiv) (equal (add-endorsed endorsers author round systate) (add-endorsed endorsers author round systate-equiv))) :rule-classes :congruence)
Theorem:
(defthm get-network-state-of-add-endorsed (b* ((?new-systate (add-endorsed endorsers author round systate))) (equal (get-network-state new-systate) (get-network-state systate))))
Theorem:
(defthm all-addresses-of-add-endorsed (implies (subset endorsers (all-addresses systate)) (b* ((?new-systate (add-endorsed endorsers author round systate))) (equal (all-addresses new-systate) (all-addresses systate)))))
Theorem:
(defthm correct-addresses-of-add-endorsed (implies (subset endorsers (all-addresses systate)) (b* ((?new-systate (add-endorsed endorsers author round systate))) (equal (correct-addresses new-systate) (correct-addresses systate)))))
Theorem:
(defthm validator-state->round-of-add-endorsed (equal (validator-state->round (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->round (get-validator-state val systate))))
Theorem:
(defthm validator-state->dag-of-add-endorsed (equal (validator-state->dag (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->dag (get-validator-state val systate))))
Theorem:
(defthm validator-state->buffer-of-add-endorsed (equal (validator-state->buffer (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->buffer (get-validator-state val systate))))
Theorem:
(defthm validator-state->endorsed-of-add-endorsed (equal (validator-state->endorsed (get-validator-state val (add-endorsed endorsers author round systate))) (if (and (in val endorsers) (in val (correct-addresses systate))) (insert (address+pos author round) (validator-state->endorsed (get-validator-state val systate))) (validator-state->endorsed (get-validator-state val systate)))))
Theorem:
(defthm validator-state->last-of-add-endorsed (implies (in val (correct-addresses systate)) (equal (validator-state->last (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->last (get-validator-state val systate)))))
Theorem:
(defthm validator-state->blockchain-of-add-endorsed (implies (in val (correct-addresses systate)) (equal (validator-state->blockchain (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->blockchain (get-validator-state val systate)))))
Theorem:
(defthm validator-state->committed-of-add-endorsed (implies (in val (correct-addresses systate)) (equal (validator-state->committed (get-validator-state val (add-endorsed endorsers author round systate))) (validator-state->committed (get-validator-state val systate)))))