• 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
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Std/system/term-queries

    Check-lambda-call

    Check if a term is a (translated) call of a lambda expression.

    Signature
    (check-lambda-call term) → (mv yes/no formals body args)
    Arguments
    term — Guard (pseudo-termp term).
    Returns
    yes/no — Type (booleanp yes/no).
    formals — Type (symbol-listp formals), given the guard.
    body — Type (pseudo-termp body), given the guard.
    args — Type (pseudo-term-listp args), given the guard.

    If it is, the first result is t and the other results are the formal parameters of the lambda expression, the body of the lambda expression, and the arguments on which the lambda expression is called. Otherwise, all the results are nil.

    See also check-nary-lambda-call.

    Definitions and Theorems

    Function: check-lambda-call

    (defun check-lambda-call (term)
      (declare (xargs :guard (pseudo-termp term)))
      (let ((__function__ 'check-lambda-call))
        (declare (ignorable __function__))
        (b* (((when (variablep term))
              (mv nil nil nil nil))
             ((when (fquotep term))
              (mv nil nil nil nil))
             (fn (ffn-symb term))
             ((when (symbolp fn))
              (mv nil nil nil nil)))
          (mv t (lambda-formals fn)
              (lambda-body fn)
              (fargs term)))))

    Theorem: booleanp-of-check-lambda-call.yes/no

    (defthm booleanp-of-check-lambda-call.yes/no
      (b* (((mv ?yes/no ?formals ?body ?args)
            (check-lambda-call term)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: symbol-listp-of-check-lambda-call.formals

    (defthm symbol-listp-of-check-lambda-call.formals
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (symbol-listp formals)))
      :rule-classes :rewrite)

    Theorem: pseudo-termp-of-check-lambda-call.body

    (defthm pseudo-termp-of-check-lambda-call.body
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (pseudo-termp body)))
      :rule-classes :rewrite)

    Theorem: pseudo-term-listp-of-check-lambda-call.args

    (defthm pseudo-term-listp-of-check-lambda-call.args
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (pseudo-term-listp args)))
      :rule-classes :rewrite)

    Theorem: len-of-check-lambda-calls.formals-is-args

    (defthm len-of-check-lambda-calls.formals-is-args
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (equal (len formals) (len args)))))

    Theorem: len-of-check-lambda-calls.args-is-formals

    (defthm len-of-check-lambda-calls.args-is-formals
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (equal (len args) (len formals)))))

    Theorem: true-listp-of-check-lambda-call.formals

    (defthm true-listp-of-check-lambda-call.formals
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (true-listp formals)))
      :rule-classes :type-prescription)

    Theorem: true-listp-of-check-lambda-call.args

    (defthm true-listp-of-check-lambda-call.args
      (implies (and (pseudo-termp term))
               (b* (((mv ?yes/no ?formals ?body ?args)
                     (check-lambda-call term)))
                 (true-listp args)))
      :rule-classes :type-prescription)

    Theorem: acl2-count-of-check-lambda-call.body

    (defthm acl2-count-of-check-lambda-call.body
      (b* (((mv ?yes/no ?formals ?body ?args)
            (check-lambda-call term)))
        (implies yes/no
                 (< (acl2-count body)
                    (acl2-count term))))
      :rule-classes :linear)

    Theorem: acl2-count-of-check-lambda-call.args

    (defthm acl2-count-of-check-lambda-call.args
      (b* (((mv ?yes/no ?formals ?body ?args)
            (check-lambda-call term)))
        (implies yes/no
                 (< (acl2-count args)
                    (acl2-count term))))
      :rule-classes :linear)