Collect the leaf terms according to the if tree structure of a term.
(if-tree-leaf-terms term) → leaf-terms
If
If
Function:
(defun if-tree-leaf-terms (term) (declare (xargs :guard (pseudo-termp term))) (let ((__function__ 'if-tree-leaf-terms)) (declare (ignorable __function__)) (cond ((variablep term) (list term)) ((fquotep term) (list term)) ((eq (ffn-symb term) 'if) (append (if-tree-leaf-terms (fargn term 2)) (if-tree-leaf-terms (fargn term 3)))) (t (list term)))))
Theorem:
(defthm pseudo-term-listp-of-if-tree-leaf-terms (implies (and (pseudo-termp term)) (b* ((leaf-terms (if-tree-leaf-terms term))) (pseudo-term-listp leaf-terms))) :rule-classes :rewrite)