Parse a sequence of natural numbers into an ABNF grammar.
(parse-grammar nats) → tree?
This function parses the natural numbers into a list of rules,
returning the corresponding parse tree,
or
Function:
(defun parse-grammar (nats) (declare (xargs :guard (nat-listp nats))) (b* (((mv error? tree? rest) (parse-rulelist nats)) ((when error?) nil) ((when rest) nil)) tree?))
Theorem:
(defthm tree-optionp-of-parse-grammar (b* ((tree? (parse-grammar nats))) (tree-optionp tree?)) :rule-classes :rewrite)
Theorem:
(defthm parse-grammar-of-nat-list-fix-nats (equal (parse-grammar (nat-list-fix nats)) (parse-grammar nats)))
Theorem:
(defthm parse-grammar-nat-list-equiv-congruence-on-nats (implies (acl2::nat-list-equiv nats nats-equiv) (equal (parse-grammar nats) (parse-grammar nats-equiv))) :rule-classes :congruence)