(read-channel-into-memory channel ptr bytes-read x86 state) → (mv bytes-read x86 state)
Function:
(defun read-channel-into-memory (channel ptr bytes-read x86 state) (declare (xargs :stobjs (x86 state))) (declare (xargs :guard (and (symbolp channel) (canonical-address-p ptr) (natp bytes-read)))) (declare (xargs :guard (and (open-input-channel-p channel :byte state) (canonical-address-p (+ ptr bytes-read))))) (let ((__function__ 'read-channel-into-memory)) (declare (ignorable __function__)) (b* ((bytes-read (nfix bytes-read)) ((mv current-byte state) (read-byte$ channel state)) ((when (not current-byte)) (mv bytes-read x86 state)) ((mv flg x86) (wml08 (+ ptr bytes-read) current-byte x86)) ((when (or flg (not (canonical-address-p (+ ptr bytes-read 1))))) (mv bytes-read x86 state))) (read-channel-into-memory channel ptr (1+ bytes-read) x86 state))))
Theorem:
(defthm natp-of-read-channel-into-memory.bytes-read (implies (and (state-p1 state) (symbolp channel) (open-input-channel-p channel :byte state)) (b* (((mv ?bytes-read ?x86 acl2::?state) (read-channel-into-memory channel ptr bytes-read x86 state))) (natp bytes-read))) :rule-classes :rewrite)
Theorem:
(defthm x86p-of-read-channel-into-memory.x86 (implies (x86p x86) (b* (((mv ?bytes-read ?x86 acl2::?state) (read-channel-into-memory channel ptr bytes-read x86 state))) (x86p x86))) :rule-classes :rewrite)
Theorem:
(defthm state-p1-of-read-channel-into-memory.state (implies (and (state-p1 state) (symbolp channel) (open-input-channel-p1 channel :byte state)) (b* (((mv ?bytes-read ?x86 acl2::?state) (read-channel-into-memory channel ptr bytes-read x86 state))) (state-p1 state))) :rule-classes :rewrite)
Theorem:
(defthm read-channel-into-memory-leaves-channel-open (implies (open-input-channel-p1 channel :byte state) (open-input-channel-p1 channel :byte (mv-nth 2 (read-channel-into-memory channel ptr bytes-read x86 state)))))