(aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash) → (mv new-mark new-copy new-levels new-aignet2 new-strash)
Function:
(defun aignet-balance-nxsts (n config aignet mark copy refcounts levels aignet2 strash) (declare (xargs :stobjs (aignet mark copy refcounts levels aignet2 strash))) (declare (xargs :guard (and (natp n) (balance-config-p config)))) (declare (xargs :guard (and (<= n (num-regs aignet)) (<= (num-fanins aignet) (lits-length copy)) (non-exec (ec-call (aignet-copies-in-bounds copy aignet2))) (<= (num-fanins aignet) (bits-length mark)) (<= (num-fanins aignet) (u32-length refcounts)) (<= (num-fanins aignet2) (u32-length levels))))) (let ((__function__ 'aignet-balance-nxsts)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (num-regs aignet) (nfix n))) :exec (eql n (num-regs aignet)))) (mv mark copy levels aignet2 strash)) ((mv ?lit mark copy levels aignet2 strash) (aignet-balance-rec (lit-id (regnum->nxst n aignet)) config aignet mark copy refcounts levels aignet2 strash))) (aignet-balance-nxsts (1+ (lnfix n)) config aignet mark copy refcounts levels aignet2 strash))))
Theorem:
(defthm aignet-extension-p-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (aignet-extension-p new-aignet2 aignet2)))
Theorem:
(defthm aignet-copies-in-bounds-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (aignet-copies-in-bounds copy aignet2) (aignet-copies-in-bounds new-copy new-aignet2))))
Theorem:
(defthm levels-length-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (and (<= (num-fanins aignet2) (len levels)) (aignet-copies-in-bounds copy aignet2)) (< (fanin-count new-aignet2) (len new-levels)))) :rule-classes :linear)
Theorem:
(defthm mark-length-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (<= (num-fanins aignet) (len mark)) (equal (len new-mark) (len mark)))))
Theorem:
(defthm copy-length-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (<= (num-fanins aignet) (len copy)) (equal (len new-copy) (len copy)))))
Theorem:
(defthm marks-remain-set-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (equal (nth m mark) 1) (equal (nth m new-mark) 1))))
Theorem:
(defthm aignet-output-fanins-marked-preserved-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (aignet-output-fanins-marked mark aignet) (aignet-output-fanins-marked new-mark aignet))))
Theorem:
(defthm nxst-fanin-marked-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (and (<= (nfix n) (nfix m)) (< (nfix m) (num-regs aignet))) (equal (nth (lit-id (lookup-reg->nxst m aignet)) new-mark) 1))))
Theorem:
(defthm aignet-nxst-fanins-marked-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (zp n) (aignet-nxst-fanins-marked new-mark aignet))))
Theorem:
(defthm aignet-balance-nxsts-correct (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (and (marked-lit-copies-equiv mark copy aignet aignet2 invals regvals) (aignet-copies-in-bounds copy aignet2)) (marked-lit-copies-equiv new-mark new-copy aignet new-aignet2 invals regvals))))
Theorem:
(defthm aignet-balance-nxsts-correct-all-evals (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (and (marked-lit-copies-equiv-all-evals mark copy aignet aignet2) (aignet-copies-in-bounds copy aignet2)) (marked-lit-copies-equiv-all-evals new-mark new-copy aignet new-aignet2))))
Theorem:
(defthm stype-counts-of-aignet-balance-nxsts (b* (((mv ?new-mark ?new-copy ?new-levels ?new-aignet2 ?new-strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash))) (implies (and (not (equal (stype-fix stype) (and-stype))) (not (equal (stype-fix stype) (xor-stype)))) (equal (stype-count stype new-aignet2) (stype-count stype aignet2)))))
Theorem:
(defthm aignet-balance-nxsts-of-nfix-n (equal (aignet-balance-nxsts (nfix n) config aignet mark copy refcounts levels aignet2 strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash)))
Theorem:
(defthm aignet-balance-nxsts-nat-equiv-congruence-on-n (implies (nat-equiv n n-equiv) (equal (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash) (aignet-balance-nxsts n-equiv config aignet mark copy refcounts levels aignet2 strash))) :rule-classes :congruence)
Theorem:
(defthm aignet-balance-nxsts-of-balance-config-fix-config (equal (aignet-balance-nxsts n (balance-config-fix config) aignet mark copy refcounts levels aignet2 strash) (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash)))
Theorem:
(defthm aignet-balance-nxsts-balance-config-equiv-congruence-on-config (implies (balance-config-equiv config config-equiv) (equal (aignet-balance-nxsts n config aignet mark copy refcounts levels aignet2 strash) (aignet-balance-nxsts n config-equiv aignet mark copy refcounts levels aignet2 strash))) :rule-classes :congruence)