Collect all the anchor certificates to commit.
(collect-anchors current-anchor previous-round last-committed-round dag blockchain) → anchors
The starting point is an anchor,
Since
In order to calculate the leader at
The returned list of anchors has even round numbers,
if
Function:
(defun collect-anchors (current-anchor previous-round last-committed-round dag blockchain) (declare (xargs :guard (and (certificatep current-anchor) (natp previous-round) (natp last-committed-round) (certificate-setp dag) (block-listp blockchain)))) (declare (xargs :guard (and (evenp previous-round) (> (certificate->round current-anchor) previous-round) (or (zp previous-round) (active-committee-at-round previous-round blockchain))))) (let ((__function__ 'collect-anchors)) (declare (ignorable __function__)) (b* (((unless (and (mbt (and (or (zp previous-round) (active-committee-at-round previous-round blockchain)) t)) (> (nfix previous-round) (nfix last-committed-round)))) (list (certificate-fix current-anchor))) (commtt (active-committee-at-round previous-round blockchain)) ((unless (committee-nonemptyp commtt)) (collect-anchors current-anchor (- (nfix previous-round) 2) last-committed-round dag blockchain)) (previous-leader (leader-at-round previous-round commtt)) (previous-anchor? (path-to-author+round current-anchor previous-leader previous-round dag)) ((unless previous-anchor?) (collect-anchors current-anchor (- (nfix previous-round) 2) last-committed-round dag blockchain))) (cons (certificate-fix current-anchor) (collect-anchors previous-anchor? (- (nfix previous-round) 2) last-committed-round dag blockchain)))))
Theorem:
(defthm certificate-listp-of-collect-anchors (b* ((anchors (collect-anchors current-anchor previous-round last-committed-round dag blockchain))) (certificate-listp anchors)) :rule-classes :rewrite)
Theorem:
(defthm cert-list-evenp-of-collect-anchors (implies (and (evenp (certificate->round current-anchor)) (evenp previous-round)) (b* ((?anchors (collect-anchors current-anchor previous-round last-committed-round dag blockchain))) (cert-list-evenp anchors))))
Theorem:
(defthm collect-anchors-of-certificate-fix-current-anchor (equal (collect-anchors (certificate-fix current-anchor) previous-round last-committed-round dag blockchain) (collect-anchors current-anchor previous-round last-committed-round dag blockchain)))
Theorem:
(defthm collect-anchors-certificate-equiv-congruence-on-current-anchor (implies (certificate-equiv current-anchor current-anchor-equiv) (equal (collect-anchors current-anchor previous-round last-committed-round dag blockchain) (collect-anchors current-anchor-equiv previous-round last-committed-round dag blockchain))) :rule-classes :congruence)
Theorem:
(defthm collect-anchors-of-nfix-previous-round (equal (collect-anchors current-anchor (nfix previous-round) last-committed-round dag blockchain) (collect-anchors current-anchor previous-round last-committed-round dag blockchain)))
Theorem:
(defthm collect-anchors-nat-equiv-congruence-on-previous-round (implies (acl2::nat-equiv previous-round previous-round-equiv) (equal (collect-anchors current-anchor previous-round last-committed-round dag blockchain) (collect-anchors current-anchor previous-round-equiv last-committed-round dag blockchain))) :rule-classes :congruence)
Theorem:
(defthm collect-anchors-of-nfix-last-committed-round (equal (collect-anchors current-anchor previous-round (nfix last-committed-round) dag blockchain) (collect-anchors current-anchor previous-round last-committed-round dag blockchain)))
Theorem:
(defthm collect-anchors-nat-equiv-congruence-on-last-committed-round (implies (acl2::nat-equiv last-committed-round last-committed-round-equiv) (equal (collect-anchors current-anchor previous-round last-committed-round dag blockchain) (collect-anchors current-anchor previous-round last-committed-round-equiv dag blockchain))) :rule-classes :congruence)
Theorem:
(defthm collect-anchors-of-certificate-set-fix-dag (equal (collect-anchors current-anchor previous-round last-committed-round (certificate-set-fix dag) blockchain) (collect-anchors current-anchor previous-round last-committed-round dag blockchain)))
Theorem:
(defthm collect-anchors-certificate-set-equiv-congruence-on-dag (implies (certificate-set-equiv dag dag-equiv) (equal (collect-anchors current-anchor previous-round last-committed-round dag blockchain) (collect-anchors current-anchor previous-round last-committed-round dag-equiv blockchain))) :rule-classes :congruence)
Theorem:
(defthm collect-anchors-of-block-list-fix-blockchain (equal (collect-anchors current-anchor previous-round last-committed-round dag (block-list-fix blockchain)) (collect-anchors current-anchor previous-round last-committed-round dag blockchain)))
Theorem:
(defthm collect-anchors-block-list-equiv-congruence-on-blockchain (implies (block-list-equiv blockchain blockchain-equiv) (equal (collect-anchors current-anchor previous-round last-committed-round dag blockchain) (collect-anchors current-anchor previous-round last-committed-round dag blockchain-equiv))) :rule-classes :congruence)