Parse a repetition of zero or more
(parse-*cwsp input) → (mv error? trees rest-input)
Function:
(defun parse-*cwsp (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((tree := (parse-cwsp input)) (trees := (parse-*cwsp input)) (return (cons tree trees))) ((return-raw (mv nil nil (nat-list-fix input))))))
Theorem:
(defthm not-of-parse-*cwsp.error? (b* (((mv ?error? ?trees ?rest-input) (parse-*cwsp input))) (not error?)) :rule-classes :rewrite)
Theorem:
(defthm tree-listp-of-parse-*cwsp.trees (b* (((mv ?error? ?trees ?rest-input) (parse-*cwsp input))) (tree-listp trees)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-*cwsp.rest-input (b* (((mv ?error? ?trees ?rest-input) (parse-*cwsp input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-*cwsp-linear (b* (((mv ?error? ?trees ?rest-input) (parse-*cwsp input))) (<= (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)