• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
          • Saving-event-data
          • Trans-eval
            • User-stobjs-modified-warnings
            • Trans-eval-and-stobjs
            • Trans-eval-and-locally-bound-stobjs
          • System-utilities-non-built-in
          • Get-event-data
          • Untranslate
          • Constraint-info
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
        • Program-wrapper
        • Get-internal-time
        • Basics
        • Packages
        • Oracle-eval
        • Defmacro-untouchable
        • <<
        • Primitive
        • Revert-world
        • Unmemoize
        • Set-duplicate-keys-action
        • Symbols
        • Def-list-constructor
        • Easy-simplify-term
        • Defiteration
        • Fake-oracle-eval
        • Defopen
        • Sleep
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • System-utilities

Trans-eval

Evaluate a form

This relatively advanced system utility translates and evaluates a form. The following examples illustrate that an error-triple is returned whose value component is (stobjs-out . values).

ACL2 !>(trans-eval '(+ 3 4) 'my-ctx state nil)
 ((NIL) . 7)
ACL2 !>(trans-eval '(mv (+ 3 4) (car '(5))) 'my-ctx state nil)
 ((NIL NIL) 7 5)
ACL2 !>
General Form:

(trans-eval form  ; an untranslated form
            ctx   ; a context
            state
            aokp) ; allow attachments

The result is an error-triple, (mv erp val state). The value of erp is non-nil if there is an error when translating form. Otherwise erp is typically nil, in which case val is a cons pair whose car is the stobjs-out — a list whose length is the number of values returned, with nil in each position except when occupied by a returned stobj for that position — and whose cdr is the returned value or list of values in the multiple-value case.

Also see simple-translate-and-eval-cmp in the ACL2 sources, and see trans-eval-error-triple (and, which is perhaps less useful, trans-eval-state).

If you use trans-eval then you may see a warning, for example as follows.

ACL2 !>(foo st state)

ACL2 Warning [User-stobjs-modified] in FOO:  A call of the ACL2 evaluator
on the term (UPDATE-FLD '4 ST) may have modified the user stobj ST.  See
:DOC user-stobjs-modified-warning.

(4 <state> <st>)
ACL2 !>

These warnings indicate a potentially serious violation of applicative semantics when one is also updating user-defined stobjs outside calls of trans-eval! To understand and perhaps avoid such warnings, see user-stobjs-modified-warnings. Also see trans-eval-and-locally-bound-stobjs for discussion of how trans-eval modifies global stobj values, not locally-bound stobjs.

Subtopics

User-stobjs-modified-warnings
Interactions of trans-eval with stobjs that violate applicative semantics
Trans-eval-and-stobjs
How user-defined stobjs are handled by trans-eval
Trans-eval-and-locally-bound-stobjs
Trans-eval deals in global stobjs.