• 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-term

    Recognize untranslated terms that are valid for evaluation.

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

    An untranslated term is a term as entered by the user. This function checks x by attempting to translate it. If the translation succeeds, the translated term is returned, along with the stobjs-out list of the term (see below for details). Otherwise, a structured error message is returned (printable with ~@), along with nil as stobjs-out list. These two possible outcomes can be distinguished by the fact that the former yields a pseudo-term while the latter does not.

    The stobjs-out list of a term is the term analogous of the stobjs-out property of a function, namely a list of symbols that is like a ``mask'' for the result. A nil in the list means that the corresponding result is a non-stobj value, while the name of a stobj in the list means that the corresponding result is the named stobj. The list is a singleton, unless the term returns multiple values.

    We create a fresh function symbol fn and pass it to translate1-cmp as stobjs-out and binding. This means that we are checking that the term can be used in a function body. This is stricter than checking the term to be valid for use in a defthm and defun-nx.

    If translate1-cmp is successful, it returns updated bindings that associate fn to the output stobjs of the term.

    The check-user-term function does not terminate if the translation expands an ill-behaved macro that does not terminate.

    Definitions and Theorems

    Function: check-user-term

    (defun check-user-term (x wrld)
      (declare (xargs :guard (plist-worldp wrld)))
      (let ((__function__ 'check-user-term))
        (declare (ignorable __function__))
        (let ((fn (gen-new-name '__fn__ wrld)))
          (mv-let (ctx term/message bindings)
                  (translate1-cmp x fn (cons (cons fn fn) 'nil)
                                  t __function__
                                  wrld (default-state-vars nil))
            (declare (ignore ctx))
            (if (pseudo-termp term/message)
                (mv term/message (cdr (assoc fn bindings)))
              (mv term/message nil))))))