Recognizer for ubyte2.
(ubyte2p x) → yes/no
Function:
(defun ubyte2p (x) (declare (xargs :guard t)) (mbe :logic (unsigned-byte-p 2 x) :exec (and (integerp x) (<= 0 x) (< x 4))))
Theorem:
(defthm booleanp-of-ubyte2p (b* ((yes/no (ubyte2p x))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm ubyte2p-forward-unsigned-byte-p (implies (ubyte2p x) (unsigned-byte-p 2 x)) :rule-classes :forward-chaining)
Theorem:
(defthm unsigned-byte-p-rewrite-ubyte2p (equal (unsigned-byte-p 2 x) (ubyte2p x)))
Theorem:
(defthm natp-when-ubyte2p (implies (ubyte2p x) (natp x)) :rule-classes :compound-recognizer)