Extend an alist by binding the names of vl-modules to their definitions.
(vl-modulelist-alist x acc) → alist
This can be used as an alternative to vl-find-module when you need to perform a lot of lookups.
Function:
(defun vl-modulelist-alist (x acc) (declare (xargs :guard (vl-modulelist-p x))) (let ((__function__ 'vl-modulelist-alist)) (declare (ignorable __function__)) (if (atom x) acc (cons (cons (vl-module->name (car x)) (vl-module-fix (car x))) (vl-modulelist-alist (cdr x) acc)))))
Theorem:
(defthm return-type-of-vl-modulelist-alist (b* ((alist (vl-modulelist-alist x acc))) (equal (vl-module-alist-p alist) (vl-module-alist-p acc))) :rule-classes :rewrite)
Theorem:
(defthm lookup-in-vl-modulelist-alist-acc-elim (implies (syntaxp (not (equal acc ''nil))) (equal (hons-assoc-equal name (vl-modulelist-alist x acc)) (or (hons-assoc-equal name (vl-modulelist-alist x nil)) (hons-assoc-equal name acc)))))
Theorem:
(defthm lookup-in-vl-modulelist-alist-fast (implies (stringp name) (equal (hons-assoc-equal name (vl-modulelist-alist x nil)) (let ((val (vl-find-module name x))) (and val (cons name val))))))
Theorem:
(defthm vl-modulelist-alist-of-vl-modulelist-fix-x (equal (vl-modulelist-alist (vl-modulelist-fix x) acc) (vl-modulelist-alist x acc)))
Theorem:
(defthm vl-modulelist-alist-vl-modulelist-equiv-congruence-on-x (implies (vl-modulelist-equiv x x-equiv) (equal (vl-modulelist-alist x acc) (vl-modulelist-alist x-equiv acc))) :rule-classes :congruence)