• 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
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Riscv
          • Specification
            • Semantics
            • Features
            • Instructions
            • Encoding
            • States
            • Reads-over-writes
            • Semantics-equivalences
            • Decoding
            • Execution
              • Step
              • Stepn
            • Executable
            • Specialized
            • Optimized
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • 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: 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)

    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))))