Parse a repetition range.
(parse-repeat input) → (mv error? tree? rest-input)
Since a non-empty sequence of digits matches
both
Function:
(defun parse-repeat (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((tree := (parse-*digit-star-*digit input)) (return (make-tree-nonleaf :rulename? *repeat* :branches (list (list tree))))) ((trees := (parse-1*digit input)) (return (make-tree-nonleaf :rulename? *repeat* :branches (list trees))))))
Theorem:
(defthm maybe-msgp-of-parse-repeat.error? (b* (((mv ?error? ?tree? ?rest-input) (parse-repeat input))) (maybe-msgp error?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-parse-repeat.tree? (b* (((mv ?error? ?tree? ?rest-input) (parse-repeat input))) (and (tree-optionp tree?) (implies (not error?) (treep tree?)) (implies error? (not tree?)))) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-repeat.rest-input (b* (((mv ?error? ?tree? ?rest-input) (parse-repeat input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-repeat-linear (b* (((mv ?error? ?tree? ?rest-input) (parse-repeat input))) (and (<= (len rest-input) (len input)) (implies (not error?) (< (len rest-input) (len input))))) :rule-classes :linear)
Theorem:
(defthm parse-repeat-of-nat-list-fix-input (equal (parse-repeat (nat-list-fix input)) (parse-repeat input)))
Theorem:
(defthm parse-repeat-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-repeat input) (parse-repeat input-equiv))) :rule-classes :congruence)