Given a set of clauses, I want to first check whether they are satisfiable. If they are, I want to simplify them and create a CNF, eg., (a OR b) ^ (NOT b) should simplify to: a ^ (NOT b). I'm only working with propositional formulas. I've tried to use Java SAT4j library for doing this. It can show me whether the set of clauses are satisfiable, but doesn't seem to have any method for returning me a simplified CNF. What can I do for simplifying CNF efficiently? Are there any Java or Python implementations for this?
Asked
Active
Viewed 2,720 times
1 Answers
3
You could use the Riss3g Coprocessor of Norbert Manthey to simplify your CNF
.
The SAT
solver minisat 2 allows to store the preprocessed CNF
in a file.
Lingeling, a SAT
solver from Austria has an option "-s"
to simplify CNF
clauses.
To convert a Boolean expression into a simplified CNF
, you could use bc2cnf.

Axel Kemper
- 10,544
- 2
- 31
- 54
-
Hi, thanks for your recommendations. The SAT solver minisat outputs no clauses after preprocessing even when the clauses are satisfiable. So, I think it's going further than I need it to. The same happens with Riss3g Coprocessor. bc2cnf doesn't work. Lingeling looks promising, but its documentation is seriously lacking, and it doesn't create the required .o file. Any other implementations I can check out? – user676122 May 06 '14 at 05:26
-
When the CNF clauses are known to be satisfiable, they reduce to a set of unary clauses with just one literal each. So, there is not much point in creating this reduced CNF. The solver will just output the solution (= the value assignment to variables which satisfies the CNF). bc2cnf definitely "works". Lingeling is a world-class tool with plenty of help and explanatory papers. You might want to post an extra question if you can't get a grip on it. – Axel Kemper May 06 '14 at 07:07
-
I tried bc2cnf on this circuit: BC1.0 K_4 := OR(K_1,~K_2); K_5 := ~K_1; ASSIGN K_4; ASSIGN K_5; I got the following output: c The instance was satisfiable c K_4 <-> T c K_5 <-> T c K_1 <-> F c K_2 <-> F p cnf 1 1 1 0 What I need is a simplified CNF like in this cases two clauses: ~K1 and ~K2 instead of just a possible assignment. – user676122 May 07 '14 at 00:45
-
Any solver I know of would directly conclude K_1=false and K_2=false via repeated unit propagation. Your "~K_1 and ~K_2" cannot be expressed as one clause. It has to be written as two clauses. No difference to directly translating the SAT solution into a set of unary clauses. – Axel Kemper May 07 '14 at 06:46
-
I have asked a related question which I suspect might be what the original submitter here was after: http://stackoverflow.com/questions/41926554/simplifying-cnf-formula-while-preserving-all-solutions-wrt-certain-variables/41928527 – Sami Liedes Jan 30 '17 at 09:47