Write an element to an array of type
(slong-array-write array index element) → new-array
Function:
(defun slong-array-write (array index element) (declare (xargs :guard (and (slong-arrayp array) (cintegerp index) (slongp element)))) (declare (xargs :guard (slong-array-index-okp array index))) (let ((__function__ 'slong-array-write)) (declare (ignorable __function__)) (if (mbt (slong-array-index-okp array index)) (slong-array-of (update-nth (integer-from-cinteger index) (slong-fix element) (slong-array->elements array))) (slong-array-fix array))))
Theorem:
(defthm slong-arrayp-of-slong-array-write (b* ((new-array (slong-array-write array index element))) (slong-arrayp new-array)) :rule-classes :rewrite)
Theorem:
(defthm len-of-slong-array->elements-of-slong-array-write (equal (len (slong-array->elements (slong-array-write array index element))) (len (slong-array->elements array))))
Theorem:
(defthm slong-array-length-of-slong-array-write (equal (slong-array-length (slong-array-write array index element)) (slong-array-length array)))
Theorem:
(defthm slong-array-write-to-integer-write (equal (slong-array-write array index val) (slong-array-integer-write array (integer-from-cinteger index) val)))
Theorem:
(defthm slong-array-write-alt-def (implies (and (slong-arrayp array) (cintegerp index) (slongp elem) (slong-array-index-okp array index)) (equal (slong-array-write array index elem) (value-array-write (integer-from-cinteger index) elem array))))
Theorem:
(defthm slong-array-write-of-slong-array-fix-array (equal (slong-array-write (slong-array-fix array) index element) (slong-array-write array index element)))
Theorem:
(defthm slong-array-write-slong-array-equiv-congruence-on-array (implies (slong-array-equiv array array-equiv) (equal (slong-array-write array index element) (slong-array-write array-equiv index element))) :rule-classes :congruence)
Theorem:
(defthm slong-array-write-of-cinteger-fix-index (equal (slong-array-write array (cinteger-fix index) element) (slong-array-write array index element)))
Theorem:
(defthm slong-array-write-cinteger-equiv-congruence-on-index (implies (cinteger-equiv index index-equiv) (equal (slong-array-write array index element) (slong-array-write array index-equiv element))) :rule-classes :congruence)
Theorem:
(defthm slong-array-write-of-slong-fix-element (equal (slong-array-write array index (slong-fix element)) (slong-array-write array index element)))
Theorem:
(defthm slong-array-write-slong-equiv-congruence-on-element (implies (slong-equiv element element-equiv) (equal (slong-array-write array index element) (slong-array-write array index element-equiv))) :rule-classes :congruence)