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