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