• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
      • Std/io
      • Std/basic
      • Std/system
        • Fresh-logical-name-with-$s-suffix
        • Irrelevant-formals-info
        • Std/system/function-queries
        • Std/system/term-queries
          • Check-mv-let-call
          • Term-possible-numbers-of-results
          • Check-user-term
          • Check-nary-lambda-call
          • Check-lambda-call
          • All-vars-open
          • Dumb-occur-var-open
          • Check-user-lambda
          • Check-if-call
          • One-way-unify$
          • Check-unary-lambda-call
          • Guard-verified-fnsp
          • All-non-gv-ffn-symbs
          • All-non-gv-exec-ffn-symbs
          • Check-fn-call
          • Guard-verified-exec-fnsp
          • Check-list-call
          • Check-or-call
          • Check-and-call
          • All-program-ffn-symbs
          • Lambda-guard-verified-fnsp
          • All-free/bound-vars
          • Check-mbt$-call
          • If-tree-leaf-terms
            • Check-not-call
            • Check-mbt-call
            • Term-guard-obligation
            • All-pkg-names
            • All-vars-in-untranslated-term
            • Std/system/all-fnnames
            • Lambda-logic-fnsp
            • Lambda-guard-verified-exec-fnsp
            • All-lambdas
            • Lambda-closedp
            • Std/system/all-vars
          • Std/system/term-transformations
          • Std/system/enhanced-utilities
          • Install-not-normalized-event
          • Install-not-normalized-event-lst
          • Std/system/term-function-recognizers
          • Genvar$
          • Std/system/event-name-queries
          • Pseudo-tests-and-call-listp
          • Maybe-pseudo-event-formp
          • Add-suffix-to-fn-or-const
          • Chk-irrelevant-formals-ok
          • Table-alist+
          • Pseudo-tests-and-callp
          • Add-suffix-to-fn-or-const-lst
          • Known-packages+
          • Add-suffix-to-fn-lst
          • Unquote-term
          • Event-landmark-names
          • Add-suffix-lst
          • Std/system/theorem-queries
          • Unquote-term-list
          • Std/system/macro-queries
          • Pseudo-command-landmark-listp
          • Install-not-normalized$
          • Pseudo-event-landmark-listp
          • Known-packages
          • Std/system/partition-rest-and-keyword-args
          • Rune-enabledp
          • Rune-disabledp
          • Included-books
          • Std/system/pseudo-event-formp
          • Std/system/plist-worldp-with-formals
          • Std/system/w
          • Std/system/geprops
          • Std/system/arglistp
          • Std/system/constant-queries
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Std/system/term-queries

    If-tree-leaf-terms

    Collect the leaf terms according to the if tree structure of a term.

    Signature
    (if-tree-leaf-terms term) → leaf-terms
    Arguments
    term — Guard (pseudo-termp term).
    Returns
    leaf-terms — Type (pseudo-term-listp leaf-terms), given the guard.

    If term is not a call of if, we return the singleton list with term as the only leaf.

    If term has the form (if a b c), we recursively collect the leaves of b of c, and join them into a list.

    Definitions and Theorems

    Function: if-tree-leaf-terms

    (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: pseudo-term-listp-of-if-tree-leaf-terms

    (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)