A
The parse tree must have a root labeled by no rule name, with a single leaf subtree labeled by a list of natural numbers. That list of natural numbers is returned.
Function:
(defun abstract-grouped-terminals (tree) (declare (xargs :guard (treep tree))) (b* (((fun (fail)) (abstract-fail)) ((unless (tree-case tree :nonleaf)) (fail)) (treess (tree-nonleaf->branches tree)) ((unless (consp treess)) (fail)) (trees (car treess)) ((unless (consp trees)) (fail)) (subtree (car trees))) (abstract-terminals subtree)))
Theorem:
(defthm nat-listp-of-abstract-grouped-terminals (b* ((nats (abstract-grouped-terminals tree))) (nat-listp nats)) :rule-classes :rewrite)