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