• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
        • Primitive-functions
        • Translated-terms
        • Values
        • Evaluation
          • Step-from-trans
          • Call-primitive-function
          • Step-from-init
          • Put-leftmost-nonconst
          • Exec-outcome
          • Stepn
            • Step
            • Terminatingp
            • Get-leftmost-nonconst
            • Exec-call
            • Step*
          • Program-equivalence
          • Functions
          • Packages
          • Programs
          • Interpreter
          • Evaluation-states
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Evaluation

    Stepn

    Perform at most a given number of evaluation steps.

    Signature
    (stepn estate n program) → new-estate
    Arguments
    estate — Guard (eval-state-p estate).
    n — Guard (natp n).
    program — Guard (programp program).
    Returns
    new-estate — Type (eval-state-p new-estate).

    We repeatedly call step until either we reach a final or error state (from where no further evaluation step may take place) or we exhaust the given (maximum) number of steps.

    Definitions and Theorems

    Function: stepn

    (defun stepn (estate n program)
      (declare (xargs :guard (and (eval-state-p estate)
                                  (natp n)
                                  (programp program))))
      (let ((__function__ 'stepn))
        (declare (ignorable __function__))
        (b* (((when (zp n)) (eval-state-fix estate))
             ((when (member-eq (eval-state-kind estate)
                               '(:final :error)))
              (eval-state-fix estate))
             (estate (step estate program)))
          (stepn estate (1- n) program))))

    Theorem: eval-state-p-of-stepn

    (defthm eval-state-p-of-stepn
      (b* ((new-estate (stepn estate n program)))
        (eval-state-p new-estate))
      :rule-classes :rewrite)

    Theorem: stepn-of-eval-state-fix-estate

    (defthm stepn-of-eval-state-fix-estate
      (equal (stepn (eval-state-fix estate)
                    n program)
             (stepn estate n program)))

    Theorem: stepn-eval-state-equiv-congruence-on-estate

    (defthm stepn-eval-state-equiv-congruence-on-estate
      (implies (eval-state-equiv estate estate-equiv)
               (equal (stepn estate n program)
                      (stepn estate-equiv n program)))
      :rule-classes :congruence)

    Theorem: stepn-of-nfix-n

    (defthm stepn-of-nfix-n
      (equal (stepn estate (nfix n) program)
             (stepn estate n program)))

    Theorem: stepn-nat-equiv-congruence-on-n

    (defthm stepn-nat-equiv-congruence-on-n
      (implies (acl2::nat-equiv n n-equiv)
               (equal (stepn estate n program)
                      (stepn estate n-equiv program)))
      :rule-classes :congruence)

    Theorem: stepn-of-program-fix-program

    (defthm stepn-of-program-fix-program
      (equal (stepn estate n (program-fix program))
             (stepn estate n program)))

    Theorem: stepn-program-equiv-congruence-on-program

    (defthm stepn-program-equiv-congruence-on-program
      (implies (program-equiv program program-equiv)
               (equal (stepn estate n program)
                      (stepn estate n program-equiv)))
      :rule-classes :congruence)