Extract the topological loop from failed applications of toposort-aux.
(extract-topological-loop seen stop acc full-seen) → final-acc
Function:
(defun extract-topological-loop (seen stop acc full-seen) (declare (xargs :guard (cons-listp seen))) (let ((__function__ 'extract-topological-loop)) (declare (ignorable __function__)) (cond ((atom seen) (prog2$ (er hard? 'extract-topological-loop "Should never hit the end of seen!") acc)) ((eq (cdar seen) :started) (b* ((name (caar seen)) (finishedp (eq (cdr (hons-get name full-seen)) :finished)) (acc (if finishedp acc (cons name acc)))) (if (hons-equal name stop) acc (extract-topological-loop (cdr seen) stop acc full-seen)))) (t (extract-topological-loop (cdr seen) stop acc full-seen)))))
Theorem:
(defthm true-listp-of-extract-topological-loop (implies (true-listp acc) (true-listp (extract-topological-loop seen stop acc full-seen))))
Theorem:
(defthm subsetp-equal-of-extract-topological-loop (subsetp-equal (extract-topological-loop seen stop acc full-seen) (append (alist-keys seen) acc)))