(match-regex-locs pat x index mode) → match
Function:
(defun match-regex-locs (pat x index mode) (declare (xargs :guard (and (regex-p pat) (stringp x) (natp index) (matchmode-p mode)))) (declare (xargs :guard (<= index (strlen x)))) (let ((__function__ 'match-regex-locs)) (declare (ignorable __function__)) (b* ((matches1 (match-regex-rec pat x (make-matchstate :index index) mode)) ((when matches1) (b* (((matchstate m1) (car matches1))) (make-matchresult :loc (lnfix index) :len (- m1.index (lnfix index)) :str x :backrefs m1.backrefs))) ((when (mbe :logic (zp (- (strlen x) (nfix index))) :exec (eql (strlen x) (lnfix index)))) (make-matchresult :loc nil :len 0 :str x :backrefs nil))) (match-regex-locs pat x (+ 1 (lnfix index)) mode))))
Theorem:
(defthm matchresult-p-of-match-regex-locs (b* ((match (match-regex-locs pat x index mode))) (matchresult-p match)) :rule-classes :rewrite)
Theorem:
(defthm matchresult-in-bounds-of-match-regex-locs (b* ((?match (match-regex-locs pat x index mode))) (implies (<= (nfix index) (strlen x)) (matchresult-in-bounds match))))
Theorem:
(defthm matchresult->str-of-match-regex-locs (b* ((?match (match-regex-locs pat x index mode))) (equal (matchresult->str match) (lstrfix x))))
Theorem:
(defthm match-regex-locs-of-regex-fix-pat (equal (match-regex-locs (regex-fix pat) x index mode) (match-regex-locs pat x index mode)))
Theorem:
(defthm match-regex-locs-regex-equiv-congruence-on-pat (implies (regex-equiv pat pat-equiv) (equal (match-regex-locs pat x index mode) (match-regex-locs pat-equiv x index mode))) :rule-classes :congruence)
Theorem:
(defthm match-regex-locs-of-str-fix-x (equal (match-regex-locs pat (acl2::str-fix x) index mode) (match-regex-locs pat x index mode)))
Theorem:
(defthm match-regex-locs-streqv-congruence-on-x (implies (acl2::streqv x x-equiv) (equal (match-regex-locs pat x index mode) (match-regex-locs pat x-equiv index mode))) :rule-classes :congruence)
Theorem:
(defthm match-regex-locs-of-nfix-index (equal (match-regex-locs pat x (nfix index) mode) (match-regex-locs pat x index mode)))
Theorem:
(defthm match-regex-locs-nat-equiv-congruence-on-index (implies (acl2::nat-equiv index index-equiv) (equal (match-regex-locs pat x index mode) (match-regex-locs pat x index-equiv mode))) :rule-classes :congruence)
Theorem:
(defthm match-regex-locs-of-matchmode-fix-mode (equal (match-regex-locs pat x index (matchmode-fix mode)) (match-regex-locs pat x index mode)))
Theorem:
(defthm match-regex-locs-matchmode-equiv-congruence-on-mode (implies (matchmode-equiv mode mode-equiv) (equal (match-regex-locs pat x index mode) (match-regex-locs pat x index mode-equiv))) :rule-classes :congruence)