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