• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
          • Instructions
            • Two-byte-opcodes
            • One-byte-opcodes
            • Fp-opcodes
            • Instruction-semantic-functions
            • X86-illegal-instruction
            • Implemented-opcodes
            • Opcode-maps
              • Cpuid
              • Opcode-maps-structures
                • Opcode
                  • Opcode-fix
                    • Make-opcode
                    • Opcode-p
                    • Opcode-equiv
                    • Change-opcode
                    • Opcode->superscripts
                    • Opcode->group
                    • Opcode->vex
                    • Opcode->r/m
                    • Opcode->reg
                    • Opcode->pfx
                    • Opcode->mode
                    • Opcode->feat
                    • Opcode->evex
                    • Opcode->rex
                    • Opcode->op
                    • Opcode->mod
                  • Inst
                  • Op/en-p
                  • Operands
                  • Inst-list-p
                  • Operand-type-p
                  • Strict-opcode-p
                  • Opcode-extension-group-p
                  • Superscripts-p
                  • Maybe-operands-p
                  • Exception-desc-p
                  • Count-avx-pfx-cases
                  • Mnemonic-p
                  • Maybe-3bits-p
                  • Op-pfx-p
                  • Maybe-vex-p
                  • Maybe-evex-p
                  • Fn-desc-p
                  • Op-mode-p
                  • Rex-p
                  • Mod-p
                  • Avx-pfx-well-formed-p
                  • Any-present-in
                  • Superscripts-fix
                  • Strict-opcode-fix
                  • Operand-type-fix
                  • Opcode-extension-group-fix
                  • Maybe-operands-fix
                  • Maybe-evex-fix
                  • Maybe-3bits-fix
                  • Keyword-list-fix
                  • Exception-desc-fix
                  • Rex-fix
                  • Op-pfx-fix
                  • Op-mode-fix
                  • Mod-fix
                  • Mnemonic-fix
                  • Maybe-vex-fix
                  • Fn-desc-fix
                  • Vex-p
                  • Evex-p
                • Implemented-opcodes
                • Chk-exc-fn
                • Filtering-instructions
                • Addressing-method-code-p
                • Operand-type-code-p
                • Eval-pre-map
              • X86-general-protection
              • X86-device-not-available
              • X86-step-unimplemented
              • Privileged-opcodes
              • Three-byte-opcodes
            • Register-readers-and-writers
            • X86-modes
            • Segmentation
            • Other-non-deterministic-computations
            • Environment
            • Paging
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Opcode

    Opcode-fix

    Fixing function for opcode structures.

    Signature
    (opcode-fix x) → new-x
    Arguments
    x — Guard (opcode-p x).
    Returns
    new-x — Type (opcode-p new-x).

    Definitions and Theorems

    Function: opcode-fix$inline

    (defun opcode-fix$inline (x)
     (declare (xargs :guard (opcode-p x)))
     (let ((__function__ 'opcode-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (b*
        ((op (24bits-fix
                  (std::prod-car (std::prod-car (std::prod-car x)))))
         (mode
          (op-mode-fix
               (std::prod-car
                    (std::prod-cdr (std::prod-car (std::prod-car x))))))
         (reg
          (maybe-3bits-fix
               (std::prod-cdr
                    (std::prod-cdr (std::prod-car (std::prod-car x))))))
         (mod
            (mod-fix (std::prod-car (std::prod-cdr (std::prod-car x)))))
         (r/m
          (maybe-3bits-fix
               (std::prod-car
                    (std::prod-cdr (std::prod-cdr (std::prod-car x))))))
         (pfx
          (op-pfx-fix
               (std::prod-cdr
                    (std::prod-cdr (std::prod-cdr (std::prod-car x))))))
         (rex
            (rex-fix (std::prod-car (std::prod-car (std::prod-cdr x)))))
         (vex
          (maybe-vex-fix
               (std::prod-car
                    (std::prod-cdr (std::prod-car (std::prod-cdr x))))))
         (evex
          (maybe-evex-fix
               (std::prod-cdr
                    (std::prod-cdr (std::prod-car (std::prod-cdr x))))))
         (feat (acl2::symbol-list-fix
                    (std::prod-car (std::prod-cdr (std::prod-cdr x)))))
         (superscripts
          (superscripts-fix
               (std::prod-car
                    (std::prod-cdr (std::prod-cdr (std::prod-cdr x))))))
         (group
          (opcode-extension-group-fix
              (std::prod-cdr
                   (std::prod-cdr (std::prod-cdr (std::prod-cdr x)))))))
        (std::prod-cons
          (std::prod-cons (std::prod-cons op (std::prod-cons mode reg))
                          (std::prod-cons mod (std::prod-cons r/m pfx)))
          (std::prod-cons
               (std::prod-cons rex (std::prod-cons vex evex))
               (std::prod-cons feat
                               (std::prod-cons superscripts group)))))
       :exec x)))

    Theorem: opcode-p-of-opcode-fix

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

    Theorem: opcode-fix-when-opcode-p

    (defthm opcode-fix-when-opcode-p
      (implies (opcode-p x)
               (equal (opcode-fix x) x)))

    Function: opcode-equiv$inline

    (defun opcode-equiv$inline (x y)
      (declare (xargs :guard (and (opcode-p x) (opcode-p y))))
      (equal (opcode-fix x) (opcode-fix y)))

    Theorem: opcode-equiv-is-an-equivalence

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

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

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

    Theorem: opcode-fix-under-opcode-equiv

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

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

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

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

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

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

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

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

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