4

Related: CNF simplification (in fact, I think the submitter of that question might have been after what I want here)

A number of tools exist for simplifying (or "preprocessing" before solving) DIMACS format CNF formulas, and most SAT solvers incorporate some. However, all that I am aware of simplify a trivially satisfiable formula into a trivially satisfiable CNF with zero or one variables, i.e. they only attempt to preserve the satisfiability of the formula. I have tried at least SatELite and cryptominisat's preprocess mode.

However, for constructing CNF of a large problem, it seems to me that it would be quite useful to simplify a well-defined subset of the problem at a time, which may then be repeated a large number of times in the final CNF with additional constraints between some variables in these subformulas.

So, do any tools exist, or can ordinary SAT solvers (or other solvers like Z3, which I'm using to produce the CNF I would like to minimize) be somehow used with some cleverness, to simplify a CNF formula while preserving all solutions wrt a given set of variables?

Community
  • 1
  • 1
Sami Liedes
  • 1,084
  • 8
  • 19

3 Answers3

3

The Coprocessor SAT preprocessor can do what you want. It can be given an optional variable scope and will only apply equivalence-preserving simplifications within that scope. Outside that scope, it will apply stronger, satisfiability-preserving simplifications. At least that was the case in version 2.

  • 2
    Thanks for the pointer. It was very hard to get it to work. There's a -whitelist parameter to specify do-not-touch variables, and the format for that is not documented (it takes a file, one variable per line, or one range per line as in 1..10). Even then, it's terribly sensitive to the ordering of command line parameters, silently fails in interesting ways if the order is wrong and truncates the provided input .cnf file in the process. What a piece of software :D – Sami Liedes Jan 30 '17 at 22:05
1

Perhaps not quite what you are looking for, but the espresso system (http://embedded.eecs.berkeley.edu/pubs/downloads/espresso/) can do boolean simplification. It's over 20 years old by now, but is still used in the industry for what it does.

alias
  • 28,120
  • 2
  • 23
  • 40
1

Another approach is to convert the CNF into an And-Inverter-Graph (AIG) and apply methods from logic synthesis to restructure and simplify the AIG.

This is done in the ABC suite of programs, developed at the University of Berkeley. One method is structural hashing: find common (equivalent) subexpressions within the AIG and tie them together to prune the graph.

The University of Linz in Austria provides an AIGER tool-set especially devoted to And-Inverter Graphs.

Axel Kemper
  • 10,544
  • 2
  • 31
  • 54