• 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-user-lambda

    Recognize untranslated lambda expressions that are valid for evaluation.

    Signature
    (check-user-lambda x wrld) → (mv lambd/message stobjs-out)
    Arguments
    wrld — Guard (plist-worldp wrld).
    Returns
    lambd/message — A pseudo-termp or msgp.
    stobjs-out — A symbol-listp.

    An untranslated lambda expression is a lambda expression as entered by the user. This function checks whether xis a true list of exactly three elements, whose first element is the symbol lambda, whose second element is a list of legal variable symbols without duplicates, and whose third element is an untranslated term that is valid for evaluation.

    If the check succeeds, the translated lambda expression is returned, along with the stobjs-out list of the body of the lambda expression (see check-user-term for an explanation of the stobjs-out list of a term). Otherwise, a possibly structured error message is returned (printable with ~@), along with nil as stobjs-out list.

    The check-user-lambda function does not terminate if check-user-term does not terminate.

    Definitions and Theorems

    Function: check-user-lambda

    (defun check-user-lambda (x wrld)
      (declare (xargs :guard (plist-worldp wrld)))
      (let ((__function__ 'check-user-lambda))
        (declare (ignorable __function__))
        (b* (((unless (true-listp x))
              (mv (msg "~x0 is not a true list." x)
                  nil))
             ((unless (= (len x) 3))
              (mv (msg "~x0 does not consist of exactly three elements."
                       x)
                  nil))
             ((unless (eq (first x) 'lambda))
              (mv (msg "~x0 does not start with LAMBDA." x)
                  nil))
             ((unless (arglistp (second x)))
              (mv (msg "~x0 does not have valid formal parameters."
                       x)
                  nil))
             ((mv term/message stobjs-out)
              (check-user-term (third x) wrld))
             ((when (msgp term/message))
              (mv (msg "~x0 does not have a valid body.  ~@1"
                       x term/message)
                  nil)))
          (mv (cons 'lambda
                    (cons (second x)
                          (cons term/message 'nil)))
              stobjs-out))))