An 2-bit unsigned bitstruct type.
This is a bitstruct type introduced by defbitstruct, represented as a unsigned 2-bit integer.
This is an atomic/empty structure; it has no fields.
Function:
(defun 2bits-p (x) (declare (xargs :guard t)) (let ((__function__ '2bits-p)) (declare (ignorable __function__)) (mbe :logic (unsigned-byte-p 2 x) :exec (and (natp x) (< x 4)))))
Theorem:
(defthm 2bits-p-when-unsigned-byte-p (implies (unsigned-byte-p 2 x) (2bits-p x)))
Theorem:
(defthm unsigned-byte-p-when-2bits-p (implies (2bits-p x) (unsigned-byte-p 2 x)))
Theorem:
(defthm 2bits-p-compound-recognizer (implies (2bits-p x) (natp x)) :rule-classes :compound-recognizer)
Function:
(defun 2bits-fix (x) (declare (xargs :guard (2bits-p x))) (let ((__function__ '2bits-fix)) (declare (ignorable __function__)) (mbe :logic (loghead 2 x) :exec x)))
Theorem:
(defthm 2bits-p-of-2bits-fix (b* ((fty::fixed (2bits-fix x))) (2bits-p fty::fixed)) :rule-classes :rewrite)
Theorem:
(defthm 2bits-fix-when-2bits-p (implies (2bits-p x) (equal (2bits-fix x) x)))
Function:
(defun 2bits-equiv$inline (x y) (declare (xargs :guard (and (2bits-p x) (2bits-p y)))) (equal (2bits-fix x) (2bits-fix y)))
Theorem:
(defthm 2bits-equiv-is-an-equivalence (and (booleanp (2bits-equiv x y)) (2bits-equiv x x) (implies (2bits-equiv x y) (2bits-equiv y x)) (implies (and (2bits-equiv x y) (2bits-equiv y z)) (2bits-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm 2bits-equiv-implies-equal-2bits-fix-1 (implies (2bits-equiv x x-equiv) (equal (2bits-fix x) (2bits-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 2bits-fix-under-2bits-equiv (2bits-equiv (2bits-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))