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