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