Function:
(defun rb-1 (n addr r-x x86) (declare (xargs :stobjs (x86))) (declare (type (member :r :x) r-x)) (declare (xargs :guard (and (natp n) (integerp addr)))) (declare (xargs :guard (canonical-address-p (+ -1 n addr)))) (let ((__function__ 'rb-1)) (declare (ignorable __function__)) (if (zp n) (mv nil 0 x86) (b* (((unless (canonical-address-p addr)) (mv 'rb-1 0 x86)) ((mv flg0 byte0 x86) (rvm08 addr x86)) ((when flg0) (mv flg0 0 x86)) ((mv rest-flg rest-bytes x86) (rb-1 (1- n) (1+ addr) r-x x86))) (mv rest-flg (logior byte0 (ash rest-bytes 8)) x86)))))
Theorem:
(defthm natp-of-rb-1.val (b* (((mv ?flg ?val ?new-x86) (rb-1 n addr r-x x86))) (natp val)) :rule-classes :type-prescription)
Theorem:
(defthm x86p-of-rb-1.new-x86 (implies (x86p x86) (b* (((mv ?flg ?val ?new-x86) (rb-1 n addr r-x x86))) (x86p new-x86))) :rule-classes :rewrite)
Theorem:
(defthm integerp-of-mv-nth-1-rb-1 (b* (((mv ?flg ?val ?new-x86) (rb-1 n addr r-x x86))) (integerp val)) :rule-classes :type-prescription)
Theorem:
(defthm rb-1-returns-x86-app-view (b* (((mv ?flg ?val ?new-x86) (rb-1 n addr r-x x86))) (implies (app-view x86) (equal new-x86 x86))))
Theorem:
(defthm rb-1-returns-no-error-app-view (implies (and (canonical-address-p addr) (canonical-address-p (+ -1 n addr)) (app-view x86)) (equal (mv-nth 0 (rb-1 n addr r-x x86)) nil)))
Theorem:
(defthm size-of-rb-1 (implies (and (equal m (ash n 3)) (natp n)) (unsigned-byte-p m (mv-nth 1 (rb-1 n addr r-x x86)))) :rule-classes (:rewrite (:linear :corollary (implies (and (equal m (ash n 3)) (natp n)) (and (<= 0 (mv-nth 1 (rb-1 n addr r-x x86))) (< (mv-nth 1 (rb-1 n addr r-x x86)) (expt 2 m)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))