Parse a letter.
(parse-alpha input) → (mv error? tree? rest-input)
Function:
(defun parse-alpha (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((tree := (parse-in-range 65 90 input)) (return (make-tree-nonleaf :rulename? *alpha* :branches (list (list tree))))) ((tree := (parse-in-range 97 122 input)) (return (make-tree-nonleaf :rulename? *alpha* :branches (list (list tree)))))))
Theorem:
(defthm maybe-msgp-of-parse-alpha.error? (b* (((mv ?error? ?tree? ?rest-input) (parse-alpha input))) (maybe-msgp error?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-parse-alpha.tree? (b* (((mv ?error? ?tree? ?rest-input) (parse-alpha input))) (and (tree-optionp tree?) (implies (not error?) (treep tree?)) (implies error? (not tree?)))) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-alpha.rest-input (b* (((mv ?error? ?tree? ?rest-input) (parse-alpha input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-alpha-linear (b* (((mv ?error? ?tree? ?rest-input) (parse-alpha input))) (and (<= (len rest-input) (len input)) (implies (not error?) (< (len rest-input) (len input))))) :rule-classes :linear)
Theorem:
(defthm parse-alpha-of-nat-list-fix-input (equal (parse-alpha (nat-list-fix input)) (parse-alpha input)))
Theorem:
(defthm parse-alpha-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-alpha input) (parse-alpha input-equiv))) :rule-classes :congruence)