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