Boolean Functions (Formulas) and Propositional Logic

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

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

Normal Forms for Boolean Expressions

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

P -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time

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

Deductive Methods, Bounded Model Checking

4.1 Review - the DPLL procedure

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

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

NP-Completeness. Algorithms

2SAT Andreas Klappenecker

Computer-Aided Program Design

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

Linear Time Unit Propagation, Horn-SAT and 2-SAT

An Introduction to SAT Solvers

Constraint Satisfaction Problems

Example: Map coloring

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

Notes on CSP. Will Guaraldi, et al. version 1.7 4/18/2007

Massively Parallel Seesaw Search for MAX-SAT

NP and computational intractability. Kleinberg and Tardos, chapter 8

Boolean Representations and Combinatorial Equivalence

Polynomial SAT-Solver Algorithm Explanation

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

MajorSat: A SAT Solver to Majority Logic

Notes on CSP. Will Guaraldi, et al. version /13/2006

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

8.1 Polynomial-Time Reductions

PROPOSITIONAL LOGIC (2)

EECS 219C: Formal Methods Binary Decision Diagrams (BDDs) Sanjit A. Seshia EECS, UC Berkeley

Complexity Classes and Polynomial-time Reductions

Chapter 2 PRELIMINARIES

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

Mixed Integer Linear Programming

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

CS-E3200 Discrete Models and Search

Combinational Equivalence Checking

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

NP-Complete Reductions 2

Where the hard problems are. Toby Walsh Cork Constraint Computation Centre

On the Relation between SAT and BDDs for Equivalence Checking

On Resolution Proofs for Combinational Equivalence Checking

8 NP-complete problem Hard problems: demo

P and NP (Millenium problem)

Foundations of AI. 8. Satisfiability and Model Construction. Davis-Putnam, Phase Transitions, GSAT and GWSAT. Wolfram Burgard & Bernhard Nebel

Circuit versus CNF Reasoning for Equivalence Checking

Algorithms for SAT and k-sat problems

Automated Theorem Proving: DPLL and Simplex

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Where Can We Draw The Line?

algorithms, i.e., they attempt to construct a solution piece by piece and are not able to offer a complete solution until the end. The FM algorithm, l

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

NP-complete Reductions

(p 300) Theorem 7.27 SAT is in P iff P=NP

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

Propositional logic (Ch. 7)

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

Seminar decision procedures: Certification of SAT and unsat proofs

A Satisfiability Procedure for Quantified Boolean Formulae

CPSC 320 Notes: What's in a Reduction?

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Some Hardness Proofs

Heuristic Backtracking Algorithms for SAT

Dynamic Variable Filtering for Hard Random 3-SAT Problems

A Stochastic Non-CNF SAT Solver

SERGEI OBIEDKOV LEARNING HORN FORMULAS WITH QUERIES

New Worst-Case Upper Bound for #2-SAT and #3-SAT with the Number of Clauses as the Parameter

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Lecture 14: Lower Bounds for Tree Resolution

The Resolution Algorithm

Fixed-Parameter Algorithm for 2-CNF Deletion Problem

SEARCHING FOR TRUTH: TECHNIQUES FOR SATISFIABILITY OF BOOLEAN FORMULAS

On Proof Systems Behind Efficient SAT Solvers. DoRon B. Motter and Igor L. Markov University of Michigan, Ann Arbor

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

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

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Helsinki University of Technology Laboratory for Theoretical Computer Science Research Reports 100

Extending the Reach of SAT with Many-Valued Logics

On the Complexity of k-sat

Reliable Verification Using Symbolic Simulation with Scalar Values

1 Definition of Reduction

PCP and Hardness of Approximation

W4231: Analysis of Algorithms

An Experimental Evaluation of Conflict Diagnosis and Recursive Learning in Boolean Satisfiability

CS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w

Copyright 2000, Kevin Wayne 1

SAT/SMT Solvers and Applications

SAT-CNF Is N P-complete

SAT-Solving Of Certain Graph-Based CNF s

Reductions and Satisfiability

Multi Domain Logic and its Applications to SAT

Satisfiability Solvers

Random Instances of W[2]-complete Problems: thresholds, complexity, and algorithms

Homework 4 Solutions

On Resolution Proofs for Combinational Equivalence

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Transcription:

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving Part I: Basics Sanjit A. Seshia EECS, UC Berkeley Boolean Functions (Formulas) and Propositional Logic Variables: x 1, x 2, x 3,, x n {0, 1} (or {true, false}) F(x 1, x 2, x 3,, x n ) {0,1} F representable as the output (root) of a circuit (expression DAG) constructed with gates (Boolean operators) Standard Boolean operators: And (, ), Or (, +), Not (, ) Derived operators: Implies ( ) Iff ( ) S. A. Seshia 2 1

The Boolean Satisfiability Problem (SAT) Given: A Boolean formula F(x 1, x 2, x 3,, x n ) Can F evaluate to 1 (true)? Is F satisfiable? If yes, return values to x i s (satisfying assignment) that make F true S. A. Seshia 3 Why is SAT important? Theoretical importance: First NP-complete problem (Cook, 1971) Many practical applications: Model Checking Automatic Test Pattern Generation Combinational Equivalence Checking Planning in AI Automated Theorem Proving Software Verification S. A. Seshia 4 2

Literal Terminology Clause Conjunctive Normal Form (CNF) Disjunctive Normal Form (DNF) Tautology Complexity of tautology checking for propositional logic? S. A. Seshia 5 An Example Inputs to SAT solvers are usually represented in CNF (a + b + c) (a + b + c) (a + b + c ) (a + b + c ) S. A. Seshia 6 3

An Example Inputs to SAT solvers are usually represented in CNF (a + b + c) (a + b + c) (a + b + c ) (a + b + c ) S. A. Seshia 7 Why CNF? S. A. Seshia 8 4

Why CNF? Input-related reason Can transform from circuit to CNF in linear time & space (HOW?) Solver-related: Most SAT solver variants can exploit CNF Easy to detect a conflict Easy to remember partial assignments that don t work (just add conflict clauses) Other ease of representation points? Any reasons why CNF might NOT be a good choice? S. A. Seshia 9 Complexity Issues k-sat: A SAT problem with input in CNF with at most k literals in each clause Complexity for non-trivial values of k: 2-SAT:? 3-SAT:? > 3-SAT:? S. A. Seshia 10 5

2-SAT Algorithm Linear-time algorithm (Aspvall, Plass, Tarjan, 1979) Think of clauses as implications Think of a graph with literals as nodes Find strongly connected components Variable and its negation should not be in the same component Example 1: (a + b) (b + c) (c + a) Example 2: (a + b) (b + c) (c + a) (a + b) (a + b ) S. A. Seshia 11 3-SAT: Complexity Bounds (circa 2008) Obvious upper bound on run-time? Best known deterministic upper bound 1.473 n Best known randomized upper bound 1.324 n Best known lower bound n 2.761 S. A. Seshia 12 6

Worst-Case Complexity S. A. Seshia 13 Beyond Worst-Case Complexity What we really care about is typical-case complexity But how can one measure typical-case? Two approaches: Is your problem a restricted form of 3-SAT? That might be polynomial-time solvable Experiment with (random) SAT instances and see how the solver run-time varies with formula parameters (#vars, #clauses, ) S. A. Seshia 14 7

Special Cases of 3-SAT You already know one: 2-SAT T. Larrabee observed that many clauses in ATPG tend to be 2-CNF Another useful class: Horn-SAT A clause is a Horn clause if at most one literal is positive If all clauses are Horn, then problem is Horn- SAT E.g. Application:- Simulation checking between 2 finite-state systems S. A. Seshia 15 Horn-SAT Can we solve Horn-SAT in polynomial time? How? [homework] Hint: view clauses as implications. Variants: Negated Horn-SAT: Clauses with at most one literal negative Renamable Horn-SAT: Doesn t look like a Horn-SAT problem, but turns into one when polarities of some variables are flipped S. A. Seshia 16 8

Phase Transitions in k-sat Consider a fixed-length clause model k-sat means that each clause contains exactly k literals Let SAT problem comprise m clauses and n variables Randomly generate the problem for fixed k and varying m and n Question: How does the problem hardness vary with m/n? S. A. Seshia 17 3-SAT Hardness As n increases hardness transition grows sharper m / n S. A. Seshia 18 9

Transition at m/n ' 4.3 m / n S. A. Seshia 19 Threshold Conjecture For every k, there exists a c* such that For m/n < c*, as n, problem is satisfiable with probability 1 For m/n > c*, as n, problem is unsatisfiable with probability 1 Conjecture proved true for k=2 and c*=1 For k=3, current status is that c* is in the range 3.42 4.51 S. A. Seshia 20 10

We know: The (2+p)-SAT Model 2-SAT is in P 3-SAT is in NP Problems are (typically) a mix of binary and ternary clauses Let p {0,1} Let problem comprise (1-p) fraction of binary clauses and p of ternary So-called (2+p)-SAT problem S. A. Seshia 21 Experimentation with random (2+p)-SAT When p < ~0.41 Problem behaves like 2-SAT Linear scaling When p > ~0.42 Problem behaves like 3-SAT Exponential scaling Nice observations, but don t help us predict behavior of problems in practice S. A. Seshia 22 11

Backbones and Backdoors Backbone [Parkes; Monasson et al.] Subset of literals that must be true in every satisfying assignment (if one exists) Empirically related to hardness of problems Backdoor [Williams, Gomes, Selman] Subset of variables such that once you ve given those a suitable assignment (if one exists), the rest of the problem is poly-time solvable Also empirically related to hardness But no easy way to find such backbones / backdoors! S. A. Seshia 23 A Classification of SAT Algorithms Davis-Putnam (DP) Based on resolution Davis-Logemann-Loveland (DLL/DPLL) Search-based Basis for current most successful solvers Stalmarck s algorithm More of a breadth first search, proprietary algorithm Stochastic search Local search, hill climbing, etc. Unable to prove unsatisfiability (incomplete) S. A. Seshia 24 12

Resolution Two CNF clauses that contain a variable x in opposite phases (polarities) imply a new CNF clause that contains all literals except x and x (a + b) (a + c) = (a + b)(a + c)(b + c) Why is this true? S. A. Seshia 25 The Davis-Putnam Algorithm Iteratively select a variable x to perform resolution on Retain only the newly added clauses and the ones not containing x Termination: You either Derive the empty clause (conclude UNSAT) Or all variables have been selected S. A. Seshia 26 13

Resolution Example How many clauses can you end up with? (at any iteration) S. A. Seshia 27 Next Class Quick review of SAT algorithms; how DPLL/DLL algorithm works in current SAT solvers S. A. Seshia 28 14