Like observability-fix, but overwrites the original network instead of returning a new one.
(balance! aignet config) → new-aignet
Function:
(defun balance! (aignet config) (declare (xargs :stobjs (aignet))) (declare (xargs :guard (balance-config-p config))) (let ((__function__ 'balance!)) (declare (ignorable __function__)) (b* (((local-stobjs aignet-tmp) (mv aignet aignet-tmp)) (- (cw "Balance input: ") (print-aignet-levels aignet)) (aignet-tmp (balance-core aignet aignet-tmp config)) (aignet (aignet-prune-comb aignet-tmp aignet (balance-config->gatesimp config))) (- (cw "Balance output: ") (print-aignet-levels aignet))) (mv aignet aignet-tmp))))
Theorem:
(defthm num-ins-of-balance! (b* ((?new-aignet (balance! aignet config))) (equal (stype-count :pi new-aignet) (stype-count :pi aignet))))
Theorem:
(defthm num-regs-of-balance! (b* ((?new-aignet (balance! aignet config))) (equal (stype-count :reg new-aignet) (stype-count :reg aignet))))
Theorem:
(defthm num-outs-of-balance! (b* ((?new-aignet (balance! aignet config))) (equal (stype-count :po new-aignet) (stype-count :po aignet))))
Theorem:
(defthm balance!-comb-equivalent (b* ((?new-aignet (balance! aignet config))) (comb-equiv new-aignet aignet)))
Theorem:
(defthm balance!-of-balance-config-fix-config (equal (balance! aignet (balance-config-fix config)) (balance! aignet config)))
Theorem:
(defthm balance!-balance-config-equiv-congruence-on-config (implies (balance-config-equiv config config-equiv) (equal (balance! aignet config) (balance! aignet config-equiv))) :rule-classes :congruence)