Macro that constructs a nested logical expression in an aignet
Usage:
(aignet-build (and (not (:= foo (xor bar baz))) (or foo bar) baz) gatesimp strash aignet) --> (mv result-literal strash aignet)
The above invocation translates to something like:
(b* (((mv foo strash aignet) (aignet-hash-xor bar baz gatesimp strash aignet)) ((mv tmp0 strash aignet) (aignet-hash-or foo bar gatesimp strash aignet)) ((mv tmp1 strash aignet) (aignet-hash-and tmp0 baz gatesimp strash aignet)) ((mv tmp2 strash aignet) (aignet-hash-and (lit-negate foo) tmp1 gatesimp strash aignet))) (mv tmp2 strash aignet))
There is a b* binder of the same name that creates the above bindings
within an existing
(b* (((aignet-build (:= ans (and (not (:= foo (xor bar baz))) (or foo bar) baz)) gatesimp strash aignet))) (result-form))
expands to something like:
(b* (((mv foo strash aignet) (aignet-hash-xor bar baz gatesimp strash aignet)) ((mv tmp0 strash aignet) (aignet-hash-or foo bar gatesimp strash aignet)) ((mv tmp1 strash aignet) (aignet-hash-and tmp0 baz gatesimp strash aignet)) ((mv ans strash aignet) (aignet-hash-and (lit-negate foo) tmp1 gatesimp strash aignet))) (result-form))