• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
          • Isodata
          • Simplify-defun
          • Tailrec
          • Schemalg
          • Restrict
          • Expdata
          • Casesplit
          • Simplify-term
          • Simplify-defun-sk
          • Parteval
          • Solve
          • Wrap-output
          • Propagate-iso
          • Simplify
          • Finite-difference
          • Drop-irrelevant-params
          • Copy-function
          • Lift-iso
          • Rename-params
          • Utilities
            • Defaults-table
            • Xdoc::apt-constructors
            • Input-processors
            • Transformation-table
            • Find-base-cases
              • Find-a-base-case-translated-aux
              • Find-a-base-case-aux
              • Find-a-base-case
                • Find-a-base-case-translated
                • Untranslated-expr-calls-some-fn
              • Untranslate-specifier-utilities
              • Print-specifier-utilities
              • Hints-specifier-utilities
            • Simplify-term-programmatic
            • Simplify-defun-sk-programmatic
            • Simplify-defun-programmatic
            • Simplify-defun+
            • Common-options
            • Common-concepts
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • C
          • Soft
          • Bv
          • Imp-language
          • Ethereum
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Find-base-cases

    Find-a-base-case

    Signature
    (find-a-base-case term fns fake-fns prefer-then state) 
      → 
    base-case
    Arguments
    fns — Guard (symbol-listp fns).
    fake-fns — Guard (and (symbol-alistp fake-fns) (nat-listp (strip-cdrs fake-fns))).
    prefer-then — Guard (booleanp prefer-then).
    Returns
    base-case — Either a pseudo-termp representing the base-case, or a hard error. A hard error should not occur if term is the body of a valid function, and fns includes only symbols corresponding to the function or functions defined in mutual recursion with the function.

    Definitions and Theorems

    Function: find-a-base-case

    (defun find-a-base-case (term fns fake-fns prefer-then state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (and (symbol-listp fns)
                                 (and (symbol-alistp fake-fns)
                                      (nat-listp (strip-cdrs fake-fns)))
                                 (booleanp prefer-then))))
     (let ((__function__ 'find-a-base-case))
       (declare (ignorable __function__))
       (mv-let (erp all-base largest)
               (find-a-base-case-aux
                    term (append fns (strip-cars fake-fns))
                    prefer-then
                    (acl2::add-fake-fns-to-world fake-fns (w state))
                    state)
         (cond (erp (hard-error 'find-a-base-case
                                "Cannot find a base case!" nil))
               (all-base term)
               (t largest)))))