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