Update the |COMMON-LISP|::|MOD| field of a modr/m bit structure.
Function:
(defun !modr/m->mod$inline (mod x) (declare (xargs :guard (and (2bits-p mod) (modr/m-p x)))) (mbe :logic (b* ((mod (mbe :logic (2bits-fix mod) :exec mod)) (x (modr/m-fix x))) (part-install mod x :width 2 :low 6)) :exec (the (unsigned-byte 8) (logior (the (unsigned-byte 8) (logand (the (unsigned-byte 8) x) (the (signed-byte 9) -193))) (the (unsigned-byte 8) (ash (the (unsigned-byte 2) mod) 6))))))
Theorem:
(defthm modr/m-p-of-!modr/m->mod (b* ((new-x (!modr/m->mod$inline mod x))) (modr/m-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !modr/m->mod$inline-of-2bits-fix-mod (equal (!modr/m->mod$inline (2bits-fix mod) x) (!modr/m->mod$inline mod x)))
Theorem:
(defthm !modr/m->mod$inline-2bits-equiv-congruence-on-mod (implies (2bits-equiv mod mod-equiv) (equal (!modr/m->mod$inline mod x) (!modr/m->mod$inline mod-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !modr/m->mod$inline-of-modr/m-fix-x (equal (!modr/m->mod$inline mod (modr/m-fix x)) (!modr/m->mod$inline mod x)))
Theorem:
(defthm !modr/m->mod$inline-modr/m-equiv-congruence-on-x (implies (modr/m-equiv x x-equiv) (equal (!modr/m->mod$inline mod x) (!modr/m->mod$inline mod x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !modr/m->mod-is-modr/m (equal (!modr/m->mod mod x) (change-modr/m x :mod mod)))
Theorem:
(defthm modr/m->mod-of-!modr/m->mod (b* ((?new-x (!modr/m->mod$inline mod x))) (equal (modr/m->mod new-x) (2bits-fix mod))))
Theorem:
(defthm !modr/m->mod-equiv-under-mask (b* ((?new-x (!modr/m->mod$inline mod x))) (modr/m-equiv-under-mask new-x x 63)))