The byte at the smallest address should be the last byte of bytes.
(write-bytes-to-memory ptr bytes x86) → (mv flg x86)
Function:
(defun write-bytes-to-memory (ptr bytes x86) (declare (xargs :stobjs (x86))) (declare (type (signed-byte 49) ptr)) (declare (xargs :guard (and (integerp ptr) (<= (- *2^47*) ptr) (byte-listp bytes) (< (+ -1 (len bytes) ptr) *2^47*)) :split-types t)) (let ((__function__ 'write-bytes-to-memory)) (declare (ignorable __function__)) (if (mbt (and (integerp ptr) (<= (- *2^47*) ptr) (byte-listp bytes) (< (+ -1 (len bytes) ptr) *2^47*))) (if (endp bytes) (mv nil x86) (b* (((mv flg x86) (wml08 ptr (the (unsigned-byte 8) (car bytes)) x86)) ((when flg) (mv flg x86))) (write-bytes-to-memory (the (signed-byte 49) (1+ ptr)) (cdr bytes) x86))) (mv t x86))))
Theorem:
(defthm x86p-of-write-bytes-to-memory.x86 (implies (x86p x86) (b* (((mv ?flg ?x86) (write-bytes-to-memory ptr bytes x86))) (x86p x86))) :rule-classes :rewrite)
Theorem:
(defthm rewrite-write-bytes-to-memory-to-wb (implies (and (app-view x86) (canonical-address-p (+ -1 (len bytes) addr)) (canonical-address-p addr) (byte-listp bytes)) (and (equal (mv-nth 0 (write-bytes-to-memory addr bytes x86)) (mv-nth 0 (wb (len bytes) addr :w (combine-bytes bytes) x86))) (equal (mv-nth 1 (write-bytes-to-memory addr bytes x86)) (mv-nth 1 (wb (len bytes) addr :w (combine-bytes bytes) x86))))))