Check if an ACL2 integer is
a valid index (i.e. in range)
for an array of type
(ulong-array-integer-index-okp array index) → yes/no
Function:
(defun ulong-array-integer-index-okp (array index) (declare (xargs :guard (and (ulong-arrayp array) (integerp index)))) (let ((__function__ 'ulong-array-integer-index-okp)) (declare (ignorable __function__)) (integer-range-p 0 (ulong-array-length array) (ifix index))))
Theorem:
(defthm booleanp-of-ulong-array-integer-index-okp (b* ((yes/no (ulong-array-integer-index-okp array index))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm ulong-array-integer-index-okp-of-ulong-array-fix-array (equal (ulong-array-integer-index-okp (ulong-array-fix array) index) (ulong-array-integer-index-okp array index)))
Theorem:
(defthm ulong-array-integer-index-okp-ulong-array-equiv-congruence-on-array (implies (ulong-array-equiv array array-equiv) (equal (ulong-array-integer-index-okp array index) (ulong-array-integer-index-okp array-equiv index))) :rule-classes :congruence)
Theorem:
(defthm ulong-array-integer-index-okp-of-ifix-index (equal (ulong-array-integer-index-okp array (ifix index)) (ulong-array-integer-index-okp array index)))
Theorem:
(defthm ulong-array-integer-index-okp-int-equiv-congruence-on-index (implies (acl2::int-equiv index index-equiv) (equal (ulong-array-integer-index-okp array index) (ulong-array-integer-index-okp array index-equiv))) :rule-classes :congruence)