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