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