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