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