Application of a BED operator to two bits.
This is just a truth-table lookup into the operator.
Function:
(defun bed-op-eval$inline (op x y) (declare (type (unsigned-byte 4) op) (type bit x) (type bit y)) (declare (xargs :guard (and (bed-op-p op) (bitp x) (bitp y)))) (declare (xargs :split-types t)) (let ((__function__ 'bed-op-eval)) (declare (ignorable __function__)) (b* (((the (unsigned-byte 2) xshift) (ash (the bit (lbfix x)) 1)) ((the (unsigned-byte 2) index) (logior xshift (the bit (lbfix y)))) ((the (signed-byte 3) nindex) (- index)) ((the (unsigned-byte 4) op-shifted) (ash (the (unsigned-byte 4) (mbe :logic (bed-op-fix op) :exec op)) nindex))) (the bit (logand 1 op-shifted)))))
Theorem:
(defthm bitp-of-bed-op-eval (b* ((value (bed-op-eval$inline op x y))) (bitp value)) :rule-classes :rewrite)
Theorem:
(defthm bit-equiv-implies-equal-bed-op-eval-2 (implies (bit-equiv x x-equiv) (equal (bed-op-eval op x y) (bed-op-eval op x-equiv y))) :rule-classes (:congruence))
Theorem:
(defthm bit-equiv-implies-equal-bed-op-eval-3 (implies (bit-equiv y y-equiv) (equal (bed-op-eval op x y) (bed-op-eval op x y-equiv))) :rule-classes (:congruence))
Theorem:
(defthm bed-op-eval-of-bed-op-fix (equal (bed-op-eval (bed-op-fix op) x y) (bed-op-eval op x y)))
Theorem:
(defthm bed-op-equiv-implies-equal-bed-op-eval-1 (implies (bed-op-equiv op op-equiv) (equal (bed-op-eval op x y) (bed-op-eval op-equiv x y))) :rule-classes (:congruence))
Theorem:
(defthm bed-op-eval-when-fix-is-exact (implies (and (equal (bed-op-fix op) x) (syntaxp (or (quotep x) (and (consp x) (not (cdr x)))))) (equal (bed-op-eval op left right) (bed-op-eval x left right))))