• 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
      • Riscv
        • Semantics
        • Instructions
        • States
        • Decoding
        • Encoding
        • Features
        • Rv32im
        • Rv64im
        • Execution
          • Stepn
            • Step
            • Execution64
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • 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
      • Community
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Execution

    Stepn

    Multi-step execution.

    Signature
    (stepn n stat feat) → new-stat
    Arguments
    n — Guard (natp n).
    stat — Guard (statp stat).
    feat — Guard (featp feat).
    Returns
    new-stat — Type (statp new-stat).

    We perform n steps, or fewer if the error flag is or gets set. If n is 0, we return the state unchanged.

    Definitions and Theorems

    Function: stepn

    (defun stepn (n stat feat)
      (declare (xargs :guard (and (natp n)
                                  (statp stat)
                                  (featp feat))))
      (declare (xargs :guard (stat-validp stat feat)))
      (let ((__function__ 'stepn))
        (declare (ignorable __function__))
        (cond ((zp n) (stat-fix stat))
              ((errorp stat feat) (stat-fix stat))
              (t (stepn (1- n) (step stat feat) feat)))))

    Theorem: statp-of-stepn

    (defthm statp-of-stepn
      (b* ((new-stat (stepn n stat feat)))
        (statp new-stat))
      :rule-classes :rewrite)

    Theorem: stat-validp-of-stepn

    (defthm stat-validp-of-stepn
      (implies (stat-validp stat feat)
               (b* ((?new-stat (stepn n stat feat)))
                 (stat-validp new-stat feat))))

    Theorem: stepn-of-nfix-n

    (defthm stepn-of-nfix-n
      (equal (stepn (nfix n) stat feat)
             (stepn n stat feat)))

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

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

    Theorem: stepn-of-stat-fix-stat

    (defthm stepn-of-stat-fix-stat
      (equal (stepn n (stat-fix stat) feat)
             (stepn n stat feat)))

    Theorem: stepn-stat-equiv-congruence-on-stat

    (defthm stepn-stat-equiv-congruence-on-stat
      (implies (stat-equiv stat stat-equiv)
               (equal (stepn n stat feat)
                      (stepn n stat-equiv feat)))
      :rule-classes :congruence)

    Theorem: stepn-of-feat-fix-feat

    (defthm stepn-of-feat-fix-feat
      (equal (stepn n stat (feat-fix feat))
             (stepn n stat feat)))

    Theorem: stepn-feat-equiv-congruence-on-feat

    (defthm stepn-feat-equiv-congruence-on-feat
      (implies (feat-equiv feat feat-equiv)
               (equal (stepn n stat feat)
                      (stepn n stat feat-equiv)))
      :rule-classes :congruence)