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