• 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
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
        • Implemented-opcodes
        • To-do
        • Proof-utilities
        • Peripherals
        • Model-validation
        • Modelcalls
        • Concrete-simulation-examples
        • Utils
          • Structures
            • Rflagsbits
            • Cr4bits
            • Xcr0bits
            • Cr0bits
            • Prefixes
            • Ia32_eferbits
            • Evex-byte1
            • Cr3bits
            • Evex-byte3
            • Vex3-byte2
            • Vex3-byte1
            • Vex2-byte1
            • Evex-prefixes
            • Evex-byte2
            • Vex-prefixes
            • Sib
            • Modr/m-structures
            • Vex-prefixes-layout-structures
            • Sib-structures
            • Legacy-prefixes-layout-structure
            • Evex-prefixes-layout-structures
            • Cr8bits
              • !cr8bits->cr8-trpl
              • Cr8bits->cr8-trpl
              • Cr8bits-fix
              • Cr8bits-p
            • Opcode-maps-structures
            • Segmentation-bitstructs
            • 8bits
            • 2bits
            • 4bits
            • 16bits
            • Paging-bitstructs
            • 3bits
            • 11bits
            • 40bits
            • 5bits
            • 32bits
            • 19bits
            • 10bits
            • 7bits
            • 64bits
            • 54bits
            • 45bits
            • 36bits
            • 31bits
            • 24bits
            • 22bits
            • 17bits
            • 13bits
            • 12bits
            • 6bits
            • Vex->x
            • Vex->b
            • Vex-prefixes-map-p
            • Vex-prefixes-byte0-p
            • Vex->w
            • Vex->vvvv
            • Vex->r
            • Fp-bitstructs
            • Cr4bits-debug
            • Vex->pp
            • Vex->l
            • Rflagsbits-debug
            • Evex->v-prime
            • Evex->z
            • Evex->w
            • Evex->vvvv
            • Evex->vl/rc
            • Evex->pp
            • Evex->aaa
            • Xcr0bits-debug
            • Vex3-byte1-equiv-under-mask
            • Vex3-byte2-equiv-under-mask
            • Vex2-byte1-equiv-under-mask
            • Vex-prefixes-equiv-under-mask
            • Rflagsbits-equiv-under-mask
            • Ia32_eferbits-equiv-under-mask
            • Evex-prefixes-equiv-under-mask
            • Evex-byte3-equiv-under-mask
            • Evex-byte2-equiv-under-mask
            • Evex-byte1-equiv-under-mask
            • Cr0bits-debug
            • Xcr0bits-equiv-under-mask
            • Sib-equiv-under-mask
            • Prefixes-equiv-under-mask
            • Cr8bits-equiv-under-mask
            • Cr4bits-equiv-under-mask
            • Cr3bits-equiv-under-mask
            • Cr0bits-equiv-under-mask
            • Vex3-byte1-debug
            • Prefixes-debug
            • Ia32_eferbits-debug
            • Evex-byte1-debug
            • Vex3-byte2-debug
            • Vex2-byte1-debug
            • Vex-prefixes-debug
            • Evex-prefixes-debug
            • Evex-byte3-debug
            • Evex-byte2-debug
            • Cr3bits-debug
            • Sib-debug
            • Cr8bits-debug
          • Utilities
        • Debugging-code-proofs
      • 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
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Structures

Cr8bits

An 4-bit unsigned bitstruct type.

This is a bitstruct type introduced by defbitstruct, represented as a unsigned 4-bit integer.

Fields
cr8-trpl — 4bits

Source: Intel Manual, Dec-23, Vol. 3A, Section 2.5

Definitions and Theorems

Function: cr8bits-p$inline

(defun cr8bits-p$inline (x)
  (declare (xargs :guard t))
  (mbe :logic (unsigned-byte-p 4 x)
       :exec (and (natp x) (< x 16))))

Theorem: cr8bits-p-when-unsigned-byte-p

(defthm cr8bits-p-when-unsigned-byte-p
  (implies (unsigned-byte-p 4 x)
           (cr8bits-p x)))

Theorem: unsigned-byte-p-when-cr8bits-p

(defthm unsigned-byte-p-when-cr8bits-p
  (implies (cr8bits-p x)
           (unsigned-byte-p 4 x)))

Theorem: cr8bits-p-compound-recognizer

(defthm cr8bits-p-compound-recognizer
  (implies (cr8bits-p x) (natp x))
  :rule-classes :compound-recognizer)

Function: cr8bits-fix$inline

(defun cr8bits-fix$inline (x)
  (declare (xargs :guard (cr8bits-p x)))
  (mbe :logic (loghead 4 x) :exec x))

Theorem: cr8bits-p-of-cr8bits-fix

(defthm cr8bits-p-of-cr8bits-fix
  (b* ((fty::fixed (cr8bits-fix$inline x)))
    (cr8bits-p fty::fixed))
  :rule-classes :rewrite)

Theorem: cr8bits-fix-when-cr8bits-p

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

Function: cr8bits-equiv$inline

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

Theorem: cr8bits-equiv-is-an-equivalence

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

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

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

Theorem: cr8bits-fix-under-cr8bits-equiv

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

Function: cr8bits$inline

(defun cr8bits$inline (cr8-trpl)
  (declare (xargs :guard (4bits-p cr8-trpl)))
  (b* ((cr8-trpl (mbe :logic (4bits-fix cr8-trpl)
                      :exec cr8-trpl)))
    cr8-trpl))

Theorem: cr8bits-p-of-cr8bits

(defthm cr8bits-p-of-cr8bits
  (b* ((cr8bits (cr8bits$inline cr8-trpl)))
    (cr8bits-p cr8bits))
  :rule-classes :rewrite)

Theorem: cr8bits$inline-of-4bits-fix-cr8-trpl

(defthm cr8bits$inline-of-4bits-fix-cr8-trpl
  (equal (cr8bits$inline (4bits-fix cr8-trpl))
         (cr8bits$inline cr8-trpl)))

Theorem: cr8bits$inline-4bits-equiv-congruence-on-cr8-trpl

(defthm cr8bits$inline-4bits-equiv-congruence-on-cr8-trpl
  (implies (4bits-equiv cr8-trpl cr8-trpl-equiv)
           (equal (cr8bits$inline cr8-trpl)
                  (cr8bits$inline cr8-trpl-equiv)))
  :rule-classes :congruence)

Function: cr8bits-equiv-under-mask$inline

(defun cr8bits-equiv-under-mask$inline (x x1 mask)
  (declare (xargs :guard (and (cr8bits-p x)
                              (cr8bits-p x1)
                              (integerp mask))))
  (fty::int-equiv-under-mask (cr8bits-fix x)
                             (cr8bits-fix x1)
                             mask))

Function: cr8bits->cr8-trpl$inline

(defun cr8bits->cr8-trpl$inline (x)
  (declare (xargs :guard (cr8bits-p x)))
  (mbe :logic
       (let ((x (cr8bits-fix x)))
         (part-select x :low 0 :width 4))
       :exec (the (unsigned-byte 4)
                  (logand (the (unsigned-byte 4) 15)
                          (the (unsigned-byte 4) x)))))

Theorem: 4bits-p-of-cr8bits->cr8-trpl

(defthm 4bits-p-of-cr8bits->cr8-trpl
  (b* ((cr8-trpl (cr8bits->cr8-trpl$inline x)))
    (4bits-p cr8-trpl))
  :rule-classes :rewrite)

Theorem: cr8bits->cr8-trpl$inline-of-cr8bits-fix-x

(defthm cr8bits->cr8-trpl$inline-of-cr8bits-fix-x
  (equal (cr8bits->cr8-trpl$inline (cr8bits-fix x))
         (cr8bits->cr8-trpl$inline x)))

Theorem: cr8bits->cr8-trpl$inline-cr8bits-equiv-congruence-on-x

(defthm cr8bits->cr8-trpl$inline-cr8bits-equiv-congruence-on-x
  (implies (cr8bits-equiv x x-equiv)
           (equal (cr8bits->cr8-trpl$inline x)
                  (cr8bits->cr8-trpl$inline x-equiv)))
  :rule-classes :congruence)

Theorem: cr8bits->cr8-trpl-of-cr8bits

(defthm cr8bits->cr8-trpl-of-cr8bits
  (equal (cr8bits->cr8-trpl (cr8bits cr8-trpl))
         (4bits-fix cr8-trpl)))

Theorem: cr8bits->cr8-trpl-of-write-with-mask

(defthm cr8bits->cr8-trpl-of-write-with-mask
 (implies
  (and
    (fty::bitstruct-read-over-write-hyps x cr8bits-equiv-under-mask)
    (cr8bits-equiv-under-mask x y fty::mask)
    (equal (logand (lognot fty::mask) 15)
           0))
  (equal (cr8bits->cr8-trpl x)
         (cr8bits->cr8-trpl y))))

Theorem: cr8bits-fix-in-terms-of-cr8bits

(defthm cr8bits-fix-in-terms-of-cr8bits
  (equal (cr8bits-fix x)
         (change-cr8bits x)))

Function: !cr8bits->cr8-trpl$inline

(defun !cr8bits->cr8-trpl$inline (cr8-trpl x)
  (declare (xargs :guard (and (4bits-p cr8-trpl) (cr8bits-p x))))
  (mbe :logic
       (b* ((cr8-trpl (mbe :logic (4bits-fix cr8-trpl)
                           :exec cr8-trpl))
            (x (cr8bits-fix x)))
         (part-install cr8-trpl x
                       :width 4
                       :low 0))
       :exec (the (unsigned-byte 4)
                  (logior (the (unsigned-byte 4)
                               (logand (the (unsigned-byte 4) x)
                                       (the (signed-byte 5) -16)))
                          (the (unsigned-byte 4) cr8-trpl)))))

Theorem: cr8bits-p-of-!cr8bits->cr8-trpl

(defthm cr8bits-p-of-!cr8bits->cr8-trpl
  (b* ((new-x (!cr8bits->cr8-trpl$inline cr8-trpl x)))
    (cr8bits-p new-x))
  :rule-classes :rewrite)

Theorem: !cr8bits->cr8-trpl$inline-of-4bits-fix-cr8-trpl

(defthm !cr8bits->cr8-trpl$inline-of-4bits-fix-cr8-trpl
  (equal (!cr8bits->cr8-trpl$inline (4bits-fix cr8-trpl)
                                    x)
         (!cr8bits->cr8-trpl$inline cr8-trpl x)))

Theorem: !cr8bits->cr8-trpl$inline-4bits-equiv-congruence-on-cr8-trpl

(defthm !cr8bits->cr8-trpl$inline-4bits-equiv-congruence-on-cr8-trpl
  (implies (4bits-equiv cr8-trpl cr8-trpl-equiv)
           (equal (!cr8bits->cr8-trpl$inline cr8-trpl x)
                  (!cr8bits->cr8-trpl$inline cr8-trpl-equiv x)))
  :rule-classes :congruence)

Theorem: !cr8bits->cr8-trpl$inline-of-cr8bits-fix-x

(defthm !cr8bits->cr8-trpl$inline-of-cr8bits-fix-x
  (equal (!cr8bits->cr8-trpl$inline cr8-trpl (cr8bits-fix x))
         (!cr8bits->cr8-trpl$inline cr8-trpl x)))

Theorem: !cr8bits->cr8-trpl$inline-cr8bits-equiv-congruence-on-x

(defthm !cr8bits->cr8-trpl$inline-cr8bits-equiv-congruence-on-x
  (implies (cr8bits-equiv x x-equiv)
           (equal (!cr8bits->cr8-trpl$inline cr8-trpl x)
                  (!cr8bits->cr8-trpl$inline cr8-trpl x-equiv)))
  :rule-classes :congruence)

Theorem: !cr8bits->cr8-trpl-is-cr8bits

(defthm !cr8bits->cr8-trpl-is-cr8bits
  (equal (!cr8bits->cr8-trpl cr8-trpl x)
         (change-cr8bits x :cr8-trpl cr8-trpl)))

Theorem: cr8bits->cr8-trpl-of-!cr8bits->cr8-trpl

(defthm cr8bits->cr8-trpl-of-!cr8bits->cr8-trpl
  (b* ((?new-x (!cr8bits->cr8-trpl$inline cr8-trpl x)))
    (equal (cr8bits->cr8-trpl new-x)
           (4bits-fix cr8-trpl))))

Theorem: !cr8bits->cr8-trpl-equiv-under-mask

(defthm !cr8bits->cr8-trpl-equiv-under-mask
  (b* ((?new-x (!cr8bits->cr8-trpl$inline cr8-trpl x)))
    (cr8bits-equiv-under-mask new-x x 0)))

Function: cr8bits-debug$inline

(defun cr8bits-debug$inline (x)
  (declare (xargs :guard (cr8bits-p x)))
  (b* (((cr8bits x)))
    (cons (cons 'cr8-trpl x.cr8-trpl) nil)))

Subtopics

!cr8bits->cr8-trpl
Update the |X86ISA|::|CR8-TRPL| field of a cr8bits bit structure.
Cr8bits->cr8-trpl
Access the |X86ISA|::|CR8-TRPL| field of a cr8bits bit structure.
Cr8bits-fix
Fixing function for cr8bits bit structures.
Cr8bits-p
Recognizer for cr8bits bit structures.