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