See if a string occurs at the front of an vl-echarlist-p.
(vl-matches-string-p string echars) → bool
This function determines if some
(prefixp (explode string) (vl-echarlist->chars echars))
But we actually implement the operation with a fast function that does not call explode or build the list of characters.
Function:
(defun vl-matches-string-p$inline (string echars) (declare (type string string)) (declare (xargs :guard (vl-echarlist-p echars))) (declare (xargs :guard (not (equal string "")))) (let ((__function__ 'vl-matches-string-p)) (declare (ignorable __function__)) (mbe :logic (prefixp (explode string) (vl-echarlist->chars echars)) :exec (vl-matches-string-p-impl string 0 (length string) echars))))
Theorem:
(defthm len-when-vl-matches-string-p-fc (implies (vl-matches-string-p string echars) (<= (len (explode string)) (len echars))) :rule-classes ((:forward-chaining) (:linear)))
Theorem:
(defthm consp-when-vl-matches-string-p-fc (implies (and (vl-matches-string-p string echars) (stringp string) (not (equal string ""))) (consp echars)) :rule-classes :forward-chaining)
Theorem:
(defthm vl-matches-string-p-when-acl2-count-zero (implies (and (equal 0 (acl2-count echars)) (force (stringp string))) (equal (vl-matches-string-p string echars) (equal string ""))))