• 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
        • Stobj
        • State
          • World
          • Io
            • Fmt
            • Msg
            • Cw
            • Set-evisc-tuple
            • Set-iprint
            • Print-control
            • Read-file-into-string
            • Std/io
            • Msgp
            • Printing-to-strings
            • Evisc-tuple
            • Output-controls
            • Observation
              • *standard-co*
              • Ppr-special-syms
              • Standard-oi
              • Standard-co
              • Without-evisc
              • Serialize
              • Output-to-file
              • Fmt-to-comment-window
              • Princ$
              • Character-encoding
              • Open-output-channel!
              • Cw-print-base-radix
              • Set-print-case
              • Set-print-base
              • Print-object$
              • Extend-pathname
              • Print-object$+
              • Fmx-cw
              • Set-print-radix
              • Set-fmt-hard-right-margin
              • File-write-date$
              • Proofs-co
              • Set-print-base-radix
              • Print-base-p
              • *standard-oi*
              • Wof
              • File-length$
              • Fms!-lst
              • Delete-file$
              • *standard-ci*
              • Write-list
              • Trace-co
              • Fmt!
              • Fms
              • Cw!
              • Fmt-to-comment-window!
              • Fms!
              • Eviscerate-hide-terms
              • Fmt1!
              • Fmt-to-comment-window!+
              • Read-file-into-byte-array-stobj
              • Fmt1
              • Fmt-to-comment-window+
              • Cw-print-base-radix!
              • Read-file-into-character-array-stobj
              • Fmx
              • Cw!+
              • Read-objects-from-book
              • Newline
              • Cw+
              • Probe-file
              • Write-objects-to-file!
              • Write-objects-to-file
              • Read-objects-from-file
              • Read-object-from-file
              • Read-file-into-byte-list
              • Set-fmt-soft-right-margin
              • Read-file-into-character-list
              • Io-utilities
            • Wormhole
            • Programming-with-state
            • W
            • Set-state-ok
            • Random$
          • Mutual-recursion
          • Memoize
          • Mbe
          • Io
            • Fmt
            • Msg
            • Cw
            • Set-evisc-tuple
            • Set-iprint
            • Print-control
            • Read-file-into-string
            • Std/io
            • Msgp
            • Printing-to-strings
            • Evisc-tuple
            • Output-controls
            • Observation
              • *standard-co*
              • Ppr-special-syms
              • Standard-oi
              • Standard-co
              • Without-evisc
              • Serialize
              • Output-to-file
              • Fmt-to-comment-window
              • Princ$
              • Character-encoding
              • Open-output-channel!
              • Cw-print-base-radix
              • Set-print-case
              • Set-print-base
              • Print-object$
              • Extend-pathname
              • Print-object$+
              • Fmx-cw
              • Set-print-radix
              • Set-fmt-hard-right-margin
              • File-write-date$
              • Proofs-co
              • Set-print-base-radix
              • Print-base-p
              • *standard-oi*
              • Wof
              • File-length$
              • Fms!-lst
              • Delete-file$
              • *standard-ci*
              • Write-list
              • Trace-co
              • Fmt!
              • Fms
              • Cw!
              • Fmt-to-comment-window!
              • Fms!
              • Eviscerate-hide-terms
              • Fmt1!
              • Fmt-to-comment-window!+
              • Read-file-into-byte-array-stobj
              • Fmt1
              • Fmt-to-comment-window+
              • Cw-print-base-radix!
              • Read-file-into-character-array-stobj
              • Fmx
              • Cw!+
              • Read-objects-from-book
              • Newline
              • Cw+
              • Probe-file
              • Write-objects-to-file!
              • Write-objects-to-file
              • Read-objects-from-file
              • Read-object-from-file
              • Read-file-into-byte-list
              • Set-fmt-soft-right-margin
              • Read-file-into-character-list
              • Io-utilities
            • 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
      • Io
      • ACL2-built-ins

      Observation

      Print an observation

      Here is a typical application of observation.

      ACL2 !>(let ((ctx 'top-level)
                   (name 'foo))
               (observation ctx
                            "Skipping processing of name ~x0."
                            name))
      
      ACL2 Observation in TOP-LEVEL:  Skipping processing of name FOO.
      <state>
      ACL2 !>

      Observation prints an initial ``ACL2 Observation...: '', and then prints the indicated message using formatted printing (see fmt). Notice in the example above that evaluation of a call of observation returns state. Indeed, observation is actually a macro whose expansion takes and returns the ACL2 state. A similar utility, observation-cw, is available that does not take or return state; rather, it returns nil as the suffix ``cw'' suggests that a ``comment window'' is the target of this printing, rather than the state. For example:

      ACL2 !>(let ((ctx 'top-level)
                   (name 'foo))
               (observation-cw ctx
                               "Skipping processing of name ~x0."
                               name))
      
      ACL2 Observation in TOP-LEVEL:  Skipping processing of name FOO.
      NIL
      ACL2 !>

      Observation-cw takes exactly the same arguments as observation, but observation-cw does its printing in a so-called ``wormhole''; see wormhole.

      General Forms:
      (observation    ctx fmt-string fmt-arg1 fmt-arg2 ... fmt-argk)
      (observation-cw ctx fmt-string fmt-arg1 fmt-arg2 ... fmt-argk)

      where ctx generally evaluates to a symbol (but see below), and fmt-string together with the fmt-argi are suitable for passing to fmt. Output begins and ends with a newline.

      Recall from the example above that the output from a call of observation (or observation-cw) begins with ``ACL2 Observation'' and additional characters ending in ``: '', for example `` in TOP-LEVEL: '', followed by formatted output produced from fmt-string with the given fmt-argi. The characters printed immediately following the string ``ACL2 Observation'' depend on the value of ctx. If ctx is nil, nothing is printed. If ctx is a non-nil symbol, it is printed using fmt directive ~x. If ctx is a cons pair whose car is a symbol, formatted printing is applied to the string "(~x0 ~x1 ...)", where #\0 and #\1 are bound respectively to that car and cdr. Otherwise, ctx is printed using fmt directive ~@.

      We next discuss situations in which printing is inhibited for observation and observation-cw. No printing is done when observation is among the inhibited output types; see set-inhibit-output-lst. Moreover, no printing is done by observation during include-book. If you want to avoid printing from observation-cw during include-book, then you need to manage that yourself.