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