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