【发布时间】:2020-12-12 16:18:33
【问题描述】:
假设,我有一个 Cryptominisat 或 z3 问题的 SAT 结果。如何将其转换回问题域?
【问题讨论】:
假设,我有一个 Cryptominisat 或 z3 问题的 SAT 结果。如何将其转换回问题域?
【问题讨论】:
这可以通过一个小例子来解释。
像CryptoMiniSat 这样的SAT solver 需要CNF clauses 作为输入。 要创建这样的子句,可以使用bc2cnf 之类的工具。
输入bc2cnf:
BC1.0
f := A & ~B | ~A & B;
ASSIGN f;
bc2cnf 生成的输出:
c This is a CNF SAT formula in the DIMACS CNF format,
c produced with the bc2cnf translator by Tommi Junttila;
c see http://users.ics.aalto.fi/tjunttil/circuits/index.html
c Modified and compiled by Axel Kemper: Jun 18 2017
c
c Commandline:
c .\bc2cnf -v test6.bc.txt test6.dimacs.txt
c CNF file created: Sat Dec 12 18:56:36 2020
c
c f <-> 1
c B <-> 4
c A <-> 5
p cnf 5 10
1 -2 0
1 -3 0
-1 3 2 0
1 0
-2 -5 0
-2 4 0
2 -4 5 0
-3 -4 0
-3 5 0
3 -5 4 0
CryptoMiniSat 解决方法:
(命令:cryptominisat --verb 2 --dumpresult=test6.cms.txt test6.dimacs.txt)
SAT
1 2 -3 4 -5 0
解决方案“SAT”的第一行表示找到了解决方案。
第二行列出了产生真值输出的输入值。
在这种情况下:Variable 4 [A]=true, Variable 5 [B]=false
变量1 代表输出变量f。变量2 和3 是辅助变量。
Z3 可以用作SAT solver。但它也包含其他求解器,并被 Microsoft 命名为 theorem prover。
【讨论】: