• 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
              • Stat
                • Statp
                • Stat-fix
                  • Stat-equiv
                  • Make-stat
                  • Change-stat
                  • Stat->memory
                  • Stat->error
                  • Stat->xregs
                  • Stat->pc
                • Stat-validp
                • Read-instruction
                • Write-memory-unsigned64
                • Write-memory-unsigned32
                • Write-memory-unsigned8
                • Write-memory-unsigned16
                • Write-xreg-32
                • Read-xreg-unsigned
                • Write-xreg
                • Read-memory-unsigned64
                • Read-memory-unsigned8
                • Read-memory-unsigned32
                • Read-xreg-signed
                • Read-memory-unsigned16
                • Read-xreg-unsigned32
                • Write-pc
                • Read-xreg-signed32
                • Inc4-pc
                • Read-pc
                • Errorp
                • Error
              • Reads-over-writes
              • Semantics-equivalences
              • Decoding
              • Execution
            • 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
    • Stat

    Stat-fix

    Fixing function for stat structures.

    Signature
    (stat-fix x) → new-x
    Arguments
    x — Guard (statp x).
    Returns
    new-x — Type (statp new-x).

    Definitions and Theorems

    Function: stat-fix$inline

    (defun stat-fix$inline (x)
     (declare (xargs :guard (statp x)))
     (let ((__function__ 'stat-fix))
      (declare (ignorable __function__))
      (mbe :logic
           (b* ((xregs (cdr (std::da-nth 0 x)))
                (pc (cdr (std::da-nth 1 x)))
                (memory (acl2::ubyte8-list-fix (cdr (std::da-nth 2 x))))
                (error (acl2::bool-fix (cdr (std::da-nth 3 x)))))
             (list (cons 'xregs xregs)
                   (cons 'pc pc)
                   (cons 'memory memory)
                   (cons 'error error)))
           :exec x)))

    Theorem: statp-of-stat-fix

    (defthm statp-of-stat-fix
      (b* ((new-x (stat-fix$inline x)))
        (statp new-x))
      :rule-classes :rewrite)

    Theorem: stat-fix-when-statp

    (defthm stat-fix-when-statp
      (implies (statp x)
               (equal (stat-fix x) x)))

    Function: stat-equiv$inline

    (defun stat-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (statp acl2::x) (statp acl2::y))))
      (equal (stat-fix acl2::x)
             (stat-fix acl2::y)))

    Theorem: stat-equiv-is-an-equivalence

    (defthm stat-equiv-is-an-equivalence
      (and (booleanp (stat-equiv x y))
           (stat-equiv x x)
           (implies (stat-equiv x y)
                    (stat-equiv y x))
           (implies (and (stat-equiv x y) (stat-equiv y z))
                    (stat-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: stat-equiv-implies-equal-stat-fix-1

    (defthm stat-equiv-implies-equal-stat-fix-1
      (implies (stat-equiv acl2::x x-equiv)
               (equal (stat-fix acl2::x)
                      (stat-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: stat-fix-under-stat-equiv

    (defthm stat-fix-under-stat-equiv
      (stat-equiv (stat-fix acl2::x) acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-stat-fix-1-forward-to-stat-equiv

    (defthm equal-of-stat-fix-1-forward-to-stat-equiv
      (implies (equal (stat-fix acl2::x) acl2::y)
               (stat-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-stat-fix-2-forward-to-stat-equiv

    (defthm equal-of-stat-fix-2-forward-to-stat-equiv
      (implies (equal acl2::x (stat-fix acl2::y))
               (stat-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: stat-equiv-of-stat-fix-1-forward

    (defthm stat-equiv-of-stat-fix-1-forward
      (implies (stat-equiv (stat-fix acl2::x) acl2::y)
               (stat-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: stat-equiv-of-stat-fix-2-forward

    (defthm stat-equiv-of-stat-fix-2-forward
      (implies (stat-equiv acl2::x (stat-fix acl2::y))
               (stat-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)