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