SAT/SMT Solvers and Applications

Similar documents
EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

Normal Forms for Boolean Expressions

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

Heuristic Backtracking Algorithms for SAT

Constraint Satisfaction Problems

An Introduction to SAT Solvers

Boolean Satisfiability Solving Part II: DLL-based Solvers. Announcements

Boolean Satisfiability: From Theoretical Hardness to Practical Success. Sharad Malik Princeton University

CS-E3220 Declarative Programming

Boolean Functions (Formulas) and Propositional Logic

Learning Techniques for Pseudo-Boolean Solving and Optimization

ESE535: Electronic Design Automation CNF. Today CNF. 3-SAT Universal. Problem (A+B+/C)*(/B+D)*(C+/A+/E)

Satisfiability (SAT) Applications. Extensions/Related Problems. An Aside: Example Proof by Machine. Annual Competitions 12/3/2008

Chapter 2 PRELIMINARIES

Better test results for the graph coloring and the Pigeonhole Problems using DPLL with k-literal representation

QuteSat. A Robust Circuit-Based SAT Solver for Complex Circuit Structure. Chung-Yang (Ric) Huang National Taiwan University

SAT Solver Heuristics

CafeSat: A Modern SAT Solver for Scala

SAT Solvers: A Condensed History. Sharad Malik Princeton University COS 598d 3/1/2010

Satisfiability Solvers

Solving Constraint Satisfaction Problems by a SAT Solver

Master s Project Proposal: Enhancements of SAT-Solvers for Some Combinatorial NAE-SAT Problems

Unrestricted Backtracking Algorithms for Satisfiability

SAT Solver and its Application to Combinatorial Problems

CS-E3200 Discrete Models and Search

2 Decision Procedures for Propositional Logic

Efficient satisfiability solver

Deductive Methods, Bounded Model Checking

Adding New Bi-Asserting Clauses for Faster Search in Modern SAT Solvers

4.1 Review - the DPLL procedure

Combinational Equivalence Checking

Study of efficient techniques for implementing a Pseudo-Boolean solver based on cutting planes

Random backtracking in backtrack search algorithms for satisfiability

of m clauses, each containing the disjunction of boolean variables from a nite set V = fv 1 ; : : : ; vng of size n [8]. Each variable occurrence with

Adding a New Conflict Based Branching Heuristic in two Evolved DPLL SAT Solvers

A Pearl on SAT Solving in Prolog (extended abstract)

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s

On Resolution Proofs for Combinational Equivalence Checking

Validating SAT Solvers Using an Independent Resolution-Based Checker: Practical Implementations and Other Applications

A Pearl on SAT Solving in Prolog

Symbolic Methods. The finite-state case. Martin Fränzle. Carl von Ossietzky Universität FK II, Dpt. Informatik Abt.

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Computer-Aided Program Design

Heuristic-Based Backtracking for Propositional Satisfiability

Chaff: Engineering an Efficient SAT Solver

Formally Certified Satisfiability Solving

Planning as Search. Progression. Partial-Order causal link: UCPOP. Node. World State. Partial Plans World States. Regress Action.

Practical SAT Solving

TRABAJOS DE INFORMÁTICA

On CafeSat: A Modern SAT Solver for Scala

Boolean Representations and Combinatorial Equivalence

Solving Satisfiability with a Novel CPU/GPU Hybrid Solution

Automated Theorem Proving: DPLL and Simplex

Learning Techniques for Pseudo-Boolean Solving

Zchaff: A fast SAT solver. Zchaff: A fast SAT solver

Generalizations of Watched Literals for Backtracking Search

Advances and Insights into Parallel SAT Solving

Solving Constraint Satisfaction Problems by a SAT Solver

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Solving Constraint Satisfaction Problems with SAT Technology

CDCL SAT Solvers. Joao Marques-Silva. Theory and Practice of SAT Solving Dagstuhl Workshop. April INESC-ID, IST, ULisbon, Portugal

ON SOLVING OPTIMIZATION PROBLEMS USING BOOLEAN SATISFIABILITY

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

Full CNF Encoding: The Counting Constraints Case

On Resolution Proofs for Combinational Equivalence

Problem-Sensitive Restart Heuristics for the DPLL Procedure

The Barcelogic SMT Solver

On Computing Minimum Size Prime Implicants

Satisfiability. Michail G. Lagoudakis. Department of Computer Science Duke University Durham, NC SATISFIABILITY

Massively Parallel Seesaw Search for MAX-SAT

Satisfiability-Based Algorithms for 0-1 Integer Programming

ABT with Clause Learning for Distributed SAT

Integrating a SAT Solver with Isabelle/HOL

MiFuMax a Literate MaxSAT Solver system description

Solving Non-clausal Formulas with DPLL search

EXTENDING SAT SOLVER WITH PARITY CONSTRAINTS

Memory Hierarchy Utilization of a SAT Solver

Unrestricted Nogood Recording in CSP search

Search techniques for SAT-based Boolean optimization

The log-support encoding of CSP into SAT

Searching for Monochromatic-Square-Free Ramsey Grid Colorings via SAT Solvers

Evaluation of SAT like Proof Techniques for Formal Verification of Word Level Circuits

DPLL(T ):Fast Decision Procedures

Bounded Model Checking with QBF

Seminar decision procedures: Certification of SAT and unsat proofs

SAT-Solving: Performance Analysis of Survey Propagation and DPLL

Towards a Symmetric Treatment of Satisfaction and Conflicts in Quantified Boolean Formula Evaluation

Memory Efficient All-Solutions SAT Solver and its Application for Reachability Analysis

Integration of Supercubing and Learning in a SAT Solver

CSC2542 SAT-Based Planning. Sheila McIlraith Department of Computer Science University of Toronto Summer 2014

CAV Verification Mentoring Workshop 2017 SMT Solving

Constraint Programming

An Analysis and Comparison of Satisfiability Solving Techniques

BITCOIN MINING IN A SAT FRAMEWORK

Modern SAT Solvers. Part B. Vienna Winter School on Verification. 9 February TU Vienna, Austria

arxiv: v1 [cs.lo] 17 Oct 2013

PROPOSITIONAL LOGIC (2)

CSc Parallel Scientific Computing, 2017

Solving Optimization Problems with DLL

Transcription:

SAT/SMT Solvers and Applications University of Waterloo Winter 2013

Today s Lecture Lessons learnt so far Implementation-related attacks (control-hazard, malware,...) Program analysis techniques can detect them, prevent them How do you build such program analysis-based detectors and bug-finders Often, using constraint solvers (aka SAT/SMT solvers) Constraint solvers What are constraint solvers? Why you should care? Security and software engineering applications 2

What is a Constraint Solver? Engineer/Mathematician s point of vew A method that takes as input a math formula, and produces a solution Examples: solving linear equations over the reals, polynomials, quadratic, Boolean logic,... Computing zeros of a polynomial Theoretical computer scientist/logician s point of view A computer program called as a satisfiability procedure that solves a specific kind of decision problem, namely, the SAT problem The input formula is in a specified logic (e.g., Boolean, first-order, reals, integers,...) Output of a satisfiability procedure UNSAT, if input has no satisfying assignments SAT, otherwise 3

One Slide History of Constraint Solving Methods Before modern conception of logic (Before Boole and Frege) From Babylon to late 1800 s: Huge amount of work on methods to solve (find roots of) polynomials over reals, integers,... System of linear equations over the reals (Chinese methods, Cramer s method, Gauss elimination) These methods were typically not complete (e.g., worked for a special class of polynomials) After modern conception of logic Systems of linear inequalities over the integers are solvable (Presburger, 1927) Peano arithmetic is undecidable (hence, not solvable) (Godel, 1931) First-order logic is undecidable (hence, not solvable) (Turing,1936. Church, 1937) A exponential-time algorithm for Boolean SAT problem (Davis, Putnam, Loveland, Loggeman in 1962) Systems of Diophantine equations are not solvable (Matiyasevich. 1970) Boolean SAT problem is NP-complete (Cook 1971) Many efficient, scalable SAT procedures since 1971 for a variety of mathematical theories 4

Foundation of Sofware Engineering Logic Abstractions of Computation Formal Methods Program Analysis Program Reasoning Automatic Testing Program Synthesis 5

Foundation of Sofware Engineering Logic Abstractions of Computation Formal Methods Program Analysis Program Logics (Boolean,...) Reasoning Automatic Testing Program Synthesis 5

Software Engineering & SAT/SMT Solvers An Indispensable Tactic for Any Strategy Formal Methods Program Analysis SE Goal: Reliable/Secure Software Automatic Testing Program Synthesis 6

Software Engineering & SAT/SMT Solvers An Indispensable Tactic for Any Strategy Formal Methods Program Analysis SE Goal: SAT/SMT Reliable/Secure Software Solvers Automatic Testing Program Synthesis 6

Software Engineering using Solvers Engineering, Usability, Novelty Program Specification Logic Formulas Program Reasoning Tool SAT/SMT Solver SAT/UNSAT Program is Correct? or Generate Counterexamples (Test cases) 7

SAT/SMT Solver Research Story A 1000x Improvement 1,000,000 Constraints Solver-based programming languages Compiler optimizations using solvers Solver-based debuggers Solver-based type systems Solver-based concurrency bugfinding Solver-based synthesis Bio & Optimization 100,000 Constraints Concolic Testing Program Analysis Equivalence Checking Auto Configuration 10,000 Constraints Bounded MC Program Analysis AI 1,000 Constraints 1998 2001 2004 2007 2010 8

The SAT/SMT Problem Logic Formula (q p r) (q p r)... Solver SAT UNSAT Rich logics (Modular arithmetic, Arrays, Strings,...) NP-complete, PSPACE-complete,... Practical, scalable, usable, automatic Enable novel software reliability approaches 9

The SAT/SMT Problem Logic Formula (q p r) (q p r)... Solver SAT UNSAT Closely related to the Validity Problem Soundness, completeness, termination Connecting model theory and proof theory 10

Lecture Outline Points already covered Motivation for SAT/SMT solvers in software engineering High-level description of the SAT/SMT problem & logics Defined logic, models, truth, proofs, SAT procedure, soundness, completeness Rest of the lecture Modern CDCL SAT solver architecture & techniques SAT/SMT-based applications Future of SAT/SMT solvers Some history (who, when,...) and references sprinkled throughout the talk Non-CDCL SAT techniques 11

Concolic Testing: Example int double (int v) { } return 2*v; void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } The concolic testing slides are courtesy Koushik Sen

Concolic Testing: Example int double (int v) { return 2*v; } N 2*y == x Y void testme (int x, int y) { z = double (y); if (z == x) { N x > y+10 Y if (x > y+10) { } ERROR; ERROR } }

Concolic Testing Approach int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } x = 22, y = 7 x = x 0, y = y 0

Concolic Testing Approach int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } x = 22, y = 7, z = 14 x = x 0, y = y 0, z = 2*y 0

Concolic Testing Approach int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } 2*y 0!= x 0 } x = 22, y = 7, z = 14 x = x 0, y = y 0, z = 2*y 0

Concolic Testing Approach int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } Solve: 2*y 0 == x 0 Solution: x 0 = 2, y 0 = 1 x = 22, y = 7, z = 14 x = x 0, y = y 0, z = 2*y 0 2*y 0!= x 0

Concolic Testing Approach: Use-case for SAT int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } Solve: 2*y 0 == x 0 Solution: x 0 = 2, y 0 = 1 x = 22, y = 7, z = 14 x = x 0, y = y 0, z = 2*y 0 2*y 0!= x 0

Concolic Testing Approach: Use-case for SAT int double (int v) { } return 2*v; concrete state Concrete Execution symbolic state Symbolic Execution path condition void testme (int x, int y) { z = double (y); if (z == x) { if (x > y+10) { ERROR; } } } Solve: 2*y 0 == x 0 Solution: x 0 = 2, y 0 = 1 Observe that digital programs with finite loops are Boolean logic circuits x = 22, y = 7, z = 14 x = x 0, y = y 0, z = 2*y 0 2*y 0!= x 0

The Boolean SAT Problem Basic Definitions and Format A literal p is a Boolean variable x or its negation x. A clause C is a disjunction of literals: x 2 x 41 x 15 A CNF is a conjunction of clauses: (x 2 x 1 x 5 ) (x 6 x 2 ) (x 3 x 4 x 6 ) All Boolean formulas assumed to be in CNF Assignment is a mapping (binding) from variables to Boolean values (True, False). A unit clause C is a clause with a single unbound literal The SAT-problem is: Find an assignment s.t. each input clause has a true literal (aka input formula has a solution or is SAT) OR establish input formula has no solution (aka input formula is UNSAT) The Input formula is represented in DIMACS Format: c DIMACS p cnf 6 3 2-1 5 0 6-2 0 3-4 -6 0

DPLL SAT Solver Architecture The Basic Solver DPLL(Θcnf, assign) { Propagate unit clauses; if conflict : return FALSE; if complete assign : return TRUE; pick decision variable x ; return DPLL(Θcnf! x=0, assign[x=0]) DPLL(Θcnf! x=1, assign[x=1]); Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value Backtracking: Implicitly done by the recursion } 20

Key Steps and Data-structures Input SAT Instance Propagate() (BCP) No Key steps Decide() Propagate() (BCP: Boolean constraint propagation) Conflict analysis and learning() Backjump() Forget() Restart() All Vars Assigned? Conflict Analysis() CDCL: Conflict-Driven Clause-Learning Conflict analysis is a key step Results in learning a conflict clause Prunes the search space SAT Decide() UNSAT TopLevel BackJump() Key data-structures (State): Stack or trail of partial assignments (AT) Input clause database Conflict clause database Conflict graph Decision level (DL) of a variable 21

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide: Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 22

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide: Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 22

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Basic mechanism to do search Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 23

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Basic mechanism to do search Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 23

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Basic mechanism to do search Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 24

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate (Boolean Constant Propagation): Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Basic mechanism to do search Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Analyze the reason (learn conflict clause) Conflict clause blocks the non-satisfying & a large set of other no-good assignments Marques-Silva & Sakallah (1999) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 24

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate: Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Compute assignments that lead to conflict (analysis) Construct conflict clause blocks the non-satisfying & a large set of other no-good assignments (learning) Marques-Silva & Sakallah (1996) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 25

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate: Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide (Branch): Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Compute assignments that lead to conflict (analysis) Construct conflict clause blocks the non-satisfying & a large set of other no-good assignments (learning) Marques-Silva & Sakallah (1996) BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Marques-Silva & Sakallah (1999) Backtrack (Davis, Putnam, Loveland, Logemann 1962) 25

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate: Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide: Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Compute assignments that lead to conflict (analysis) Construct conflict clause blocks the non-satisfying & a large set of other no-good assignments (learning) Marques-Silva & Sakallah (1996) Conflict-driven BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Backjump: Marques-Silva, Sakallah (1999) Backtrack: Davis, Putnam, Loveland, Logemann (1962) 26

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT All Vars Assigned? Propagate() (BCP) No Decide() Conflict Analysis() UNSAT TopLevel BackJump() Propagate: Propagate inferences due to unit clauses Most time in solving goes into this Detect Conflict: partial assignment is not satisfying Decide: Choose a variable & assign some value (decision) Each decision is a decision level Imposes dynamic variable order Decision Level (DL): variable natural number Conflict analysis and clause learning: Compute assignments that lead to conflict (analysis) Construct conflict clause blocks the non-satisfying & a large set of other no-good assignments (learning) Marques-Silva & Sakallah (1996) Conflict-driven BackJump: Undo the decision(s) that caused no-good assignment Assign decision variables different values Go back several decision levels Backjump: Marques-Silva, Sakallah (1999) Backtrack: Davis, Putnam, Loveland, Logemann (1962) 26

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance SAT Propagate() (BCP) All Vars Assigned? No Decide() Conflict Analysis() TopLevel {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} {3, 6, -7, 8} {1, 4, 7} {-8, 4} Decide {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Another unit clause (more BCP) {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Unit clause (BCP)... {3, 6, -7, 8} CONFLICT! (Trigger to {1, 4, 7} analyze & backjump) {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} UNSAT BackJump() 27

Decide() Details: VSIDS Heuristic Input SAT Instance Propagate() (BCP) No Decide() or Branching(): Choose a variable & assign some value (decision) Imposes dynamic variable order (Malik et al. 2001) All Vars Assigned? Conflict Analysis() How to choose a variable: VSIDS heuristics Each variable has an activity Activity is bumped additively, if variable occurs in conflict clause Activity of all variables is decayed by multiplying by const < 1 SAT Decide() TopLevel Next decision variable is the variable with highest activity Over time, truly important variables get high activity UNSAT BackJump() This is pure magic, and seems to work for many problems 28

Propagate() Details: Two-watched Literal Scheme Input SAT Instance Propagate() (BCP) No {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Decide {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Unit clause (BCP)... SAT All Vars Assigned? Decide() Conflict Analysis() UNSAT TopLevel BackJump() Watched Literal Watcher List -1 {-1, -3, 8},... -3 {-1, -3, 8},......... Watched Literal -1... -3... Watcher List 8 {-1, -3, 8},......... Watched Literal Watcher List -1 {-1, -3, 8},... -3... 8 {-1, -3, 8},......... The constraint propagates 8 29

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance Propagate() (BCP) No {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Decide {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} Unit clause (BCP)... SAT All Vars Assigned? Decide() Conflict Analysis() TopLevel {3, 6, -7, 8} {1, 4, 7} {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} More unit clauses (more BCP) Basic Backtracking Search {3, 6, -7, 8} CONFLICT! (Trigger to {1, 4, 7} analyze & backjump) {-8, 4} {-1, -3, 8} {-3, -4, -8} {-1, -2, 3, 4, -6} UNSAT BackJump() Flip the last decision 1 Try setting 1 to False Highly inefficient No learning from mistakes 30

Conflict Analysis/Learn() Details Input SAT Instance Propagate() (BCP) No Some Definitions Decision Level (DL) Map from Boolean variables in input to natural numbers All unit clauses in input & resultant propagations get DL = 0 Every decision var gets a DL in increasing order >= 1 All Vars Assigned? Conflict Analysis() All propagations due to decision var at DL=x get the DL=x Conflict Graph (CG) or Implication Graph Directed Graph that records decisions & propagations Vertices: literals, Edge: unit clauses SAT Decide() TopLevel Conflict Clause (CC) Clause returned by Conflict Analysis(), added to conflict DB Implied by the input formula A cut in the CG UNSAT BackJump() Prunes the search Assignment Trail (AT) A stack of partial assignment to literals, with DL info 31

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) X9 = 0@1 X11 = 0@3 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) X9 = 0@1 X11 = 0@3 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) X1 = 1@6 W1 W6 = ( X5 + X6) W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) X9 = 0@1 X11 = 0@3 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) X9 = 0@1 X11 = 0@3 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 X2 = 1@6 W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) X9 = 0@1 X11 = 0@3 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W4 = ( X4 + X5 + X10) X3 = 1@6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 X6 = 1@6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 X6 = 1@6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 X6 = 1@6 W6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 Conflict W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 X6 = 1@6 W6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Implication Graph Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Clause DB CONFLICT GRAPH X10 = 0@3 W1 = ( X1 + X2) X2 = 1@6 W4 X5 = 1@6 = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 Conflict W4 = ( X4 + X5 + X10) X3 = 1@6 W3 W5 X6 = 1@6 W6 W5 = ( X4 + X6 + X11) W6 = ( X5 + X6) X9 = 0@1 X11 = 0@3 W5 W7 = (X1 + X7 + X12) W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 32

Conflict Analysis/Learn() Details: Conflict Clause Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current Decision: {X1 = 1@6} Simplest strategy is to traverse the conflict graph backwards until decision variables: conflict clause includes only decision variables ( X1 + X9 + X10 + X11) Clause DB CONFLICT GRAPH X10 = 0@3 W1 = ( X1 + X2) Reason Side Conflict Side = ( X1 + X3 + X9) X2 = 1@6 W4 X5 = 1@6 W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 Conflict W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) X3 = 1@6 W3 W5 X6 = 1@6 W6 W6 = ( X5 + X6) W7 = (X1 + X7 + X12) X9 = 0@1 X11 = 0@3 W5 W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 33

Conflict Analysis/Learn() Details: Conflict Clause Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current Decision: {X1 = 1@6} Another strategy is to use First Unique Implicant Point (UIP): Traverse graph backwards in breadth-first, expand literals of conflict, stop at first UIP Clause DB CONFLICT GRAPH X10 = 0@3 W1 = ( X1 + X2) = ( X1 + X3 + X9) Reason Side X2 = 1@6 W4 X5 = 1@6 Conflict Side W3 = ( X2 + X3 + X4) W4 = ( X4 + X5 + X10) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 Conflict W5 = ( X4 + X6 + X11) X3 = 1@6 W3 W5 X6 = 1@6 W6 W6 = ( X5 + X6) W7 = (X1 + X7 + X12) X9 = 0@1 X11 = 0@3 W5 W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 34

Conflict Analysis/Learn() Details: BackTrack Current Assignment Trail: {X9 = 0@1, X10 = 0@3, X11 = 0@3, X12 = 1@2, X13 = 1@2,...} Current decision: {X1 = 1@6} Strategy: Closest decision level (DL) current DL for which conflict clause is unit. Undo {X1 = 1@6} Clause DB CONFLICT GRAPH X10 = 0@3 W1 = ( X1 + X2) Reason Side Conflict Side = ( X1 + X3 + X9) X2 = 1@6 W4 X5 = 1@6 W3 = ( X2 + X3 + X4) X1 = 1@6 W1 W3 X4 = 1@6 W4 W6 Conflict W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) X3 = 1@6 W3 W5 X6 = 1@6 W6 W6 = ( X5 + X6) W7 = (X1 + X7 + X12) X9 = 0@1 X11 = 0@3 W5 W8 = (X1 + X8) W9 = ( X7 + X8 + X13) 35

Conflict Analysis/Learn() Details: BackJump X1 was implied literal, leading to another conflict described below Conflict clause: (X9 + X10 + X11 + X12 + X13) BackJump strategy: Closest decision level (DL) current DL for which conflict clause is unit. Undo {X10 = 0@3} CLAUSE DB CONFLICT GRAPH TRAIL W1 = ( X1 + X2) Reason Side DL = ( X1 + X3 + X9) W3 = ( X2 + X3 + X4) W4 = ( X4 + X5 + X10) W5 = ( X4 + X6 + X11) X10 = 0@3 X9 = 0@1 X1 = 0@6 W8 X8 = 1@6 W9 Conflict W9 X13 = 1@2 3 4 5 W6 = ( X5 + X6) W7 X7 = 1@6 W9 W7 = (X1 + X7 + X12) W8 = (X1 + X8) X11 = 0@3 X12 = 1@2 W7 Conflict Side X1 6 W9 = ( X7 + X8 + X13) 1 0 BackJump 36

Restarts and Forget Input SAT Instance Propagate() (BCP) No Restarts Clear the Trail and start again Start searching with a different variable order All Vars Assigned? Conflict Analysis() Only Conflict Clause (CC) database is retained Forget: throw away less active learnt conflict clauses routinely Routinely throw away very large CC Logically CC are implied SAT Decide() TopLevel Hence no loss in soundness/completeness Time Savings: smaller DB means less work in propagation Space savings UNSAT BackJump() 37

Why is SAT efficient? Input SAT Instance Propagate() (BCP) VSIDS branching heuristic and propagate (BCP) No Conflict-Driven Clause-Learning (CDCL) Forget conflict clauses if DB goes too big All Vars Assigned? Conflict Analysis() BackJump Restarts All the above elements are needed for efficiency Deeper understanding lacking SAT Decide() TopLevel No predictive theory UNSAT BackJump() 38

Propagate(), Decide(), Analyze/Learn(), BackJump() Input SAT Instance Propagate() (BCP) No Conflict-Driven Clause-Learning (CDCL) (Marques-Silva & Sakallah 1996) Decide/branch and propagate (BCP) (Malik et al. 2001, Zabih & McAllester 1988) All Vars Assigned? Conflict Analysis() BackJump (McAllester 1980, Marques-Silva & Sakallah 1999) Restarts (Selman & Gomes 2001) SAT Decide() TopLevel Follows MiniSAT (Een & Sorensson 2003) UNSAT BackJump() 39

Soundness, Completeness & Termination Input SAT Instance Propagate() (BCP) Soundness: A solver is said to be sound, if, for any input formula F, the solver terminates and produces a solution, then F is indeed SAT No Proof: (Easy) SAT is returned only when all vars have been assigned a value (True, False) by Decide or BCP, and solver checks the solution. All Vars Assigned? Conflict Analysis() SAT Decide() TopLevel UNSAT BackJump() 40

Soundness, Completeness & Termination Input SAT Instance Propagate() (BCP) No Completeness: A solver is said to be complete, if, for any input formula F that is SAT, the solver terminates and produces a solution (i.e., solver does not miss solutions) Proof: (Harder) Backtracking + BCP + decide is complete (easy) All Vars Assigned? Conflict Analysis() Conflict clause is implied by input formula (easy) Only need to see backjumping does not skip assignments Observe backjumping occurs only when conflict clause (CC) vars < decision level (DL) of conflicting var Backjumping to max(dl of vars in CC) SAT Decide() TopLevel Decision tree rooted at max(dl of vars in CC)+1 is guaranteed to not satisfy CC Hence, backjumping will not skip assignments UNSAT BackJump() 41

Soundness, Completeness & Termination Input SAT Instance Propagate() (BCP) No Termination: Some measure decreases every iteration Proof Sketch: Loop guarantees either conflict clause (CC) added OR assign extended All Vars Assigned? Conflict Analysis() CC added. What stops CC addition looping forever? Recall that CC is remembered No CC duplication possible CC blocks UNSAT assign exploration in decision tree. No duplicate UNSAT assign exploration possible SAT Decide() TopLevel Size of decision tree explored decreases for each CC add UNSAT BackJump() 42

References & Important SAT Solvers 1. Marques-Silva, J.P. and K.A. Sakallah. GRASP: A Search Algorithm for Propositional Satisfiability. IEEE Transactions on Computers 48(5), 1999, 506-521. 2. Marques-Silva, J.P. and K.A. Sakallah. GRASP: A Search Algorithm for Propositional Satisfiability. Proceedings of ICCAD, 1996. 3. M. Moskewicz, C. Madigan, Y. Zhao, L. Zhang, and S. Malik. CHAFF: Engineering an efficient SAT solver. Proceedings of the Design Automation Conference (DAC), 2001, 530-535. 4. L. Zhang, C. F. Madigan, M. H. Moskewicz and S. Malik. Efficient Conflict Driven Learning in a Boolean Satisfiability Solver. Proceedings of ICCAD, 2001, 279-285. 5. Armin Bierre, Marijn Heule, Hans van Maaren, and Toby Walsh (Editors). Handbook of Satisfiability. 2009. IOS Press. http:// www.st.ewi.tudelft.nl/sat/handbook/ 6. M. Davis, G. Logemann, and D. Loveland. A machine program for theorem proving. Communications of the ACM.1962. 7. zchaff SAT Solver by Lintao Zhang 2002. 8. GRASP SAT Solver by Joao Marques-Silva and Karem Sakallah 1999. 9. MiniSAT Solver by Niklas Een and Niklas Sorenson 2005 - present 10. SAT Live: http://www.satlive.org/ 11. SAT Competition: http://www.satcompetition.org/ 12. SAT/SMT summer school: http://people.csail.mit.edu/vganesh/summerschool/ 43

Important Ideas and Conclusions 1. SAT solvers are crucial for software engineering 2. Huge impact in formal methods, program analysis and testing 3. Key ideas that make SAT efficient 1. Conflict-driven clause learning 2. VSIDS (or similar) variable selection heuristics 3. Backjumping 4. Restarts 4. Techniques I didn t discuss 1. Survey propagation (belief propagation) by Selman & Gomes 2. Works well for randomized SAT, not yet for industrial instances 3. Physics-inspired 4. Combining CDCL with survey propagation (?) 44