1

I tried using the bc2cnf tool to generate the DIMACS CNF file of a boolean equation.

The input file contains the equation of an AND gate as shown below :

BC1.1
f := A & B;
ASSIGN f;

Command used: ./bc2cnf -v inp.txt opt.txt

Content in the output file:

c The instance was satisfiable
c A <-> T
c B <-> T
c f <-> T
p cnf 1 1
1 0

Here, it can be observed that the correct DIMACS CNF format of the AND gate is not generated.

Please let me know how this problem can be rectified.

GManNickG
  • 494,350
  • 52
  • 494
  • 543
Partha
  • 23
  • 4
  • This is mostly off topic for the site, since it's about how to use some software. But: bc2cnf performs some basic constraint propagation. If you know an AND gate has to be true, then that's the same as knowing its inputs have to be true. Rather than encode the gate, it just determines the inputs must be true and propagates from there. In doing this, the gate is eliminated and in your example the problem is fully solved. (Likewise, if an OR gate has to be false, then you know its inputs must be false.) As far as I know, you cannot disable this. A more complicated example would produce the gate. – GManNickG Mar 29 '22 at 17:14

1 Answers1

2

Use commandline parameter -nosimplify to suppress bc2cnf optimization.

Result is

c f <-> 1
c B <-> 2
c A <-> 3
p cnf 3 4
-1 2 0
-1 3 0
1 -3 -2 0
1 0

bc2cnf has a number of useful parameters. Try bc2cnf -? to get help.

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