Perform regular expression matching on a string.
(match-regex regex x &key (case-insens 'nil)) → match
Function:
(defun match-regex-fn (regex x case-insens) (declare (xargs :guard (and (regex-p regex) (stringp x) (booleanp case-insens)))) (let ((__function__ 'match-regex)) (declare (ignorable __function__)) (b* ((ans (match-regex-locs regex x 0 (make-matchmode :case-insens case-insens)))) ans)))
Theorem:
(defthm matchresult-p-of-match-regex (b* ((match (match-regex-fn regex x case-insens))) (matchresult-p match)) :rule-classes :rewrite)
Theorem:
(defthm matchresult-in-bounds-of-match-regex (b* ((?match (match-regex-fn regex x case-insens))) (matchresult-in-bounds match)))
Theorem:
(defthm matchresult->str-of-match-regex (b* ((?match (match-regex-fn regex x case-insens))) (equal (matchresult->str match) (lstrfix x))))
Theorem:
(defthm match-regex-fn-of-regex-fix-regex (equal (match-regex-fn (regex-fix regex) x case-insens) (match-regex-fn regex x case-insens)))
Theorem:
(defthm match-regex-fn-regex-equiv-congruence-on-regex (implies (regex-equiv regex regex-equiv) (equal (match-regex-fn regex x case-insens) (match-regex-fn regex-equiv x case-insens))) :rule-classes :congruence)
Theorem:
(defthm match-regex-fn-of-str-fix-x (equal (match-regex-fn regex (acl2::str-fix x) case-insens) (match-regex-fn regex x case-insens)))
Theorem:
(defthm match-regex-fn-streqv-congruence-on-x (implies (acl2::streqv x x-equiv) (equal (match-regex-fn regex x case-insens) (match-regex-fn regex x-equiv case-insens))) :rule-classes :congruence)
Theorem:
(defthm match-regex-fn-of-bool-fix-case-insens (equal (match-regex-fn regex x (acl2::bool-fix case-insens)) (match-regex-fn regex x case-insens)))
Theorem:
(defthm match-regex-fn-iff-congruence-on-case-insens (implies (iff case-insens case-insens-equiv) (equal (match-regex-fn regex x case-insens) (match-regex-fn regex x case-insens-equiv))) :rule-classes :congruence)