Optimize expressions throughout a vl-assign-p.
(vl-assign-optimize x ss) → (mv changedp new-x)
Function:
(defun vl-assign-optimize (x ss) (declare (xargs :guard (and (vl-assign-p x) (vl-scopestack-p ss)))) (let ((__function__ 'vl-assign-optimize)) (declare (ignorable __function__)) (b* ((x (vl-assign-fix x))) (b* (((mv lvalue-changedp lvalue-prime) (vl-expr-optimize (vl-assign->lvalue x) ss)) ((mv expr-changedp expr-prime) (vl-expr-optimize (vl-assign->expr x) ss)) ((when (or lvalue-changedp expr-changedp)) (mv t (change-vl-assign x :lvalue lvalue-prime :expr expr-prime)))) (mv nil x)))))
Theorem:
(defthm booleanp-of-vl-assign-optimize.changedp (b* (((mv ?changedp ?new-x) (vl-assign-optimize x ss))) (booleanp changedp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-assign-p-of-vl-assign-optimize.new-x (b* (((mv ?changedp ?new-x) (vl-assign-optimize x ss))) (vl-assign-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-assign-optimize-of-vl-assign-fix-x (equal (vl-assign-optimize (vl-assign-fix x) ss) (vl-assign-optimize x ss)))
Theorem:
(defthm vl-assign-optimize-vl-assign-equiv-congruence-on-x (implies (vl-assign-equiv x x-equiv) (equal (vl-assign-optimize x ss) (vl-assign-optimize x-equiv ss))) :rule-classes :congruence)
Theorem:
(defthm vl-assign-optimize-of-vl-scopestack-fix-ss (equal (vl-assign-optimize x (vl-scopestack-fix ss)) (vl-assign-optimize x ss)))
Theorem:
(defthm vl-assign-optimize-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-assign-optimize x ss) (vl-assign-optimize x ss-equiv))) :rule-classes :congruence)