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