The sumBits function computes the sum of a list of binary numbers.
If all numbers have just one bit, then this computes the number of bits that are set to true.
Then, there is sumBit which claims to be an improved implementation for this special case.
The
sumBits
function computes the sum of a list of binary numbers. If all numbers have just one bit, then this computes the number of bits that are set to true. Then, there issumBit
which claims to be an improved implementation for this special case.(relevant source code: https://hackage.haskell.org/package/ersatz-0.3.1/docs/src/Ersatz.Bits.html#sumBits )
I observed that
sumBit
does produce somewhat smaller formulas thansumBits
and I conclude that
sumBit
should not be used.Here is a test case: https://github.com/jwaldmann/ersatz/blob/sumbits-example/examples/DominatingSet.hs where we are looking for a small dominating set on the knight's graph on a chess board.
unrelated to this test case, here are the DAGs for the formulas built (with
w=4
) forwith
sumBits
:with
sumBit
: