Download - Proofs from SAT Solvers
Proofs from SAT Solvers
Yeting Ge
ACSys NYU
Nov 20 2007
2
SAT solvers and proofs SAT problem and solvers
Given a propositional logic formula, a SAT solver outputs sat or unsat
Proofs from SAT solvers are needed A certificate to show the solver is correct Required by applications
Planning Calculation of interpolants ……
11/20/2007
A bunch of SAT solvers Complete / incomplete Internal representation
BDD, circuit, CNF,…… Search method
Depth first, breadth first Most modern SAT solvers
Complete, CNF, breadth first DPLL based
11/20/2007 3
4
Naïve SAT algorithm To solve:
11/20/2007
)()()()( 21212121 xxxxxxxx
Τx 1 Fx 1
Τx 2 Fx 2 Τx 2 Fx 2
UNSAT UNSAT
UNSAT
UNSATUNSAT
UNSAT
UNSAT
22 xx 22 xx
5
DPLL algorithmdpll(Clauses C){ C = simplify(C); if ( C contains contradictions ) return UNSAT ; if ( no more free variables in C) return SAT ; choose a free variable v in C ; C1 = substitute(C, v, T ) ; if (SAT == dpll(Clauses C1)) return SAT ; else { C2 = substitute(C, v, F ) ;
return dpll(Clauses C2) ; } }
11/20/2007
6
DPLL algorithm Two rules to simplify the CNF
clauses Unit propagation rule
If there is a clause contains only one literal, the literal is forced to be true. Propagate this new assignment immediately.
Given { , }, deduce and { }, then One literal rule
Not used in most modern SAT solvers 11/20/2007
31 xx 1x Fx 1
Fx 33x
7
Modern SAT solvers Efficient unit propagation
BCP(Boolean Constraints Propagation) Efficient back-tracking
Iterative algorithm Almost constant cost back-tracking
Better heuristics on what to do next Conflict analysis Look ahead heuristics
Fine tuning Restart, preprocessing,…
11/20/2007
8
Resolution and SAT problem Resolution
Given two clauses and , derive From and , derive empty clause
Theorem A set of CNF clauses is unsatisfiable if and
only if there is a resolution derivation of empty clause
Proof: Based on induction.
11/20/2007
klll ...21
kljj ...21 ...... 2121 jjllx x
9
From DPLL search tree to resolution proof
Observation: A contraction a resolution
11/20/2007
)()()()( 21212121 xxxxxxxx
Τx 1 Fx 1
UNSATUNSAT22 xx 21
21
xxxx
11 xx 11 xx
1 1 , xx UNSAT
10
Naïve proof generation Record the entire proof tree and
reconstruct the resolution proof Dump search trace
Modern SAT solvers employ unit propagation
Modern SAT solvers employ some learning techniques New clauses are learned and added into the
CNF clause set. New clause could be used later
11/20/2007
11
Unit propagation (BCP) and resolution Given a unit clause , only if there
is a clause , we can generate a new clause A special case of resolution New unit clauses will be linked to
their source clauses (implication graph)
Modern SAT solvers spent most of the time on BCP
11/20/2007
x...21 yyx
...21 yy
12
Learning and resolution:Implication graph
11/20/2007
...... 5)
)4 )3
)2 )1
......
654
54
432
31
21
xxxxx
xxxxxxx
Fx 1
Tx 2
Tx 3
1)
2)Tx 4
3)
3)
Fx 5
4)
Tx 5
Fx 55)
5)
1311/20/2007
...... 5)
)4 )3
)2 )1
......
654
54
432
31
21
xxxxx
xxxxxxx
Fx 1
Tx 2
Tx 3
1)
2)Tx 4
3)
3)
Fx 5
4)
Fx 6
Fx 55)
5)
Implication graph
)( 64 xx The contraction is due to: or 64 xx
We can learn a clause , which is the result of resolution of clause 4) and 5) contraction resolution
64 xx
1411/20/2007
...... 5)
)4 )3
)2 )1
......
654
54
432
31
21
xxxxx
xxxxxxx
Fx 1
Tx 2
Tx 3
1)
2)Tx 4
3)
3)
Fx 5
4)
Fx 6
Fx 55)
5)
Implication graph:more learned clause
Another clause )( 632 xxx
1511/20/2007
...... 5)
)4 )3
)2 )1
......
654
54
432
31
21
xxxxx
xxxxxxx
Fx 1
Tx 2
Tx 3
1)
2)Tx 4
3)
3)
Fx 5
4)
Fx 6
Fx 55)
5)
Implication graph:more learned clause
Yet another clause 61 xx
1611/20/2007
...... 5)
)4 )3
)2 )1
......
654
54
432
31
21
xxxxx
xxxxxxx
Fx 1
Tx 2
Tx 3
1)
2)Tx 4
3)
3)
Fx 5
4)
Fx 6
Fx 55)
5)
Implication graph:more learned clause
1) 8) 9)2) 7) 8)3) 6) 7)5) 4) 6)
61
621
632
64
xxxxxxxx
xx
17
Resolution and learned clauses Conflict clause
The learned clause that are fed back into SAT solver
Conflict clauses can be seen as the result of some resolution
Conflict clauses are redundant Could be deleted later
11/20/2007
18
Proof generation Whenever a learned clause is
generated, record the clause and dump the reason for that clause
Recode all variables assigned at root level and the reasons
Re-construct the resolution proof from the last contradiction by searching the dumped trace and recorded information Learned clauses are constructed if
necessary11/20/2007
19
Application of proofs:Small unsat core Some applications require small unsat
core Given a set of unsatisfiable CNF clauses
C, if and , then S is
a minimal unsat core of C If s is the smallest among all minimal
unsat core, then s is the minimum unsat core
It is difficult to obtain a minimum unsat core11/20/2007
CS esatisfiabl is . tStt
20
Small unsat core from proofs By Zhang et al. Given a unsatisfiable set of clauses C Collect all clauses appears in the unsat
proof, say C1, which must be unsatifiable
Run SAT solver on C1 and collect all clauses appears in the unsat proof of C1, say C2
Repeat until reach a fixpoint There is no guarantee that the fixpoint
is minimal11/20/2007
21
Another kind of proof Given a set of unsatisfiable CNF clauses F and
all conflict clauses C found by the SAT solver, a conflict pair can be derived by performing BCP on
F C only If a set of CNF clauses is unsatisfiable, a conflict pair
can be derive by resolution All the result of non-BCP resolution are in C
The proof checking is time consuming The checking procedure could give a small
unsat core as a by-product11/20/2007
},{ xx
22
Some future problems A standard proof format
Dump of the resolution proof Dump of conflict clauses
Better proof generation and checking Big proofs Proofs from SMT solvers
More difficult There is no general standard format
11/20/2007
23
Summary Proofs from SAT solvers are useful Modern CNF based SAT solvers can
generate proofs with little overhead
Construct the resolution proof might be a problem for large cases
Small unsat core could be obtained from proofs
11/20/2007