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