Parse either white space, or a comment and new line followed by white space.
(parse-cwsp input) → (mv error? tree? rest-input)
Function:
(defun parse-cwsp (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((tree := (parse-wsp input)) (return (make-tree-nonleaf :rulename? *c-wsp* :branches (list (list tree))))) ((tree := (parse-cnl-wsp input)) (return (make-tree-nonleaf :rulename? *c-wsp* :branches (list (list tree)))))))
Theorem:
(defthm maybe-msgp-of-parse-cwsp.error? (b* (((mv ?error? ?tree? ?rest-input) (parse-cwsp input))) (maybe-msgp error?)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-parse-cwsp.tree? (b* (((mv ?error? ?tree? ?rest-input) (parse-cwsp input))) (and (tree-optionp tree?) (implies (not error?) (treep tree?)) (implies error? (not tree?)))) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-cwsp.rest-input (b* (((mv ?error? ?tree? ?rest-input) (parse-cwsp input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-cwsp-linear (b* (((mv ?error? ?tree? ?rest-input) (parse-cwsp input))) (and (<= (len rest-input) (len input)) (implies (not error?) (< (len rest-input) (len input))))) :rule-classes :linear)
Theorem:
(defthm parse-cwsp-of-nat-list-fix-input (equal (parse-cwsp (nat-list-fix input)) (parse-cwsp input)))
Theorem:
(defthm parse-cwsp-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-cwsp input) (parse-cwsp input-equiv))) :rule-classes :congruence)