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