Update the |TRUTH|::|TRUTH-IDX| field of a npn4 bit structure.
(!npn4->truth-idx truth-idx x) → new-x
Function:
(defun !npn4->truth-idx (truth-idx x) (declare (xargs :guard (and (truth-idx-p truth-idx) (npn4-p x)))) (mbe :logic (b* ((truth-idx (mbe :logic (truth-idx-fix truth-idx) :exec truth-idx)) (x (npn4-fix x))) (part-install truth-idx x :width 16 :low 0)) :exec (the (unsigned-byte 27) (logior (the (unsigned-byte 27) (logand (the (unsigned-byte 27) x) (the (signed-byte 17) -65536))) (the (unsigned-byte 16) truth-idx)))))
Theorem:
(defthm npn4-p-of-!npn4->truth-idx (b* ((new-x (!npn4->truth-idx truth-idx x))) (npn4-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !npn4->truth-idx-of-truth-idx-fix-truth-idx (equal (!npn4->truth-idx (truth-idx-fix truth-idx) x) (!npn4->truth-idx truth-idx x)))
Theorem:
(defthm !npn4->truth-idx-truth-idx-equiv-congruence-on-truth-idx (implies (truth-idx-equiv truth-idx truth-idx-equiv) (equal (!npn4->truth-idx truth-idx x) (!npn4->truth-idx truth-idx-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !npn4->truth-idx-of-npn4-fix-x (equal (!npn4->truth-idx truth-idx (npn4-fix x)) (!npn4->truth-idx truth-idx x)))
Theorem:
(defthm !npn4->truth-idx-npn4-equiv-congruence-on-x (implies (npn4-equiv x x-equiv) (equal (!npn4->truth-idx truth-idx x) (!npn4->truth-idx truth-idx x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !npn4->truth-idx-is-npn4 (equal (!npn4->truth-idx truth-idx x) (change-npn4 x :truth-idx truth-idx)))
Theorem:
(defthm npn4->truth-idx-of-!npn4->truth-idx (b* ((?new-x (!npn4->truth-idx truth-idx x))) (equal (npn4->truth-idx new-x) (truth-idx-fix truth-idx))))
Theorem:
(defthm !npn4->truth-idx-equiv-under-mask (b* ((?new-x (!npn4->truth-idx truth-idx x))) (npn4-equiv-under-mask new-x x -65536)))