Concatenate 4 bytes together to form an 32-bit result.
(merge-4-u8s a3 a2 a1 a0) → result
Function:
(defun acl2::merge-4-u8s$inline (a3 a2 a1 a0) (declare (type (unsigned-byte 8) a3 a2 a1 a0)) (declare (xargs :guard t)) (let ((__function__ 'merge-4-u8s)) (declare (ignorable __function__)) (mbe :logic (logapp* 8 (nfix a0) (nfix a1) (nfix a2) (nfix a3) 0) :exec (b* ((ans a0) (ans (the (unsigned-byte 32) (logior (the (unsigned-byte 32) (ash a1 (* 1 8))) (the (unsigned-byte 32) ans)))) (ans (the (unsigned-byte 32) (logior (the (unsigned-byte 32) (ash a2 (* 2 8))) (the (unsigned-byte 32) ans))))) (the (unsigned-byte 32) (logior (the (unsigned-byte 32) (ash a3 (* 3 8))) (the (unsigned-byte 32) ans)))))))
Theorem:
(defthm acl2::natp-of-merge-4-u8s (b* ((result (acl2::merge-4-u8s$inline a3 a2 a1 a0))) (natp result)) :rule-classes :type-prescription)
Theorem:
(defthm unsigned-byte-p-32-of-merge-4-u8s (unsigned-byte-p 32 (merge-4-u8s a3 a2 a1 a0)) :rule-classes ((:rewrite :corollary (implies (>= (nfix n) 32) (unsigned-byte-p n (merge-4-u8s a3 a2 a1 a0))) :hints (("Goal" :in-theory (disable unsigned-byte-p))))))
Theorem:
(defthm merge-4-u8s-is-merge-unsigneds (equal (merge-4-u8s a3 a2 a1 a0) (merge-unsigneds 8 (list (nfix a3) (nfix a2) (nfix a1) (nfix a0)))))
Theorem:
(defthm nat-equiv-implies-equal-merge-4-u8s-4 (implies (nat-equiv a0 a0-equiv) (equal (merge-4-u8s a3 a2 a1 a0) (merge-4-u8s a3 a2 a1 a0-equiv))) :rule-classes (:congruence))
Theorem:
(defthm nat-equiv-implies-equal-merge-4-u8s-3 (implies (nat-equiv a1 a1-equiv) (equal (merge-4-u8s a3 a2 a1 a0) (merge-4-u8s a3 a2 a1-equiv a0))) :rule-classes (:congruence))
Theorem:
(defthm nat-equiv-implies-equal-merge-4-u8s-2 (implies (nat-equiv a2 a2-equiv) (equal (merge-4-u8s a3 a2 a1 a0) (merge-4-u8s a3 a2-equiv a1 a0))) :rule-classes (:congruence))
Theorem:
(defthm nat-equiv-implies-equal-merge-4-u8s-1 (implies (nat-equiv a3 a3-equiv) (equal (merge-4-u8s a3 a2 a1 a0) (merge-4-u8s a3-equiv a2 a1 a0))) :rule-classes (:congruence))