(parse-repeatbase x index) → (mv err min max new-index)
Function:
(defun parse-repeatbase (x index) (declare (xargs :guard (and (stringp x) (natp index)))) (declare (xargs :guard (<= index (strlen x)))) (let ((__function__ 'parse-repeatbase)) (declare (ignorable __function__)) (b* ((index (lnfix index)) ((when (<= (strlen x) index)) (mv "End of string when parsing repeatbase" 0 0 index)) (char (char x index))) (case char (#\* (mv nil 0 nil (+ 1 index))) (#\+ (mv nil 1 nil (+ 1 index))) (#\? (mv nil 0 1 (+ 1 index))) (#\{ (b* (((mv err min max new-index) (parse-range x (+ 1 index))) ((when err) (mv err 0 0 index))) (mv nil min max new-index))) (t (mv "Not a repeatbase" 0 0 (lnfix index)))))))
Theorem:
(defthm maybe-stringp-of-parse-repeatbase.err (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (acl2::maybe-stringp err)) :rule-classes :type-prescription)
Theorem:
(defthm natp-of-parse-repeatbase.min (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (natp min)) :rule-classes :type-prescription)
Theorem:
(defthm maybe-natp-of-parse-repeatbase.max (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (maybe-natp max)) :rule-classes :type-prescription)
Theorem:
(defthm natp-of-parse-repeatbase.new-index (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (natp new-index)) :rule-classes :type-prescription)
Theorem:
(defthm new-index-of-parse-repeatbase (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (<= (nfix index) new-index)) :rule-classes :linear)
Theorem:
(defthm new-index-of-parse-repeatbase-strong (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (implies (not err) (< (nfix index) new-index))) :rule-classes :linear)
Theorem:
(defthm new-index-of-parse-repeatbase-less-than-length (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (implies (<= (nfix index) (len (acl2::explode x))) (<= new-index (len (acl2::explode x))))) :rule-classes :linear)
Theorem:
(defthm no-change-of-parse-repeatbase (b* (((mv ?err common-lisp::?min common-lisp::?max ?new-index) (parse-repeatbase x index))) (implies err (equal new-index (nfix index)))))
Theorem:
(defthm parse-repeatbase-of-str-fix-x (equal (parse-repeatbase (acl2::str-fix x) index) (parse-repeatbase x index)))
Theorem:
(defthm parse-repeatbase-streqv-congruence-on-x (implies (acl2::streqv x x-equiv) (equal (parse-repeatbase x index) (parse-repeatbase x-equiv index))) :rule-classes :congruence)
Theorem:
(defthm parse-repeatbase-of-nfix-index (equal (parse-repeatbase x (nfix index)) (parse-repeatbase x index)))
Theorem:
(defthm parse-repeatbase-nat-equiv-congruence-on-index (implies (acl2::nat-equiv index index-equiv) (equal (parse-repeatbase x index) (parse-repeatbase x index-equiv))) :rule-classes :congruence)