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