Access the |TRUTH|::|POLARITY| field of a npn4 bit structure.
(npn4->polarity x) → polarity
Function:
(defun npn4->polarity (x) (declare (xargs :guard (npn4-p x))) (mbe :logic (let ((x (npn4-fix x))) (part-select x :low 17 :width 4)) :exec (the (unsigned-byte 4) (logand (the (unsigned-byte 4) 15) (the (unsigned-byte 10) (ash (the (unsigned-byte 27) x) -17))))))
Theorem:
(defthm polarity4-p-of-npn4->polarity (b* ((polarity (npn4->polarity x))) (polarity4-p polarity)) :rule-classes :rewrite)
Theorem:
(defthm npn4->polarity-of-npn4-fix-x (equal (npn4->polarity (npn4-fix x)) (npn4->polarity x)))
Theorem:
(defthm npn4->polarity-npn4-equiv-congruence-on-x (implies (npn4-equiv x x-equiv) (equal (npn4->polarity x) (npn4->polarity x-equiv))) :rule-classes :congruence)
Theorem:
(defthm npn4->polarity-of-npn4 (equal (npn4->polarity (npn4 truth-idx negate polarity perm)) (polarity4-fix polarity)))
Theorem:
(defthm npn4->polarity-of-write-with-mask (implies (and (fty::bitstruct-read-over-write-hyps x npn4-equiv-under-mask) (npn4-equiv-under-mask x acl2::y fty::mask) (equal (logand (lognot fty::mask) 1966080) 0)) (equal (npn4->polarity x) (npn4->polarity acl2::y))))