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