Parse an option
Function:
(defun parse-bin-val-rest (input) (declare (xargs :guard (nat-listp input))) (seq-backtrack input ((trees := (parse-1*-dot-1*bit input)) (return (make-tree-nonleaf :rulename? nil :branches (list trees)))) ((tree := (parse-dash-1*bit input)) (return (make-tree-nonleaf :rulename? nil :branches (list (list tree))))) ((return-raw (mv nil (make-tree-nonleaf :rulename? nil :branches nil) (nat-list-fix input))))))
Theorem:
(defthm not-of-parse-bin-val-rest.error? (b* (((mv ?error? ?tree ?rest-input) (parse-bin-val-rest input))) (not error?)) :rule-classes :rewrite)
Theorem:
(defthm treep-of-parse-bin-val-rest.tree (b* (((mv ?error? ?tree ?rest-input) (parse-bin-val-rest input))) (treep tree)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-parse-bin-val-rest.rest-input (b* (((mv ?error? ?tree ?rest-input) (parse-bin-val-rest input))) (nat-listp rest-input)) :rule-classes :rewrite)
Theorem:
(defthm len-of-parse-bin-val-rest-linear (b* (((mv ?error? ?tree ?rest-input) (parse-bin-val-rest input))) (<= (len rest-input) (len input))) :rule-classes :linear)
Theorem:
(defthm parse-bin-val-rest-of-nat-list-fix-input (equal (parse-bin-val-rest (nat-list-fix input)) (parse-bin-val-rest input)))
Theorem:
(defthm parse-bin-val-rest-nat-list-equiv-congruence-on-input (implies (acl2::nat-list-equiv input input-equiv) (equal (parse-bin-val-rest input) (parse-bin-val-rest input-equiv))) :rule-classes :congruence)