An 4-bit unsigned bitstruct type.
This is a bitstruct type introduced by defbitstruct, represented as a unsigned 4-bit integer.
Source: Intel Manual, Dec-23, Vol. 3A, Section 2.5
Function:
(defun cr8bits-p$inline (x) (declare (xargs :guard t)) (mbe :logic (unsigned-byte-p 4 x) :exec (and (natp x) (< x 16))))
Theorem:
(defthm cr8bits-p-when-unsigned-byte-p (implies (unsigned-byte-p 4 x) (cr8bits-p x)))
Theorem:
(defthm unsigned-byte-p-when-cr8bits-p (implies (cr8bits-p x) (unsigned-byte-p 4 x)))
Theorem:
(defthm cr8bits-p-compound-recognizer (implies (cr8bits-p x) (natp x)) :rule-classes :compound-recognizer)
Function:
(defun cr8bits-fix$inline (x) (declare (xargs :guard (cr8bits-p x))) (mbe :logic (loghead 4 x) :exec x))
Theorem:
(defthm cr8bits-p-of-cr8bits-fix (b* ((fty::fixed (cr8bits-fix$inline x))) (cr8bits-p fty::fixed)) :rule-classes :rewrite)
Theorem:
(defthm cr8bits-fix-when-cr8bits-p (implies (cr8bits-p x) (equal (cr8bits-fix x) x)))
Function:
(defun cr8bits-equiv$inline (x y) (declare (xargs :guard (and (cr8bits-p x) (cr8bits-p y)))) (equal (cr8bits-fix x) (cr8bits-fix y)))
Theorem:
(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:
(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:
(defthm cr8bits-fix-under-cr8bits-equiv (cr8bits-equiv (cr8bits-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Function:
(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:
(defthm cr8bits-p-of-cr8bits (b* ((cr8bits (cr8bits$inline cr8-trpl))) (cr8bits-p cr8bits)) :rule-classes :rewrite)
Theorem:
(defthm cr8bits$inline-of-4bits-fix-cr8-trpl (equal (cr8bits$inline (4bits-fix cr8-trpl)) (cr8bits$inline cr8-trpl)))
Theorem:
(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:
(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:
(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:
(defthm 4bits-p-of-cr8bits->cr8-trpl (b* ((cr8-trpl (cr8bits->cr8-trpl$inline x))) (4bits-p cr8-trpl)) :rule-classes :rewrite)
Theorem:
(defthm cr8bits->cr8-trpl$inline-of-cr8bits-fix-x (equal (cr8bits->cr8-trpl$inline (cr8bits-fix x)) (cr8bits->cr8-trpl$inline x)))
Theorem:
(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:
(defthm cr8bits->cr8-trpl-of-cr8bits (equal (cr8bits->cr8-trpl (cr8bits cr8-trpl)) (4bits-fix cr8-trpl)))
Theorem:
(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:
(defthm cr8bits-fix-in-terms-of-cr8bits (equal (cr8bits-fix x) (change-cr8bits x)))
Function:
(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:
(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:
(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:
(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:
(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:
(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:
(defthm !cr8bits->cr8-trpl-is-cr8bits (equal (!cr8bits->cr8-trpl cr8-trpl x) (change-cr8bits x :cr8-trpl cr8-trpl)))
Theorem:
(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:
(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:
(defun cr8bits-debug$inline (x) (declare (xargs :guard (cr8bits-p x))) (b* (((cr8bits x))) (cons (cons 'cr8-trpl x.cr8-trpl) nil)))