satchmo: SAT encoding monad


Encoding for boolean and integral constraints into (QBF-)CNF-SAT. The encoder is provided as a State monad (hence the mo in satchmo).


Example

(this is also in package satchmo-examples, file Factor.hs)
import Prelude hiding ( not )

import Satchmo.Binary.Op.Fixed
import qualified Satchmo.Binary.Op.Flexible
import Satchmo.Solver.Minisat
import Satchmo.Boolean
import Satchmo.Code

import System.Environment

main :: IO ()
main = do
    [ n ] <- getArgs
    res <- solve $ do
        x <- Satchmo.Binary.Op.Flexible.constant $ read n
        a <- number $ width x
        notone a
        b <- number $ width x
        notone b
        ab <- times a b
        monadic assert [ equals ab x ]
        return $ decode [ a, b ]
    print res

notone f = do
    one <- Satchmo.Binary.Op.Flexible.constant 1
    e <- equals f one
    assert [ not e ]

More Documentation and Examples

here is QBF encoding example.

also, see lecture notes for chapter Software zur SAT-Kodierung (in German) from my introductory course on Constraint Programming


Project structure


Install

download packages from hackage, like this:

cabal install [--global --root-cmd=sudo] satchmo
cabal install [--global --root-cmd=sudo] satchmo-backends


Release Status

stable release: satchmo[-backends,-examples]-1.4.

see below for development sources

API documentation

(see package directories on hackage)

Bugs, Feature Requests

bugzilla interface

Development source tree

current development ist joint work with Jose Iborra
git clone git://dfa.imn.htwk-leipzig.de/srv/git/satchmo.git
git clone git://dfa.imn.htwk-leipzig.de/srv/git/satchmo-backends.git
git clone git://dfa.imn.htwk-leipzig.de/srv/git/satchmo-examples.git

browse source trees: (gitweb)

History

satchmo is a refactoring of the constraint solving mechanism built into the matchbox termination prover.
http://www.imn.htwk-leipzig.de/~waldmann/