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