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