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