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