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