Parse a repetition of zero or more decimal digits.
(parse-*digit input) → (mv error? trees rest-input)
Function:
(defun parse-*digit (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((tree := (parse-digit input)) (trees := (parse-*digit input)) (return (cons tree trees))) ((return-raw (mv nil nil (nat-list-fix input))))))
Theorem:
(defthm not-of-parse-*digit.error? (b* (((mv ?error? ?trees ?rest-input) (parse-*digit input))) (not error?)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-*digit.trees (b* (((mv ?error? ?trees ?rest-input) (parse-*digit input))) (tree-listp trees)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-*digit.rest-input (b* (((mv ?error? ?trees ?rest-input) (parse-*digit input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-*digit-linear (b* (((mv ?error? ?trees ?rest-input) (parse-*digit input))) (<= (len rest-input) (len input))) :rule-classes :linear)
Theorem:
(defthm parse-*digit-of-nat-list-fix-input (equal (parse-*digit (nat-list-fix input)) (parse-*digit input)))
Theorem:
(defthm parse-*digit-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-*digit input) (parse-*digit input-equiv))) :rule-classes :congruence)