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