Parse an unambiguous string.
The result is the unique parse tree.
Function:
(defun parse! (string rulename rules) (declare (xargs :guard (and (stringp string) (rulenamep rulename) (rulelistp rules)))) (declare (xargs :guard (string-unambiguousp string rulename rules))) (mbe :logic (tree-fix (string-parsablep-witness string rulename rules)) :exec (string-parsablep-witness string rulename rules)))
Theorem:
(defthm treep-of-parse! (b* ((tree (parse! string rulename rules))) (treep tree)) :rule-classes :rewrite)
Theorem:
(defthm parse-is-parse!-when-string-unambiguousp (implies (string-unambiguousp string rulename rules) (equal (parse string rulename rules) (insert (parse! string rulename rules) nil))))