Naive, O(n) lookup of a vl-genvar in a list by its name.
(vl-find-genvar name x) → genvar?
Function:
(defun vl-find-genvar (name x) (declare (xargs :guard (and (stringp name) (vl-genvarlist-p x)))) (let ((__function__ 'vl-find-genvar)) (declare (ignorable __function__)) (cond ((atom x) nil) ((equal (string-fix name) (vl-genvar->name (car x))) (vl-genvar-fix (car x))) (t (vl-find-genvar name (cdr x))))))
Theorem:
(defthm return-type-of-vl-find-genvar (b* ((genvar? (vl-find-genvar name x))) (iff (vl-genvar-p genvar?) genvar?)) :rule-classes :rewrite)
Theorem:
(defthm vl-find-genvar-under-iff (iff (vl-find-genvar name x) (member-equal (string-fix name) (vl-genvarlist->names x))))
Theorem:
(defthm vl-genvar->name-of-vl-find-genvar (implies (vl-find-genvar name x) (equal (vl-genvar->name (vl-find-genvar name x)) (string-fix name))))
Theorem:
(defthm tag-of-vl-find-genvar (equal (tag (vl-find-genvar name x)) (if (vl-find-genvar name x) :vl-genvar nil)))
Theorem:
(defthm member-equal-of-vl-find-genvar (implies (force (vl-genvarlist-p x)) (iff (member-equal (vl-find-genvar name x) x) (vl-find-genvar name x))))
Theorem:
(defthm consp-of-vl-find-genvar-when-member-equal (implies (and (member-equal name (vl-genvarlist->names x)) (force (stringp name))) (consp (vl-find-genvar name x))))
Theorem:
(defthm vl-find-genvar-of-str-fix-name (equal (vl-find-genvar (str-fix name) x) (vl-find-genvar name x)))
Theorem:
(defthm vl-find-genvar-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-find-genvar name x) (vl-find-genvar name-equiv x))) :rule-classes :congruence)
Theorem:
(defthm vl-find-genvar-of-vl-genvarlist-fix-x (equal (vl-find-genvar name (vl-genvarlist-fix x)) (vl-find-genvar name x)))
Theorem:
(defthm vl-find-genvar-vl-genvarlist-equiv-congruence-on-x (implies (vl-genvarlist-equiv x x-equiv) (equal (vl-find-genvar name x) (vl-find-genvar name x-equiv))) :rule-classes :congruence)