Smartly negate a canonicalized expression.
We assume
Function:
(defun vl-condcheck-negate (x) (declare (xargs :guard (vl-expr-p x))) (let ((__function__ 'vl-condcheck-negate)) (declare (ignorable __function__)) (let ((dumb (make-vl-unary :op :vl-unary-bitnot :arg x))) (vl-expr-case x :vl-unary (if (vl-unaryop-equiv x.op :vl-unary-bitnot) x.arg dumb) :otherwise dumb))))
Theorem:
(defthm vl-expr-p-of-vl-condcheck-negate (b* ((new-x (vl-condcheck-negate x))) (vl-expr-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-condcheck-negate-of-vl-expr-fix-x (equal (vl-condcheck-negate (vl-expr-fix x)) (vl-condcheck-negate x)))
Theorem:
(defthm vl-condcheck-negate-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-condcheck-negate x) (vl-condcheck-negate x-equiv))) :rule-classes :congruence)