(vl-emodwirelist-highest basename x) returns a number
We use this in a few places during e-conversion to generate new, fresh E wires.
The scheme is basically similar to that of a vl-namedb-p or vl-namefactory-p: we first find an
Function:
(defun vl-emodwirelist-highest (basename x) (declare (xargs :guard (and (stringp basename) (vl-emodwirelist-p x)))) (cond ((atom x) 0) ((equal (vl-emodwire->basename (car x)) basename) (max (nfix (vl-emodwire->index (car x))) (vl-emodwirelist-highest basename (cdr x)))) (t (vl-emodwirelist-highest basename (cdr x)))))
Theorem:
(defthm natp-of-vl-emodwirelist-highest (natp (vl-emodwirelist-highest basename x)) :rule-classes :type-prescription)
Theorem:
(defthm vl-emodwirelist-highest-correct (implies (and (member-equal w x) (equal (vl-emodwire->basename w) basename)) (<= (nfix (vl-emodwire->index w)) (vl-emodwirelist-highest basename x))))