Function:
(defun vl-consteval-binlogic (op aval bval) (declare (xargs :guard (and (member op '(:vl-binary-logand :vl-binary-logor :vl-implies :vl-equiv)) (natp aval) (natp bval)))) (let ((__function__ 'vl-consteval-binlogic)) (declare (ignorable __function__)) (b* ((aval (lnfix aval)) (bval (lnfix bval))) (case op (:vl-binary-logand (if (and (posp aval) (posp bval)) 1 0)) (:vl-binary-logor (if (or (posp aval) (posp bval)) 1 0)) (:vl-implies (if (implies (posp aval) (posp bval)) 1 0)) (:vl-equiv (if (equal (posp aval) (posp bval)) 1 0)) (otherwise (progn$ (impossible) 0))))))
Theorem:
(defthm bitp-of-vl-consteval-binlogic (b* ((ans (vl-consteval-binlogic op aval bval))) (bitp ans)) :rule-classes :rewrite)
Theorem:
(defthm vl-consteval-binlogic-of-nfix-aval (equal (vl-consteval-binlogic op (nfix aval) bval) (vl-consteval-binlogic op aval bval)))
Theorem:
(defthm vl-consteval-binlogic-nat-equiv-congruence-on-aval (implies (acl2::nat-equiv aval aval-equiv) (equal (vl-consteval-binlogic op aval bval) (vl-consteval-binlogic op aval-equiv bval))) :rule-classes :congruence)
Theorem:
(defthm vl-consteval-binlogic-of-nfix-bval (equal (vl-consteval-binlogic op aval (nfix bval)) (vl-consteval-binlogic op aval bval)))
Theorem:
(defthm vl-consteval-binlogic-nat-equiv-congruence-on-bval (implies (acl2::nat-equiv bval bval-equiv) (equal (vl-consteval-binlogic op aval bval) (vl-consteval-binlogic op aval bval-equiv))) :rule-classes :congruence)