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