• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
          • Atc
          • Transformation-tools
          • Language
            • Abstract-syntax
            • Integer-ranges
            • Implementation-environments
            • Dynamic-semantics
              • Exec-expr
              • Exec
                • Exec-expr
                • Exec-stmt
                • Exec-fun
                • Exec-stmt-while
                • Exec-block-item-list
                • Exec-block-item
                • Exec-expr-list
                • Exec-obj-declon
                • Exec-stmt-dowhile
                  • Exec-initer
                • Exec-arrsub
                • Variable-resolution-preservation
                • Init-value-to-value
                • Apconvert-expr-value
                • Execution-limit-monotonicity
                • Exec-memberp
                • Exec-stmt
                • Exec-address
                • Init-scope
                • Exec-unary
                • Exec-member
                • Exec-fun
                • Exec-stmt-while
                • Eval-iconst
                • Exec-binary-strict-pure
                • Variable-visibility-preservation
                • Object-type-preservation
                • Eval-binary-strict-pure
                • Exec-block-item-list
                • Exec-indir
                • Exec-ident
                • Exec-block-item
                • Eval-cast
                • Frame-and-scope-peeling
                • Exec-expr-list
                • Exec-obj-declon
                • Exec-cast
                • Exec-const
                • Eval-unary
                • Exec-stmt-dowhile
                  • Exec-initer
                  • Eval-const
                  • Execution-without-function-calls
                • Static-semantics
                • Grammar
                • Types
                • Integer-formats-definitions
                • Computation-states
                • Portable-ascii-identifiers
                • Values
                • Integer-operations
                • Object-designators
                • Operations
                • Errors
                • Tag-environments
                • Function-environments
                • Character-sets
                • Flexible-array-member-removal
                • Arithmetic-operations
                • Pointer-operations
                • Real-operations
                • Array-operations
                • Scalar-operations
                • Structure-operations
              • Representation
              • Insertion-sort
              • Pack
            • Soft
            • Bv
            • Imp-language
            • Ethereum
            • Event-macros
            • Java
            • Riscv
            • Bitcoin
            • Zcash
            • Yul
            • ACL2-programming-language
            • Prime-fields
            • Json
            • Syntheto
            • File-io-light
            • Cryptography
            • Number-theory
            • Axe
            • Lists-light
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • Math
        • Testing-utilities
      • Dynamic-semantics
      • Exec

      Exec-stmt-dowhile

      Execute a do-while statement.

      Signature
      (exec-stmt-dowhile body test compst fenv limit) 
        → 
      (mv sval new-compst)
      Arguments
      body — Guard (stmtp body).
      test — Guard (exprp test).
      compst — Guard (compustatep compst).
      fenv — Guard (fun-envp fenv).
      limit — Guard (natp limit).
      Returns
      sval — Type (stmt-value-resultp sval).
      new-compst — Type (compustatep new-compst).

      First, we execute the body, pushing and then popping a scope, because the body forms a block [C17:6.8.5/5]. If the body terminates with a return, we end the execution of the loop with the same result. Otherwise, we execute the test. If it yields a 0 scalar, the loop terminates execution, with a statement value indicating non-return termination. Otherwise, we re-execute the loop, by calling this ACL2 function recursively.