New system state resulting from an
(advance-next val systate) → new-systate
The
We increment the validator's round by one. We also restart the timer, setting it to running (which is a no-op if the round has advanced not due to a timeout.
Function:
(defun advance-next (val systate) (declare (xargs :guard (and (addressp val) (system-statep systate)))) (declare (xargs :guard (advance-possiblep val systate))) (let ((__function__ 'advance-next)) (declare (ignorable __function__)) (b* (((validator-state vstate) (get-validator-state val systate)) (new-round (1+ vstate.round)) (new-vstate (change-validator-state vstate :round new-round)) (systate (update-validator-state val new-vstate systate))) systate)))
Theorem:
(defthm system-statep-of-advance-next (b* ((new-systate (advance-next val systate))) (system-statep new-systate)) :rule-classes :rewrite)
Theorem:
(defthm correct-addresses-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (correct-addresses new-systate) (correct-addresses systate)))))
Theorem:
(defthm validator-state->round-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->round (get-validator-state val1 new-systate)) (if (equal (address-fix val1) (address-fix val)) (1+ (validator-state->round (get-validator-state val1 systate))) (validator-state->round (get-validator-state val1 systate)))))))
Theorem:
(defthm validator-state->dag-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->dag (get-validator-state val1 new-systate)) (validator-state->dag (get-validator-state val1 systate))))))
Theorem:
(defthm validator-state->endorsed-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->endorsed (get-validator-state val1 new-systate)) (validator-state->endorsed (get-validator-state val1 systate))))))
Theorem:
(defthm validator-state->last-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->last (get-validator-state val1 new-systate)) (validator-state->last (get-validator-state val1 systate))))))
Theorem:
(defthm validator-state->blockchain-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->blockchain (get-validator-state val1 new-systate)) (validator-state->blockchain (get-validator-state val1 systate))))))
Theorem:
(defthm validator-state->committed-of-advance-next (implies (advance-possiblep val systate) (b* ((?new-systate (advance-next val systate))) (equal (validator-state->committed (get-validator-state val1 new-systate)) (validator-state->committed (get-validator-state val1 systate))))))
Theorem:
(defthm get-network-state-of-advance-next (b* ((?new-systate (advance-next val systate))) (equal (get-network-state new-systate) (get-network-state systate))))
Theorem:
(defthm advance-next-of-address-fix-val (equal (advance-next (address-fix val) systate) (advance-next val systate)))
Theorem:
(defthm advance-next-address-equiv-congruence-on-val (implies (address-equiv val val-equiv) (equal (advance-next val systate) (advance-next val-equiv systate))) :rule-classes :congruence)
Theorem:
(defthm advance-next-of-system-state-fix-systate (equal (advance-next val (system-state-fix systate)) (advance-next val systate)))
Theorem:
(defthm advance-next-system-state-equiv-congruence-on-systate (implies (system-state-equiv systate systate-equiv) (equal (advance-next val systate) (advance-next val systate-equiv))) :rule-classes :congruence)