• 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
        • Defun
        • Verify-guards
        • Table
        • Mutual-recursion
        • Memoize
        • Make-event
        • Include-book
        • Encapsulate
        • Defun-sk
        • Defttag
        • Defstobj
        • Defpkg
        • Defattach
        • Defabsstobj
        • Defchoose
        • Progn
        • Verify-termination
        • Redundant-events
        • Defmacro
        • Defconst
        • Skip-proofs
        • In-theory
        • Embedded-event-form
        • Value-triple
        • Comp
        • Local
        • Defthm
        • Progn!
        • Defevaluator
        • Theory-invariant
        • Assert-event
          • Assert!-stobj
          • Assert!
          • Defun-inline
          • Project-dir-alist
          • Partial-encapsulate
          • Define-trusted-clause-processor
          • Defproxy
          • Defexec
          • Defun-nx
          • Defthmg
          • Defpun
          • Defabbrev
          • Set-table-guard
          • Name
          • Defrec
          • Add-custom-keyword-hint
          • Regenerate-tau-database
          • Defcong
          • Deftheory
          • Defaxiom
          • Deftheory-static
          • Defund
          • Evisc-table
          • Verify-guards+
          • Logical-name
          • Profile
          • Defequiv
          • Defmacro-untouchable
          • Add-global-stobj
          • Defthmr
          • Defstub
          • Defrefinement
          • Deflabel
          • In-arithmetic-theory
          • Unmemoize
          • Defabsstobj-missing-events
          • Defthmd
          • Fake-event
          • Set-body
          • Defun-notinline
          • Functions-after
          • Macros-after
          • Dump-events
          • Defund-nx
          • Defun$
          • Remove-global-stobj
          • Remove-custom-keyword-hint
          • Dft
          • Defthy
          • Defund-notinline
          • Defnd
          • Defn
          • Defund-inline
          • Defmacro-last
        • Parallelism
        • History
        • Programming
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Std/testing
    • Assert-event
    • Errors

    Assert!

    Event variant of assert$ that abbreviates assert-event

    The assert! macro is similar to assert$, in that both check that a given form evaluates to a non-nil value. However, calls of assert! may appear as top-level events in books and encapsulate forms. Indeed, calls of assert! directly abbreviate corresponding calls of the built-in event macro, assert-event. You may find it more convenient to use assert-event, which has more options. In particular, with assert-event the assertion need not return a single, non-stobj value.

    See assert$ and assert* for assertion-checking utilities to use in programs.

    Example Forms:

    (assert! (equal 3 3))
    (assert! (null (@ ld-skip-proofsp)))
    (assert! (equal 3 3)
             (defun f (x) (cons x x)))

    General Forms:

    (assert! assertion)
    (assert! assertion event)

    where assertion evaluates to a single non-stobj value and event, if supplied and non-nil, is an event to be evaluated if the value of assertion is not nil. It is an error if that value is nil. As noted above, a call of assert! is an event: it can go into a book or an encapsulate or progn event.

    Calls of assert! skip evaluation of the given assertion when proofs are being skipped: during include-book, during the second pass of an encapsulate event, and after evaluating (set-ld-skip-proofsp t state).

    The two General Forms above may be expressed, respectively, in terms of the more flexible built-in event macro, assert-event, as follows. See assert-event for more detailed documentation.

    (assert-event assertion
                  :ctx ''assert!)
    (assert-event assertion
                  :event event
                  :ctx ''assert!)