Ported to Haskell from the Python qm Package and the improved qm (including Petrick's method) by George Prekas.
git clone https://github.com/martinfinke/qm
cabal install qm
cabal install --only-dependencies --enable-tests
cabal test
Note: When show
ing terms, leading zeros are dropped. So 0-10
is shown as -10
.
Finding the set of all primes:
import Qm
let terms = Set.fromList $ map getTerm $ map fromString [
"0010", "0101", "0110", "1011", "1100", "1110", "1111"
]
compute_primes terms -- fromList [-10, 101, -110, 1-11, 11-0, 111-]
Find the minimum cover for a list of minterms:
import Qm
let terms = map getTerm $ map fromString [
"0010", "0101", "0110", "1011", "1100", "1110", "1111"
]
qm terms [] [] -- [-10,101,1-11,11-0]
See LICENSE file.