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