Parse a regular expression from a pattern string and match it against a string
(parse-and-match-regex pat x &key (case-insens 'nil) (legible 't)) → (mv parse-err match)
Same as parse followed by match-regex.
Function:
(defun parse-and-match-regex-fn (pat x case-insens legible) (declare (xargs :guard (and (stringp pat) (stringp x) (booleanp case-insens) (booleanp legible)))) (let ((__function__ 'parse-and-match-regex)) (declare (ignorable __function__)) (b* (((mv err regex) (parse pat :legible legible)) ((when err) (mv err (make-matchresult :loc nil :len 0 :str x :backrefs nil)))) (mv nil (match-regex regex x :case-insens case-insens)))))
Theorem:
(defthm maybe-stringp-of-parse-and-match-regex.parse-err (b* (((mv ?parse-err ?match) (parse-and-match-regex-fn pat x case-insens legible))) (acl2::maybe-stringp parse-err)) :rule-classes :type-prescription)
Theorem:
(defthm matchresult-p-of-parse-and-match-regex.match (b* (((mv ?parse-err ?match) (parse-and-match-regex-fn pat x case-insens legible))) (matchresult-p match)) :rule-classes :rewrite)
Theorem:
(defthm matchresult-in-bounds-of-parse-and-match-regex (b* (((mv ?parse-err ?match) (parse-and-match-regex-fn pat x case-insens legible))) (matchresult-in-bounds match)))
Theorem:
(defthm matchresult->str-of-parse-and-match-regex (b* (((mv ?parse-err ?match) (parse-and-match-regex-fn pat x case-insens legible))) (equal (matchresult->str match) (lstrfix x))))
Theorem:
(defthm parse-and-match-regex-fn-of-str-fix-pat (equal (parse-and-match-regex-fn (acl2::str-fix pat) x case-insens legible) (parse-and-match-regex-fn pat x case-insens legible)))
Theorem:
(defthm parse-and-match-regex-fn-streqv-congruence-on-pat (implies (acl2::streqv pat pat-equiv) (equal (parse-and-match-regex-fn pat x case-insens legible) (parse-and-match-regex-fn pat-equiv x case-insens legible))) :rule-classes :congruence)
Theorem:
(defthm parse-and-match-regex-fn-of-str-fix-x (equal (parse-and-match-regex-fn pat (acl2::str-fix x) case-insens legible) (parse-and-match-regex-fn pat x case-insens legible)))
Theorem:
(defthm parse-and-match-regex-fn-streqv-congruence-on-x (implies (acl2::streqv x x-equiv) (equal (parse-and-match-regex-fn pat x case-insens legible) (parse-and-match-regex-fn pat x-equiv case-insens legible))) :rule-classes :congruence)
Theorem:
(defthm parse-and-match-regex-fn-of-bool-fix-case-insens (equal (parse-and-match-regex-fn pat x (acl2::bool-fix case-insens) legible) (parse-and-match-regex-fn pat x case-insens legible)))
Theorem:
(defthm parse-and-match-regex-fn-iff-congruence-on-case-insens (implies (iff case-insens case-insens-equiv) (equal (parse-and-match-regex-fn pat x case-insens legible) (parse-and-match-regex-fn pat x case-insens-equiv legible))) :rule-classes :congruence)
Theorem:
(defthm parse-and-match-regex-fn-of-bool-fix-legible (equal (parse-and-match-regex-fn pat x case-insens (acl2::bool-fix legible)) (parse-and-match-regex-fn pat x case-insens legible)))
Theorem:
(defthm parse-and-match-regex-fn-iff-congruence-on-legible (implies (iff legible legible-equiv) (equal (parse-and-match-regex-fn pat x case-insens legible) (parse-and-match-regex-fn pat x case-insens legible-equiv))) :rule-classes :congruence)