(read-64ule-n n channel state) reads
Function:
(defun tr-read-64ule-n (n channel state acc) (declare (xargs :guard (and (natp n) (state-p state) (symbolp channel) (open-input-channel-p channel :byte state) (true-listp acc)))) (if (mbe :logic (zp n) :exec (= 0 n)) (mv (reverse acc) state) (mv-let (byte state) (read-64ule channel state) (cond ((eq byte nil) (mv 'fail state)) ((eq byte 'fail) (mv 'fail state)) (t (tr-read-64ule-n (1- n) channel state (cons byte acc)))))))
Function:
(defun read-64ule-n (n channel state) (declare (xargs :guard (and (natp n) (state-p state) (symbolp channel) (open-input-channel-p channel :byte state)))) (mbe :logic (if (zp n) (mv nil state) (mv-let (byte state) (read-64ule channel state) (cond ((eq byte nil) (mv 'fail state)) ((eq byte 'fail) (mv 'fail state)) (t (mv-let (rest state) (read-64ule-n (1- n) channel state) (mv (if (eq rest 'fail) 'fail (cons byte rest)) state)))))) :exec (tr-read-64ule-n n channel state nil)))
Theorem:
(defthm read-64ule-n-state (implies (and (force (state-p1 state)) (force (symbolp channel)) (force (open-input-channel-p1 channel :byte state))) (state-p1 (mv-nth 1 (read-64ule-n n channel state)))))
Theorem:
(defthm read-64ule-n-open-input-channel (implies (and (force (state-p1 state)) (force (symbolp channel)) (force (open-input-channel-p1 channel :byte state))) (open-input-channel-p1 channel :byte (mv-nth 1 (read-64ule-n n channel state)))))
Theorem:
(defthm read-64ule-n-data (implies (not (equal (mv-nth 0 (read-64ule-n n channel state)) 'fail)) (and (true-listp (mv-nth 0 (read-64ule-n n channel state))) (equal (len (mv-nth 0 (read-64ule-n n channel state))) (nfix n)))))