Function:
(defun vl-consteval-cmpop (op aval bval) (declare (xargs :guard (and (member op '(:vl-binary-ceq :vl-binary-cne :vl-binary-eq :vl-binary-neq :vl-binary-gt :vl-binary-gte :vl-binary-lt :vl-binary-lte)) (natp aval) (natp bval)))) (let ((__function__ 'vl-consteval-cmpop)) (declare (ignorable __function__)) (b* ((aval (lnfix aval)) (bval (lnfix bval))) (case op ((:vl-binary-ceq :vl-binary-eq) (if (equal aval bval) 1 0)) ((:vl-binary-cne :vl-binary-neq) (if (equal aval bval) 0 1)) (:vl-binary-gt (if (> aval bval) 1 0)) (:vl-binary-gte (if (>= aval bval) 1 0)) (:vl-binary-lt (if (< aval bval) 1 0)) (:vl-binary-lte (if (<= aval bval) 1 0)) (otherwise (progn$ (impossible) 0))))))
Theorem:
(defthm bitp-of-vl-consteval-cmpop (b* ((ans (vl-consteval-cmpop op aval bval))) (bitp ans)) :rule-classes :rewrite)
Theorem:
(defthm vl-consteval-cmpop-of-nfix-aval (equal (vl-consteval-cmpop op (nfix aval) bval) (vl-consteval-cmpop op aval bval)))
Theorem:
(defthm vl-consteval-cmpop-nat-equiv-congruence-on-aval (implies (acl2::nat-equiv aval aval-equiv) (equal (vl-consteval-cmpop op aval bval) (vl-consteval-cmpop op aval-equiv bval))) :rule-classes :congruence)
Theorem:
(defthm vl-consteval-cmpop-of-nfix-bval (equal (vl-consteval-cmpop op aval (nfix bval)) (vl-consteval-cmpop op aval bval)))
Theorem:
(defthm vl-consteval-cmpop-nat-equiv-congruence-on-bval (implies (acl2::nat-equiv bval bval-equiv) (equal (vl-consteval-cmpop op aval bval) (vl-consteval-cmpop op aval bval-equiv))) :rule-classes :congruence)