Check if a mathematical integer is
in the range of (i.e. representable in) type
Function:
(defun uchar-rangep (val) (declare (xargs :guard (integerp val))) (let ((__function__ 'uchar-rangep)) (declare (ignorable __function__)) (and (<= 0 (ifix val)) (<= (ifix val) (uchar-max)))))
Theorem:
(defthm booleanp-of-uchar-rangep (b* ((yes/no (uchar-rangep val))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm uchar-rangep-of-ifix-val (equal (uchar-rangep (ifix val)) (uchar-rangep val)))
Theorem:
(defthm uchar-rangep-int-equiv-congruence-on-val (implies (acl2::int-equiv val val-equiv) (equal (uchar-rangep val) (uchar-rangep val-equiv))) :rule-classes :congruence)