• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
          • Simplify-defun
          • Isodata
          • Tailrec
            • Tailrec-implementation
              • Tailrec-event-generation
              • Tailrec-fn
              • Tailrec-macro-definition
              • Tailrec-input-processing
                • Tailrec-process-inputs
                • Tailrec-process-old
                • Tailrec-process-domain
                • Tailrec-decompose-recursive-branch
                • Tailrec-check-nonrec-conditions
                • Tailrec-process-variant
                • Tailrec-infer-domain
                  • Tailrec-find-nonrec-term-in-term/terms
                  • Tailrec-process-accumulator
                  • Tailrec-variantp
            • 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
            • Simplify-term-programmatic
            • Simplify-defun-sk-programmatic
            • Simplify-defun-programmatic
            • Simplify-defun+
            • Common-options
            • Common-concepts
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • Soft
          • C
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Tailrec-input-processing

    Tailrec-infer-domain

    Infer the domain over which some applicability conditions must hold.

    Signature
    (tailrec-infer-domain combine q r variant$ verbose wrld) 
      → 
    domain
    Arguments
    combine — Guard (pseudo-termp combine).
    q — Guard (symbolp q).
    r — Guard (symbolp r).
    variant$ — Guard (tailrec-variantp variant$).
    verbose — Guard (booleanp verbose).
    wrld — Guard (plist-worldp wrld).
    Returns
    domain — A pseudo-termfnp.

    This is used when the :domain input is :auto. A domain is inferred as described in the documentation.

    Definitions and Theorems

    Function: tailrec-infer-domain

    (defun tailrec-infer-domain (combine q r variant$ verbose wrld)
     (declare (xargs :guard (and (pseudo-termp combine)
                                 (symbolp q)
                                 (symbolp r)
                                 (tailrec-variantp variant$)
                                 (booleanp verbose)
                                 (plist-worldp wrld))))
     (let ((__function__ 'tailrec-infer-domain))
       (declare (ignorable __function__))
       (b*
        ((default '(lambda (x) 't))
         (domain (if (member-eq variant$ '(:monoid :monoid-alt))
                     (case-match combine
                       ((op . args)
                        (b* (((unless (symbolp op)) default)
                             ((unless (or (equal args (list q r))
                                          (equal args (list r q))))
                              default)
                             ((list y1 y2) (formals op wrld))
                             (guard (uguard op wrld)))
                          (case-match guard
                            (('if (dom !y1) (dom !y2) *nil*)
                             (if (symbolp dom) dom default))
                            (('if (dom !y2) (dom !y1) *nil*)
                             (if (symbolp dom) dom default))
                            ((dom !y1)
                             (if (symbolp dom) dom default))
                            ((dom !y2)
                             (if (symbolp dom) dom default))
                            (& default))))
                       (& default))
                   default))
         ((run-when verbose)
          (cw "~%")
          (cw "Inferred domain for the applicability conditions: ~x0.~%"
              domain)))
        domain)))