230 likes | 591 Views
Proofs from SAT Solvers. Yeting Ge ACSys NYU Nov 20 2007. 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
E N D
Proofs from SAT Solvers YetingGe ACSys NYU Nov 20 2007
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 • ……
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
Naïve SAT algorithm • To solve: UNSAT UNSAT UNSAT UNSAT UNSAT UNSAT UNSAT
DPLL algorithm dpll(ClausesC){ C = simplify(C); if ( C contains contradictions ) returnUNSAT ; if (no more free variables in C) returnSAT ; choose a free variable v in C ; C1 = substitute(C, v,T ) ; if (SAT==dpll(ClausesC1)) returnSAT ; else { C2 = substitute(C, v,F ) ; return dpll(ClausesC2) ; } }
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
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,…
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.
From DPLL search tree to resolution proof • Observation: • A contraction a resolution UNSAT UNSAT UNSAT
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
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
Learning and resolution:Implication graph 5) 1) 3) 5) 2) 4) 3)
Implication graph 5) 1) 3) 5) 2) 4) 3) The contraction is due to: or We can learn a clause , which is the result of resolution of clause 4) and 5) contraction resolution
Implication graph:more learned clause 5) 1) 3) 5) 2) 4) 3) Another clause
Implication graph:more learned clause 5) 1) 3) 5) 2) 4) 3) Yet another clause
Implication graph:more learned clause 5) 1) 3) 5) 2) 4) 3)
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
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 necessary
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 thesmallestamong all minimal unsat core, then s is the minimum unsat core • It is difficult to obtain a minimum unsat core
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 minimal
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-product
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
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