• 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-nary-lambda-call

    Check if a term is a (translated) call of an n-ary lambda expression.

    Signature
    (check-nary-lambda-call term n) 
      → 
    (mv yes/no formals body args)
    Arguments
    term — Guard (pseudo-termp term).
    n — Guard (natp n).
    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.

    This is like check-lambda-call but it additionally requires the lambda expression to have a specified arity. It is accompanied by theorems saying that the lengths of the formal and argument lists equal the specified arity.

    See also check-unary-lambda-call.

    Definitions and Theorems

    Function: check-nary-lambda-call

    (defun check-nary-lambda-call (term n)
      (declare (xargs :guard (and (pseudo-termp term) (natp n))))
      (let ((__function__ 'check-nary-lambda-call))
        (declare (ignorable __function__))
        (b* (((mv yes/no formals body args)
              (check-lambda-call term))
             ((unless yes/no) (mv nil nil nil nil))
             ((unless (equal (len formals) n))
              (mv nil nil nil nil)))
          (mv t formals body args))))

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

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

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

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

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

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

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

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

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

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

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

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

    Theorem: len-of-check-nary-lambda-call.formals

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

    Theorem: len-of-check-nary-lambda-call.args

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

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

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

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

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