1 / 41

10.3 - Restricted Satisfiability (SAT) Problem

10.3 - Restricted Satisfiability (SAT) Problem. 2/19/07. Two Variations of SAT. 3SAT a set of problems similar to SAT but the Boolean expressions have a regular form: the logical AND of “clauses”, where each clause is the OR of three variables (could be negated variables) CSAT

vanna
Télécharger la présentation

10.3 - Restricted Satisfiability (SAT) Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 10.3 - Restricted Satisfiability (SAT) Problem 2/19/07

  2. Two Variations of SAT • 3SAT • a set of problems similar to SAT but the Boolean expressions have a regular form: the logical AND of “clauses”, where each clause is the OR of three variables (could be negated variables) • CSAT • an intermediate step that is used to show that SAT can be reduced to 3SAT

  3. Purpose of Section 10.3 • To reduce SAT to 3SAT • This can be accomplished by converting each Boolean expression E in SAT to a new Boolean expression F in 3SAT • Hence, F is satisfiable iff E is satisfiable

  4. Important Concepts • Literal - a variable (could be negated) • Clause - logical OR of one or more literals • CNF - Conjunctive Normal Form, logical AND of clauses • Equivalent Boolean Expressions - two Boolean expressions have the same result on any truth assignment to their variables

  5. Notation for CNF • OR () = Sum (+) • AND () = Product (* or juxtaposition) • Not = ¬ • Juxtaposition: no operator

  6. Example • Expression: (x  ¬y)  (¬x  z) • CNF Notation: (x + ¬y)(¬x + z)

  7. k-CNF • k-Conjunctive Normal Form: an expression that contains a product of clauses. Each clause is the sum of exactly k distinct literals

  8. Example: 2-CNF • (x + ¬y)(y + ¬z)(z + ¬x) • Why is it 2-CNF? • Each of the clauses has exactly two literals

  9. CSAT and kSAT • CSAT is a Boolean expression in CNF that is satisfiable • kSAT is a Boolean expression in k-CNF that is satisfiable

  10. CSAT as a Decision Problem • CSAT is the problem: • Given a Boolean expression in CNF, is it satisfiable? • Note: we can also write kSAT as a decision problem: • Given a Boolean expression in k-CNF, is it satisfiable?

  11. NP-Complete? • CSAT, 3SAT, and kSAT for all k higher than 3 are NP-Complete • 1SAT and 2SAT have linear-time algorithms

  12. Reduction of SAT to CSAT • Done in two parts: • Part 1: “Push” the negations through the Boolean expression so that variables are the only thing with negations • With good data structure design takes linear time • Part 2: Write the Boolean expressions in CNF form • Done by introducing new variables • Takes polynomial time

  13. Helpful Rules for Part 1: • ¬(E  F) => ¬(E)  ¬(F) • One of DeMorgan’s Laws • ¬(E  F) => ¬(E)  ¬(F) • Another one of DeMorgan’s Laws • ¬(¬E)) => E • Law of Double Negation

  14. Example

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

  16. Proof for Theorem 10.12 • Done using Induction • Accomplished by showing that for expression E there is an equivalent expression F with ¬’s only in literals • Also, must show that if E has n>=1 operators, then F has no more than 2n-1 operators

  17. Length of F • F does not have more than 1 pair of parentheses per operator • The number of variables in an expression cannot exceed the number of operators by more than 1 • The length of F is linearly proportional to the length of E • Also, the construction of F is simple and the time to construct F is proportional to the length

  18. Basis: • E has one operator • Possible forms (for variables x, y) • ¬x • x  y • x  y • E is already in the correct form! • Therefore, E = F • Also note: F has at most twice the number of operators as E minus 1 holds

  19. Induction: • Assume true  expressions w/fewer terms than E • E must be in form: • E1 E2 • E1 E2 • There are equivalent F1 and F2 • E1 has a operators, E2 has b operators •  E has a + b + 1 operators

  20. Induction (continued) • F is formed using F1 and F2 • F = F1 F2 • F = F1 F2 • F1 has at most 2a-1 operators, F2 has 2b-1 operators •  F has at most 2a + 2b -1 operators • F has no more than 2(a+b+1)-1 operators • i.e., F has no more than twice the number of operators of E minus 1

  21. Induction (continued) • E is of the form ¬E1 • There are three cases: • E1 = ¬E2 • E1 = E2 E3 • E1 = E2 E3

  22. Case 1: E1 = ¬E2 • By the law of double negation, E = E2. • E2 has fewer operators than E • There is an F for E2 that have ¬’s only in literals • The number of operators of F is at most twice the number in E2 minus 1 (and the same is true for E)

  23. Case 2: E1 = E2 E3 • By DeMorgan’s Law: • E= ¬(E2 E3) = ¬E2 ¬E3 • ¬E2 and ¬E1 have fewer operators than E • There is F2 and F3 that have ¬’s only in literal • F = F2 F3 = E • ¬E2has a+1 operators, ¬E3 has b+1 operators • 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, • (i.e., twice the number of operators of E minus 1)

  24. Case 3: E1 = E2 E3 • Done using same argument as E1 = E2 E3

  25. Theorem 10.13 • CSAT is NP-Complete • Proof: • Reduce SAT to CSAT in polynomial time • Convert an instance of SAT into expression E using Theorem 10.12 • Convert E to CNF expression F in polynomial time • Show that F is satisfiable iff E is satisfiable

  26. Basis: • If E consists of 1 or 2 symbols, then it is a literal. • A literal is a clause, therefore E is already in CNF

  27. Induction: • Assume: • Every expression shorter than E can be converted to a product of clauses • Conversion takes at most cn2 time on expressions of length n • There are two cases: • E = E1 E2 • E = E1 E2

  28. Case 1: E = E1 E2 • By the inductive hypothesis: • All and only the satisfying assignments of • E1 can be extended to a satisfying assignment for F1 • E2 can be extended to a satisfying assignment for F2 • Assume: F1 and F2 are distinct variables • Let F = F1 F2 where: • F1 F2 is a CNF expression if F1and F2 are CNF expressions • Need to show: Truth assignment T for E can be extended to a satisfying assignment for F iff T satisfies E

  29. Case 1: If Part • Suppose: T satisfies E • Let: T1 be T restricted to apply to only variables in E1 • Let: T2 be T restricted to apply to only variables in E2 • T1 and T2 can be extended to assignments S1 and S2 that satisfy F1 and F2 • Let S agree with S1 and S2 • S is an extension of T that satisfies F!

  30. Case 1: Only-If Part • Suppose: T has extension S that satisfies F • Let: T1 be T restricted to apply to only variables in E1 • Let: T2 be T restricted to apply to only variables in 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 • F = F1 F2, then S1 satisfies F1 and S2 satisfies F2 • T1 must satisfy E1 and T2 must satisfy E2 => T satisfies E!

  31. Case 2: E = E1 E2 • By the inductive hypothesis: CNF expressions F1 and F2 have the properties: • A truth assignment for E1 satisfies E1 iff it can extended to a satisfying assignment for F1 • A truth assignment for E2 satisfies E2 iff it can extended to a satisfying assignment for F2 • F1 and F2 are disjoint except for those variables that appear in E • F1 and F2 are in CNF • Note: A simple OR of F1 and F2 to construct F would not result in an expression in CNF. • A more complicated construction will be needed

  32. Case 2: Continued • Suppose: (where gi and hi are clauses) • F1 = g1 g2  …  gp • F2 = h1 h2  …  hp • Let: (where y is a new variable) • F = (y+g1) * (y+g2) *… * (y+gp) * (¬y+h1) * (¬y+h2) *… * (¬y+hq) • Show: A truth assignment T for E satisfies E iff T can be extended to a truth assignment S that satisfies F

  33. Case 2: Only-If Part • Assume: T satisfies E • Let: T1 be T restricted to apply to only variables in E1 • Let: T2 be T restricted to apply to only variables in E2 • E = E1 E2 then either: • T satisfies E1 or T satisfies E2 • W.L.O.G Assume: T satisfies E1 • T1 can be extended to S1 which satisfies F1

  34. Case 2: Only-If Part Cont. • Construct S for T • Rules for S will satisfy F •  variables x in F, S(x) = S1(x) • S(y) = 0 (i.e., all clauses of F derived from F2 true) •  variables x in F2 but not in F1, S(x) is T(x) if T(x) is defined (otherwise either 0 or 1) • S makes all clauses derived from the g’s true by Rule 1 • S makes all clauses derived from the h’s true by Rule 2 • S satisfies F!

  35. Case 2: If Part • Suppose: Truth assignment T for E is extended to truth assignment S for F and S satisfies F • T satisfies E whenever S satisfies F • Show: Time to construct F from E is at most quadratic in n (where n is the length of E)

  36. Case 2: If Part Cont. • Takes linear (in size of E) time to: • Splitting E into E1 and E2 • Constructing F from F1 and F2 • Let: • dn = upper bound on time to construct E1 and E2 plus construction of F • n = the length of E

  37. Case 2: If Part Cont. • T(n): (a recurrence equation) time to construct F from any E • T(1) = T(2) ≤ e (for some constant e) • T(n) ≤ dn + cmax0<i<n-1(T(i)+T(n-1-i)) • For n≥3 where c is a constant such that it can be shown that T(n) ≤ cn2 • T(1) & T(2): If E has 1 or 2 symbols, no recursion and process takes time e • Otherwise, conversion from E to F is: • E to E1 and E2, F to F1 and F2 => takes dn • 2 recursive conversions: E1 to F1 and E2 to F2

  38. Case 2: If Part Cont. • There is a constant c such that for all n, T(n) ≤ cn2 • Thus, the construction of F from E takes O(n2)!

  39. Theorem 10.15 • 3SAT is NP-Complete • Proof: • 3SAT is NP since SAT is NP • Reduce CSAT to 3SAT

  40. Proof: • Given a CNF expression E = e1…  ek, replace each clause ei to create a new expression F • ei = (x), introduce new variables u and v • Replace with (x+u+v)(x+u+ ¬v)(x+¬u+v)(x+¬u+¬v) • ei = (x+y), introduce new variable z • Replace with (x+y+z)(x+y+¬z) • ei = sum of 3 literals, no replacement needed • ei = (x1+…+xm) for some m>=4, introduce new variables y1, …, ym-3 • Replace with (x1+x2+y1)(x3+¬y1+y2)(x4+¬y2+y3)…(xm-2+¬ym-4+ym-3)(xm-1+xm+ym-3)

  41. Proof Cont. • Thus, each instance of E of CSAT can be reduced to an instance of F of 3SAT such that F is satisfiable iff E is satisfiable • Construction time is linear in length of E • Since CSAT is NP-Complete, 3SAT is NP-complete!

More Related