Collect all the anchors in a DAG, starting from a given anchor.
(collect-all-anchors last-anchor dag blockchain) → all-anchors
This is a specialization of collect-anchors that does not stop at the last committed rounds, but instead goes all the way to the start of the DAG.
The input
The guard requires that the active committee can be calculated
for the round of
The returned list of anchors satisfies certificates-dag-paths-p.
Function:
(defun collect-all-anchors (last-anchor dag blockchain) (declare (xargs :guard (and (certificatep last-anchor) (certificate-setp dag) (block-listp blockchain)))) (declare (xargs :guard (and (in last-anchor dag) (evenp (certificate->round last-anchor)) (active-committee-at-round (certificate->round last-anchor) blockchain)))) (let ((__function__ 'collect-all-anchors)) (declare (ignorable __function__)) (collect-anchors last-anchor (- (certificate->round last-anchor) 2) 0 dag blockchain)))
Theorem:
(defthm certificate-listp-of-collect-all-anchors (b* ((all-anchors (collect-all-anchors last-anchor dag blockchain))) (certificate-listp all-anchors)) :rule-classes :rewrite)
Theorem:
(defthm car-of-collect-all-anchors (b* ((?all-anchors (collect-all-anchors last-anchor dag blockchain))) (equal (car all-anchors) (certificate-fix last-anchor))))
Theorem:
(defthm certificates-dag-paths-p-of-collect-all-anchors (implies (and (certificate-setp dag) (in last-anchor dag)) (b* ((?all-anchors (collect-all-anchors last-anchor dag blockchain))) (certificates-dag-paths-p all-anchors dag))))