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