• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Memoize
        • Mbe
        • Io
        • Apply$
        • Defpkg
        • Mutual-recursion
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Loop$-primer
        • Fast-alists
        • Defmacro
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Irrelevant-formals
        • Efficiency
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
          • Value-triple
          • Error-checking
          • Er
          • Assert-event
          • Error-triple
          • Set-warnings-as-errors
          • Hard-error
          • Set-inhibit-er
          • Must-fail
          • Breaks
          • Assert!-stobj
          • Ctx
          • Must-eval-to
          • Assert!
          • Must-succeed
          • Assert$
          • Illegal
          • Er-progn
            • Error1
            • Ctxp
            • Er-hard
            • Must-succeed*
            • Toggle-inhibit-er
            • Assert*
            • Assert?
            • Er-soft+
            • Er-hard?
            • Must-fail-with-soft-error
            • Must-fail-with-hard-error
            • Must-fail-with-error
            • Break$
            • Must-eval-to-t
            • Er-soft-logic
            • Er-soft
            • Convert-soft-error
            • Toggle-inhibit-er!
            • Set-inhibit-er!
            • Must-not-prove
            • Must-prove
            • Must-fail!
            • Must-be-redundant
            • Must-succeed!
            • Must-fail-local
            • Assert-equal
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Defmacro-untouchable
          • Primitive
          • <<
          • Revert-world
          • Set-duplicate-keys-action
          • Unmemoize
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Defopen
          • Sleep
        • Start-here
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Errors
    • Programming-with-state
    • ACL2-built-ins

    Er-progn

    Perform a sequence of state-changing ``error triples''

    Example:
    (er-progn (check-good-foo-p (f-get-global 'my-foo state) state)
              (value (* (f-get-global 'my-foo state)
                        (f-get-global 'bar state))))

    This sequencing primitive is only useful when programming with state, something that very few users will probably want to do. See state.

    Er-progn is used much the way that progn is used in Common Lisp, except that it expects each form within it to evaluate to an error-triple of the form (mv erp val state). The first such form, if any, that evaluates to such a triple where erp is not nil yields the error triple returned by the er-progn. If there is no such form, then the er-progn form returns the value of the last form.

    General Form:
    (er-progn <expr1> ... <exprk>)

    where each <expri> is an expression that evaluates to an error triple (see programming-with-state). The above form is essentially equivalent to the following (``essentially'' because in fact, care is taken to avoid variable capture).

    (mv-let (erp val state)
            <expr1>
            (cond (erp (mv erp val state))
                  (t (mv-let (erp val state)
                             <expr2>
                             (cond (erp (mv erp val state))
                                   (t ...
                                          (mv-let (erp val state)
                                                  <expr{k-1}>
                                                  (cond (erp (mv erp val state))
                                                        (t <exprk>)))))))))