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