• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/io
      • Std/osets
      • Std/system
        • Fresh-logical-name-with-$s-suffix
        • Irrelevant-formals-info
        • Std/system/function-queries
          • Defun-sk-queries
          • Tail-recursive-p
          • Termination-theorem$
          • Measure
          • Arity+
          • Unwrapped-nonexec-body+
          • Ubody
          • Ruler-extenders+
          • Recursive-calls
            • Guard-theorem-no-simplify$
            • Well-founded-relation+
            • Unwrapped-nonexec-body
            • Measured-subset+
            • Measure+
            • Ruler-extenders
            • Number-of-results+
            • Induction-machine+
            • Non-executablep+
            • Pure-raw-p
            • Irecursivep+
            • Formals+
            • Stobjs-out+
            • Induction-machine
            • Definedp+
            • Number-of-results
            • Ubody+
            • Guard-theorem-no-simplify
            • Uguard
            • Rawp
            • Irecursivep
            • Defchoose-queries
            • Uguard+
            • Stobjs-in+
            • No-stobjs-p+
            • Well-founded-relation
            • Definedp
            • Primitivep+
            • Guard-verified-p+
            • No-stobjs-p
            • Measured-subset
            • Guard-verified-p
            • Primitivep
            • Non-executablep
            • Fundef-enabledp
            • Fundef-disabledp
            • Ibody
            • Std/system/arity
          • Std/system/term-queries
          • Std/system/term-transformations
          • Std/system/enhanced-utilities
          • Install-not-normalized-event-lst
          • Install-not-normalized-event
          • Std/system/term-function-recognizers
          • Pseudo-tests-and-call-listp
          • Genvar$
          • Std/system/event-name-queries
          • Maybe-pseudo-event-formp
          • Add-suffix-to-fn-or-const
          • Chk-irrelevant-formals-ok
          • Std/system/good-atom-listp
          • Pseudo-tests-and-callp
          • Table-alist+
          • 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-event-landmark-listp
          • Pseudo-command-landmark-listp
          • Install-not-normalized$
          • Rune-disabledp
          • Known-packages
          • Std/system/partition-rest-and-keyword-args
          • Rune-enabledp
          • Included-books
          • Std/system/pseudo-event-formp
          • Std/system/plist-worldp-with-formals
          • Std/system/w
          • Std/system/geprops
          • Std/system/arglistp
          • Std/system-extensions
          • Std/system/constant-queries
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Std/system/function-queries

    Recursive-calls

    Recursive calls of a named non-mutually-recursive function, along with the controlling tests.

    Signature
    (recursive-calls fn wrld) → calls-with-tests
    Arguments
    fn — Guard (symbolp fn).
    wrld — Guard (plist-worldp wrld).
    Returns
    calls-with-tests — A pseudo-tests-and-call-listp.

    For singly recursive logic-mode functions, this is similar to the result of induction-machine, but each record has one recursive call (instead of zero or more), and there is exactly one record for each recursive call.

    This utility works on both logic-mode and program-mode functions (if the program-mode functions have an unnormalized-body property). This utility should not be called on a function that is mutually recursive with other functions; it must be called only on singly recursive functions, or on non-recursive functions (the result is nil in this case).

    This utility may be extended to handle also mutually recursive functions.

    If the function is in logic mode and recursive, we obtain its ruler extenders and pass them to the built-in function termination-machine. Otherwise, we pass the default ruler extenders.

    Definitions and Theorems

    Function: recursive-calls

    (defun
        recursive-calls (fn wrld)
        (declare (xargs :guard (and (symbolp fn) (plist-worldp wrld))))
        (let ((__function__ 'recursive-calls))
             (declare (ignorable __function__))
             (b* ((ruler-extenders (if (and (logicp fn wrld)
                                            (irecursivep fn wrld))
                                       (ruler-extenders fn wrld)
                                       (default-ruler-extenders wrld))))
                 (termination-machine nil nil (list fn)
                                      nil (ubody fn wrld)
                                      nil nil ruler-extenders))))