310 likes | 437 Views
Efficient SAT Solving for Non-clausal Formulas using DPLL, Graphs, and Watched-cuts. Himanshu Jain Edmund M. Clarke. Agenda. Motivation Existing SAT solvers Our approach Negation Normal Form (NNF) Graphs to represent NNF Boolean Constraint Propagation (BCP) Experimental Results. output.
E N D
Efficient SAT Solving for Non-clausal Formulas using DPLL, Graphs, and Watched-cuts Himanshu Jain Edmund M. Clarke
Agenda • Motivation • Existing SAT solvers • Our approach • Negation Normal Form (NNF) • Graphs to represent NNF • Boolean Constraint Propagation (BCP) • Experimental Results
output a b b a b a Boolean Satisfiability • Applications in verification • Equivalence checking • Model checking • Theorem proving • Test generation • Static analysis • Circuits in practice • Thousands of inputs • Millions of gates • Structure sharing Boolean Circuit
Current SAT solvers • Davis-Putnam-Logemann-Loveland (DPLL) algorithm • Conversion of circuit to Conjunctive Normal Form (CNF) • Number of variables proportional to number of gates • Can be 103-104 times more than the number of inputs in a circuit • Slowdown due to large number of new variables (and clauses) • Modern CNF solvers use pre-processingtechniques • To reduce #variables and #clauses in CNF • But pre-processing has large memory requirements
DPLL algorithm Our SAT solving framework Boolean Circuit Fewer variables than CNF and more structure Negation Normal Form hpgraph vpgraph
Negation Normal Form (NNF) a b y y a b y y • An NNF formula contains arbitrary • nesting of AND () and OR () gates • Negations can appear at leaf level • No sharing of sub formulas a b b a
a b y y a b y y b a b a b a b a b a How to obtain NNF from Boolean Circuits out Circuit from converted to NNF by introducing one new variableyto remove sharing out’ out Boolean Circuit NNF
Why NNF: Number of variables CNF without pre-processing has 5-10X more variables
Why NNF: Number of variables 428 points 1705 points Note no pre-processing for NNF
DPLL algorithm Our SAT solving framework Boolean Circuit Negation Normal Form Peter Andrew’s Horizontal/Vertical Path Forms (1981) hpgraph vpgraph
hpgraph(2) hpgraph(1) hpgraph(2) hpgraph(1) L1 L1 L2 L2 R1 R1 R2 R2 = 12 Take graph union = 12 Add hyperedge from L1 to R2 Inductively creating hpgraph() from NNF formula m is a literal m Create new node
Example Formula F:(((p q) r q) (p (r s) q)) p q p p q r s p q q r p r r s r q q p q r s q q horizontal path p p q L R r s r R L q q R L hpgraph(F) CNF(F) R denotes a root node and L denotes a leaf node
Example Formula F:(((p q) r q) (p (r s) q)) vertical path R R R p q p p r q q r q p r q p s q r s r q q L L vpgraph(F) DNF(F) R denotes a root node and L denotes a leaf node
DPLL algorithm Our SAT solving framework Boolean Circuit Negation Normal Form Directed Acyclic Graphs (DAGs) Linear in size of original circuit hpgraph CNF-like vpgraph DNF-like
DPLL on hpgraph Decisions Top-level DPLL Algorithm hpgraph Boolean Constraint Propagation (BCP) engine Conflicts, Implied Literals
Assignment 2 :={q=1,s=1} p p q r s L r q q R A horizontal path Unit clause: q r s Implied literal: r Meaning of BCP on hpgraph Assignment 1 :={r=1,p=1} p p q L r s r R q q horizontal path = clause Conflict clause:r p
Can we generalize the CNF watched literal scheme? Hpgraph p p q L R Horizontal path = clause r s r R L q q R L - Watch two literals (nodes) on each clause (path) - But exponential number of clauses (paths)!
Two Watched Cut Scheme Hpgraph p p q L R r s r R L watch a node cut p q r s q q R L cut 2 cut 1 • A node cut disconnects all horizontal paths • Watch two node cuts (allows observing two literals on each clause) • Minimal cuts (covered later)
Actual picture…. An hpgraph • Two cuts for each hpgraph component • Can be updated locally during BCP • Non-chronological backtracking is cheap hpgraph components
Our algorithm generalizes CNF watched literal scheme An hpgraph Special hpgraph (CNF)
Acceptable cut Acut is acceptable if no literal appearing in it is false p p q L R • Cut 2 is: • not acceptable for • := {p=1} • Cut 1 is: • acceptable for • := {p=1} r s r R L q q R L cut 2 cut 1 Now let us see the use of cuts during BCP
BCP Case 1: Both cuts are acceptable and disjoint Hpgraph component p p q L R r s r R L := {s=1} q q R L cut 2 cut 1 No need to examine the hpgraph component Intuitively, there will be no conflicts or implied literals
BCP Case 2 (conflict): No acceptable cut Hpgraph component Conflict clause: q p p p q L R r s r R L := {p=1,q=1} q q R L cut 2 cut 1 An hpgraph has no acceptable cut if and only if current assignment falsifies the formula
BCP Case 3 (Implications): Acceptable cuts but not disjoint Hpgraph component For := {p=1} we can find two acceptable cuts. We cannot find two completely node-disjoint cuts p p q r s r cut 1 q q cut 2 Intuitively nodes common to both cuts contain implied literals In our example rand q are implied literals.
vpgraph component 1 2 3 p q p R R R r s r 5 4 6 q q L L 7 8 Finding and Maintaining Minimal Cuts hpgraph component 1 2 3 p p q L R 4 5 6 r s r R L q q R L 7 8 minimal cut in hpgraph component = a path in vpgraph component
Experimental Results • These techniques implemented in: • NFLSAT (Non-clausal FormuLas SATisfiability checker) • ~2500 Boolean circuits (industrial category) • Bounded model checking, k-induction, SW/HW verification • CNF obtained by adding new variables (one per AND gate in AIG) • Timeout of 600sec per problem • Comparing with state-of-the-art solvers • SAT 2009 competition winners: Precosat, Glucose • SAT-Race 2008 AIG track winners: MiniSAT++,Picoaigersat • Top three winners of SAT 2007 comp: RSAT, MiniSAT, PicoSAT
NFLSAT vs. Precosat y>x on 306 points NFLSAT solves 29 more problems x>y on 2018 points Total time: NFLSAT( 136000 sec), Precosat (193400 sec)
NFLSAT vs. Glucose y>x on 895 points NFLSAT solves 58 more problems x>y on 1382 points Total time: NFLSAT( 136000 sec), Glucose (185000 sec)
NFLSAT vs. MiniSAT++ (AIG) Minisat++ solves 14 more problems Total time: NFLSAT( 105785 sec), MiniSAT++ (103257 sec)
Summary Boolean Circuit • Other features of modern SAT solvers • 2. No pre-processing so far (circuit rewriting applicable) Negation Normal Form Linear time conversion Decisions Top-level DPLL Algorithm vpgraph hpgraph BCP engine Clause Database Conflicts, Implied Literals