Restricted Satisfiability (SAT) Problem

Slides:



Advertisements
Similar presentations
Lecture 23. Subset Sum is NPC
Advertisements

FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
CS5371 Theory of Computation
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
CS 151 Digital Systems Design Lecture 6 More Boolean Algebra A B.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
Restricted Satisfiability (SAT) Problem
NP-Complete Problems Problems in Computer Science are classified into
1 Section 10.1 Boolean Functions. 2 Computers & Boolean Algebra Circuits in computers have inputs whose values are either 0 or 1 Mathematician George.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
Normal forms for Context-Free Grammars
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 The Cook-Levin Theorem Zeph Grunschlag. 2 Announcements Last HW due Thursday Please give feedback about course at oracle.seas.columbia.edu/wces oracle.seas.columbia.edu/wces.
Combinational Digital Circuits. Measurement Our world is an analog world. Measurements that we make of the physical objects around us are never in discrete.
Lecture 22 More NPC problems
Theory of Computation, Feodor F. Dragan, Kent State University 1 NP-Completeness P: is the set of decision problems (or languages) that are solvable in.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Additional NP-complete problems
Theory of Computation, Feodor F. Dragan, Kent State University 1 TheoryofComputation Spring, 2015 (Feodor F. Dragan) Department of Computer Science Kent.
June 11, 2002© Howard Huang1 Boolean algebra Last time we talked about Boolean functions, Boolean expressions, and truth tables. Today we’ll learn.
ENGIN112 L6: More Boolean Algebra September 15, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 6 More Boolean Algebra A B.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
1 Lect # 2 Boolean Algebra and Logic Gates Boolean algebra defines rules for manipulating symbolic binary logic expressions. –a symbolic binary logic expression.
NP-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
CS 461 – Nov. 30 Section 7.5 How to show a problem is NP-complete –Show it’s in NP. –Show that it corresponds to another problem already known to be NP-complete.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 9 Boolean Algebras and Combinatorial Circuits.
Boolean Functions and Boolean Algebra Laxmikant Kale.
1 Chapter 10 Intractable Problems Switzerland Lion Monument in Lucerne.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 4 Dr. Shi Dept. of Electrical and Computer Engineering.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NP-complete.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
CHAPTER 2 Boolean algebra and Logic gates
Chapter 1 Logic and proofs
NP-Completeness A problem is NP-complete if: It is in NP
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-Complete and NP-hard Problems
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
Proposition & Predicates
Speaker: Fuw-Yi Yang 楊伏夷 伏夷非征番, 道德經 察政章(Chapter 58) 伏者潛藏也
Propositional Calculus: Boolean Algebra and Simplification
Elementary Metamathematics
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Logics for Data and Knowledge Representation
NP-Completeness Proofs
The Satisfiability Problem
Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: We can represent.
From now on: Combinatorial Circuits:
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
The Satisfiability Problem
Presentation transcript:

Restricted Satisfiability (SAT) Problem By Mutaz Flmban

Out line CSAT & 3SAT Normal Forms for Boolean Expression Converting Expression to CNF Theorem 10.12 NP-Completeness of CSAT Theorem 10.13 NP-Completeness of 3SAT Theorem 10.15

CSAT & 3SAT CSAT: an intermediate step that is used to show that SAT can be reduced to 3SAT 3SAT: is a problem about satisfiability of boolean expressions, these expression have a very regular form: they are the AND of “clauses”. each clause is the OR of exactly three variables or negated variables.

OUR GOAL Reduce satisfiability for any expression to satisfiability for expressions in the normal form for the 3SAT problem. Convert each expression E in SAT to another expression F in the normal form for 3SAT. Note: F is satisfiability if and only if E is satisfiability.

Normal Forms for Boolean Expression essential definitions A literal: is either a variable, or a negated e.g. ¬x, x A clause: is the logical OR of one or more literals. e.g. x , x ˅ ¬y ˅ z. A boolean expression: is said to be in conjunctive normal form or CNF, if it is the AND of clauses.

Important notation OR () is treated as a Sum, using the (+) operator. AND () is treated as a product. normally use juxtaposition (no operator). Not = (¬)

Example The expression (x ˅ ¬y) ˄ (¬x ˅ z): will be written in CNF as (x + ¬y)(¬x + z) It is in conjunctive normal form, since it is the AND (product) of the clauses: (x + ¬y) and (¬x + z).

(x + y¬z)(x + y + z)(¬y + ¬z), xyz in CNF? Question? are the expressions (x + y¬z)(x + y + z)(¬y + ¬z), xyz in CNF? The first expression not in CNF. It is the AND of three subexpressions, the last two are clauses, but the first is not, it is the sum of a literal and a product of two literals. The second expression in CNF. the clause can have only one literal, so it is the product of three clauses, (x ), (y), and (z)

k-Conjunctive Normal Form (k-CNF) (K-CNF) is an expression that contains a product of clauses. Each of which is the sum of exactly k distinct literals. For example: (x + ¬y)(y + ¬z)(z + ¬x) is in 2-CNF because each of its clauses has exactly two literals.

CSAT and KSAT CSAT is a Boolean expression in CNF that is satisfiable. KSAT is a Boolean expression in k-CNF that is satisfiable

Some problems CSAT is the problem: Given a Boolean expression in CNF, is it satisfiable? kSAT is the problem: Given a Boolean expression in k-CNF, is it satisfiable?

We shell see that CSAT, 3SAT and KSAT for all K higher than 3 are NP-Complete

Converting Expression to CNF We will take a SAT instance E and convert it to a CSAT instance F such that F is satisfiable if and only if E is statisfiable. The reduction of SAT to CSAT includes two parts:

Reduction of SAT to CSAT The two parts are: We push all ¬’s down the expression tree so that the only negations are of variables, the boolean expression becomes an AND and OR of literals. Write the Boolean expressions in CNF form, we will get new variables. The new expression F will not be equivalent to the expression E. If T is a truth assignment that makes E true, then there is an extension of T , say S, that makes F true. S is an extension of T if S assigns the same value as T to each variable that T assigns.

DeMorgan’s Laws ¬(E  F) ⇒ ¬(E)  ¬(F) to push ¬ below , the  is changed to an . ¬(E  F) ⇒ ¬(E)  ¬(F) to push ¬ below , the  is changed to an . ¬(¬E) ⇒ E : the double negation.

Example E = ¬((¬(x + y))(¬x + y)) Start ¬(¬(x + y))+¬(¬x + y) (1) x + y + ¬(¬x + y) (3) x + y + (¬(¬x)) ¬y (2) x + y + x ¬y

Theorem 10.12 Every Boolean expression E is equivalent to an expression F in which the only negations occur in literals. the length of F is linear in the number of symbols of E, and F can be constructed from E in polynomial time.

The PROOF The proof is an induction on the number of operators (¬,  and ) in E. There is an equivalent expression F with ¬’s only in literals. If E has n ≥ 1 operators, then F has no more than 2n – 1 operators.

continue F need not have more than one pair of parentheses per operator. The number of variable in an expression cannot exceed the number of operators by more than one. the length of F is linearly proportional to the length of E. the time it takes to construct F is proportional to its length and the length of E.

BASIS If E has one operator, it must be of the form: ¬x x  y x  y In each case, E is already in the required form, so F = E. Note, E and F each have one operator: The relationship “F has at most twice the number of operators of E minus 1”.

induction Suppose the statement is true for all expressions with fewer operations than E. if the highest operator of E is not “¬”. Then E must be of the form: E1  E2 E1  E2 In either case the induction hypothesis applies to E1 and E2.

The inductive hypothesis There are equivalent expressions F1 and F2, respectively, in which all ¬’s occur in literals only. F = F1  F2 or F = F1  F2 Let E1 and E2 have a and b operators, respectively. E has a + b + 1 operators By inductive hypothesis: F1 and F2 have 2a – 1 and 2b – 1 F has at most 2a + 2b – 1 operators. Which is no more then 2(a+b+1)-1, or twice the number of operators of E minus 1.

Induction (continued) consider the case where E is of the form ¬ E1 There are three cases depending on what the top operator of E1 is: E1 = ¬E2 E1 = E2  E3 E1 = E2  E3

The case “E1 = ¬E2” By the law of double negation, E = ¬(¬E2) E2 has fewer operators than E. By the inductive hypothesis: there is an equivalent F for E2 in which the only ¬’s are in literals. The number of operators of F is at most twice the number in E2 minus 1, and it is surely true for E.

The Case “E1 = E2  E3” By DeMorgan’s Law: E= ¬(E2  E3) = ¬E2  ¬E3 Both (¬E2) and (¬E3) have fewer operators than E. By the inductive hypothesis: they have an equivalents F2 and F3 that have ¬’s only in literals. F = F2  F3 = E Let (E2) has (a) operators, and (E3) has (b) operators. (E) has (a+b+2) operators. Since ¬(E2) and ¬(E3) have (a+1) and (b+1) operators, and (F2) has at most 2(a+1)-1 operators, (F3) has at most 2(b+1)-1 operators. (F) has at most 2a+2b+3 operators. And this number is twice the number of operators of E minus 1.

The Case “E1 = E2  E3” This argument, using the second of DeMorgan’s laws, is essentially the same as the case (2).

Theorem 10.13 CSAT is NP-Complete PROOF: We show how to reduce SAT to CSAT in polynomial time: Using method 10.12 to convert a SAT to an expression E whose ¬’s are only in literals. Convert E to a CNF expression F in polynomial time. F is satisfiable if and only if E is.

BASIS If E consists of one or two symbols, then it is a literal. A literal is a clause, so E is already in CNF.

Induction Assume that every expression shorter than E can be converted to a product of clauses. And conversion takes at most cn2 time on an expressions of length n. There are two cases depending on the top-level operator of E: E = E1  E2 E = E1  E2

Case 1: E = E1  E2 By the inductive hypothesis: There are expressions F1 and F2 derived from E1 and E2 respectively in CNF All and only the satisfying assignments for E1 can be extended to a satisfying assignment for F1. All and only the satisfying assignments for E2 can be extended to a satisfying assignment for F2. Let F = F1  F2 where: F1  F2 is a CNF expression if F1 and F2 are CNF expressions We must show that a truth assignment T for E can be extended to a satisfying assignment for F if and only if T satisfies E.

First Part (IF) Suppose T satisfies E: Let T1 be T restricted so it applies only to the variables that appear in E1. Let T2 be T restricted so it applies only to the variables that appear in E2. By the inductive hypothesis: T1 and T2 can be extended to assignments S1 and S2 that satisfy F1 and F2. Let S agree with S1 and S2 on each of the variables they define. We can construct S that is an extension of T that satisfies F.

Second Part (only if) Suppose that T has an extension S that satisfies F. Let T1 be T restricted to the variables of E1. Let T2 be T restricted to the variables of E2. Let S1 be S restricted to the variables of F1 Let S2 be S restricted to the variables of F2 Then S1 is an extension of T1, and S2 is an extension of T2. Because F is the AND of F1 and F2 then S1 satisfies F1 and S2 satisfies F2. By the inductive hypothesis: T1 must satisfy E1 and T2 must satisfy E2 T satisfies E.

Case 2: E = E1  E2 By the inductive hypothesis: there are CNF expressions F1 and F2 with the properties: A truth assignment for E1 satisfies E1 if and only if it can extended to a satisfying assignment for F1. A truth assignment for E2 satisfies E2 if and only if it can extended to a satisfying assignment for F2. The variables of F1 and F2 are disjoint, except for those variables that appear in E. F1 and F2 are in CNF Note: we cannot simply take the OR of F1 and F2 to construct F, because the resulting expression would not be in CNF.

Continued F=(y+g1)*(y+g2)*…*(y+gp) * (¬y+h1) * (¬y+h2) * … *(¬y+hq) Suppose F1= g1  g2  ..  gp. And F2= h1  h2  ..  hq Where g’s and h’s are clauses, also introduce a new variable y, and let: F=(y+g1)*(y+g2)*…*(y+gp) * (¬y+h1) * (¬y+h2) * … *(¬y+hq) We want to proof that a truth assignment T for E satisfies E if and only if T can be extended to a truth assignment S that satisfies F.

Case 2: (If) Part Assume T satisfies E. Let T1 be T restricted to the variables of E1. Let T2 be T restricted to the variables of E2. Since E = E1  E2, either T satisfies E1 or T satisfies E2. Let us assume T satisfies E1. then T1 which is T restricted to the variables of E1, can be extended to S1, which is satisfies F1.

Case 2: If Part Construct an extension S for T, S will satisfy the expression F as follows: for all variables x in F1, S(x) = S1(x). S(y) = 0 , this makes all the clauses of F that are derived from F2 true. For all variables x that are in F2 but not in F1, S(x) can be either 0 or 1. S makes all the clauses derived from the g’s true because the rule 1. S makes all the clauses derived from the h’s true by rule 2. S satisfies F.

Case 2: (Only-If) Part Suppose that truth assignment T for E is extended to truth assignment S for F and S satisfies F. T satisfies E whenever S satisfies F.

NP-Completeness of 3SAT The problem 3SAT is: Given a boolean expression E that is the product of clauses, each of which is the sum of three distinct literals, is E satisfiable?

Theorem 10.15 3SAT is NP-Complete Proof: 3SAT is in NP, since SAT is NP To prove NP-Completeness we shell Reduce CSAT to 3SAT.

PROOF Given a CNF expression E = e1  …  ek, replace each clause ei to create a new expression F If ei is a single literal (x), we introduce new variables u and v. Replace (x) by the four clauses: (x+u+v)(x+u+ ¬v)(x+¬u+v)(x+¬u+¬v) If ei is the sum of two literals, (x+y). Introduce new variable z. Replace (x+y) by the product of to clauses: (x+y+z)(x+y+¬z) If ei is the sum of 3 literals, already in the form required. If ei = (x1+x2+…+xm) for some m ≥ 4, introduce new variables y1, y2, …, ym-3. then replace ei by the product of clauses. (x1+x2+y1)(x3+¬y1+y2)(x4+¬y2+y3)…(xm-2+¬ym-4+ym-3)(xm-1+xm+ym-3)

continue Thus, each instance of E of CSAT can be reduced to an instance of F of 3SAT such that F is satisfiable if and only if E is satisfiable. Construction time is linear in length of E. Since CSAT is NP-Complete, 3SAT is NP-complete.

Reference John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation

Questions How we can reduce the SAT to the CSAT? We push all ¬’s down the expression tree. Write the Boolean expressions in CNF form. Show how to convert ¬((¬(x + y))(¬x + y)) to CNF form ¬((¬(x + y))(¬x + y)) ¬(¬(x + y))+¬(¬x + y) x + y + ¬(¬x + y) x + y + (¬(¬x)) ¬y x + y + x ¬y