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