(div-spec-8 dst src) → (mv * * *)
Function:
(defun div-spec-8 (dst src) (declare (type (unsigned-byte 16) dst) (type (unsigned-byte 8) src)) (declare (xargs :guard (not (equal src 0)))) (let ((__function__ 'div-spec-8)) (declare (ignorable __function__)) (b* ((dst (mbe :logic (n-size 16 dst) :exec dst)) (src (mbe :logic (n-size 8 src) :exec src)) (quotient (the (unsigned-byte 16) (floor dst src))) (remainder (the (unsigned-byte 8) (mod dst src))) (overflow? (< 255 quotient)) ((when overflow?) (mv (list (cons 'quotient quotient) (cons 'remainder remainder)) 0 0))) (mv overflow? quotient remainder))))
Theorem:
(defthm n08-mv-nth-1-div-spec-8 (implies (not (mv-nth 0 (div-spec-8 dst src))) (unsigned-byte-p 8 (mv-nth 1 (div-spec-8 dst src)))) :rule-classes (:rewrite (:type-prescription :corollary (implies (not (mv-nth 0 (div-spec-8 dst src))) (natp (mv-nth 1 (div-spec-8 dst src)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (implies (not (mv-nth 0 (div-spec-8 dst src))) (and (<= 0 (mv-nth 1 (div-spec-8 dst src))) (< (mv-nth 1 (div-spec-8 dst src)) 256))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-2-div-spec-8 (implies (and (unsigned-byte-p 8 src) (< 0 src)) (unsigned-byte-p 8 (mv-nth 2 (div-spec-8 dst src)))) :rule-classes (:rewrite (:type-prescription :corollary (implies (and (unsigned-byte-p 8 src) (< 0 src)) (natp (mv-nth 2 (div-spec-8 dst src)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (implies (and (unsigned-byte-p 8 src) (< 0 src)) (and (<= 0 (mv-nth 2 (div-spec-8 dst src))) (< (mv-nth 2 (div-spec-8 dst src)) 256))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))