Parse a decimal digit.
(parse-digit input) → (mv error? tree? rest-input)
Function:
(defun parse-digit (input) (declare (xargs :guard (nat-listp input))) (seq input (tree := (parse-in-range 48 57 input)) (return (make-tree-nonleaf :rulename? *digit* :branches (list (list tree))))))
Theorem:
(defthm maybe-msgp-of-parse-digit.error? (b* (((mv ?error? ?tree? ?rest-input) (parse-digit input))) (maybe-msgp error?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-parse-digit.tree? (b* (((mv ?error? ?tree? ?rest-input) (parse-digit input))) (and (tree-optionp tree?) (implies (not error?) (treep tree?)) (implies error? (not tree?)))) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-digit.rest-input (b* (((mv ?error? ?tree? ?rest-input) (parse-digit input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-digit-linear (b* (((mv ?error? ?tree? ?rest-input) (parse-digit input))) (and (<= (len rest-input) (len input)) (implies (not error?) (< (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)