Specification for the
(mul-spec size dst src) → (mv * * *)
Function:
(defun mul-spec$inline (size dst src) (declare (type (member 1 2 4 8) size)) (declare (xargs :guard (case size (1 (and (n08p src) (n08p dst))) (2 (and (n16p src) (n16p dst))) (4 (and (n32p src) (n32p dst))) (8 (and (n64p src) (n64p dst))) (otherwise nil)))) (case size (1 (mul-spec-8 dst src)) (2 (mul-spec-16 dst src)) (4 (mul-spec-32 dst src)) (8 (mul-spec-64 dst src)) (otherwise (mv 0 0 0))))
Theorem:
(defthm mv-nth-0-mul-spec (implies (member size '(1 2 4 8)) (unsigned-byte-p (ash size 3) (mv-nth 0 (mul-spec size dst src)))) :rule-classes (:rewrite (:type-prescription :corollary (implies (member size '(1 2 4 8)) (natp (mv-nth 0 (mul-spec size dst src)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (implies (member size '(1 2 4 8)) (and (<= 0 (mv-nth 0 (mul-spec size dst src))) (< (mv-nth 0 (mul-spec size dst src)) (expt 2 (ash size 3))))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-1-mul-spec (implies (member size '(1 2 4 8)) (unsigned-byte-p (ash size 3) (mv-nth 1 (mul-spec size dst src)))) :rule-classes (:rewrite (:type-prescription :corollary (implies (member size '(1 2 4 8)) (natp (mv-nth 1 (mul-spec size dst src)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (implies (member size '(1 2 4 8)) (and (<= 0 (mv-nth 1 (mul-spec size dst src))) (< (mv-nth 1 (mul-spec size dst src)) (expt 2 (ash size 3))))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm mv-nth-2-mul-spec (implies (member size '(1 2 4 8)) (unsigned-byte-p (* 2 (ash size 3)) (mv-nth 2 (mul-spec size dst src)))) :rule-classes (:rewrite (:type-prescription :corollary (implies (member size '(1 2 4 8)) (natp (mv-nth 2 (mul-spec size dst src)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp)))) (:linear :corollary (implies (member size '(1 2 4 8)) (and (<= 0 (mv-nth 2 (mul-spec size dst src))) (< (mv-nth 2 (mul-spec size dst src)) (expt 2 (* 2 (ash size 3)))))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))