• 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

    Step

    Single-step execution.

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

    We make no change if the error flag is set. Otherwise, we read the program counter, we read the 32-bit encoding of the instruction from there, we decode it, and, if we obtain an instruction, we run the semantic function of the instruction; if decoding fails, we set the error flag instead.

    Definitions and Theorems

    Function: step

    (defun step (stat feat)
      (declare (xargs :guard (and (statp stat) (featp feat))))
      (declare (xargs :guard (stat-validp stat feat)))
      (let ((__function__ 'step))
        (declare (ignorable __function__))
        (b* (((when (errorp stat feat))
              (stat-fix stat))
             (pc (read-pc stat feat))
             (enc (read-instruction pc stat feat))
             (instr? (decode enc feat))
             ((unless instr?) (error stat feat)))
          (exec-instr instr? pc stat feat))))

    Theorem: statp-of-step

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

    Theorem: stat-validp-of-step

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

    Theorem: step-of-stat-fix-stat

    (defthm step-of-stat-fix-stat
      (equal (step (stat-fix stat) feat)
             (step stat feat)))

    Theorem: step-stat-equiv-congruence-on-stat

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

    Theorem: step-of-feat-fix-feat

    (defthm step-of-feat-fix-feat
      (equal (step stat (feat-fix feat))
             (step stat feat)))

    Theorem: step-feat-equiv-congruence-on-feat

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