Update the |AIGNET|::|NEG| field of a simpcode bit structure.
(!simpcode->neg neg x) → new-x
Function:
(defun !simpcode->neg (neg x) (declare (xargs :guard (and (bitp neg) (simpcode-p x)))) (mbe :logic (b* ((neg (mbe :logic (bfix neg) :exec neg)) (x (simpcode-fix x))) (part-install neg x :width 1 :low 0)) :exec (the (unsigned-byte 4) (logior (the (unsigned-byte 4) (logand (the (unsigned-byte 4) x) (the (signed-byte 2) -2))) (the (unsigned-byte 1) neg)))))
Theorem:
(defthm simpcode-p-of-!simpcode->neg (b* ((new-x (!simpcode->neg neg x))) (simpcode-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm !simpcode->neg-of-bfix-neg (equal (!simpcode->neg (bfix neg) x) (!simpcode->neg neg x)))
Theorem:
(defthm !simpcode->neg-bit-equiv-congruence-on-neg (implies (bit-equiv neg neg-equiv) (equal (!simpcode->neg neg x) (!simpcode->neg neg-equiv x))) :rule-classes :congruence)
Theorem:
(defthm !simpcode->neg-of-simpcode-fix-x (equal (!simpcode->neg neg (simpcode-fix x)) (!simpcode->neg neg x)))
Theorem:
(defthm !simpcode->neg-simpcode-equiv-congruence-on-x (implies (simpcode-equiv x x-equiv) (equal (!simpcode->neg neg x) (!simpcode->neg neg x-equiv))) :rule-classes :congruence)
Theorem:
(defthm !simpcode->neg-is-simpcode (equal (!simpcode->neg neg x) (change-simpcode x :neg neg)))
Theorem:
(defthm simpcode->neg-of-!simpcode->neg (b* ((?new-x (!simpcode->neg neg x))) (equal (simpcode->neg new-x) (bfix neg))))
Theorem:
(defthm !simpcode->neg-equiv-under-mask (b* ((?new-x (!simpcode->neg neg x))) (simpcode-equiv-under-mask new-x x -2)))