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