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