Cooks Theorem 1 Cook showed that SATISFIABILITY is NP-complete. The - - PDF document

cook s theorem
SMART_READER_LITE
LIVE PREVIEW

Cooks Theorem 1 Cook showed that SATISFIABILITY is NP-complete. The - - PDF document

The Theory of NP-Completeness Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter before attending this lecture.


slide-1
SLIDE 1

The Theory of NP-Completeness ∗

Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu

  • Please read the corresponding chapter before attending this lecture.
  • These notes are not intended to be complete. They are supplemented

with figures, and material that arises during the lecture period in response to questions.

∗Based on Computers and Intractability, Michael R. Garey and David S. Johnson, Freeman, 1979.

1

slide-2
SLIDE 2

1

Cook’s Theorem

Cook showed that SATISFIABILITY is NP-complete. The terms used to specify it are defined as follows: Let U = {u1, u2, . . . , um} be a set of Boolean variables. A truth assignment for U is a function t : U → {T, F}. If t(u) = T, we say that u is “true” under t; if t(u) = F, we say that u is “false.” If u is a variable in U, then u and u are literals over U. The literal u is true under t ⇐ ⇒ the variable u is true under t; the literal u is true under t ⇐ ⇒ the variable u is false. A clause over U is a set of literals over U, such as {u1, u3, u8}. It represents the disjunction of those literals and is satisfied by a truth assignment ⇐ ⇒ at least 1 of its members is true under that assignment. The clause above is satisfied by t unless t(u1) = F, t(u3) = T, and t(u8) + F.

2

slide-3
SLIDE 3

A collection C of clauses over U is satisfiable ⇐ ⇒ ∃ some truth assignment for U that satisfies all C’s clauses. Such a truth assignment is called a satisfying truth assignment for C. The SATISFIABILITY problem is specified as follows. For example, U = {u1, u2} and C = {{u1, u2}, {u1, u2}} provide an instance of SAT for which the answer is “Yes”. What is a satisfying assignment? OTOH, replacing C by C′ = {{u1, u2}, {u1, u2}, {u1}} yields an in- stance for which the answer is “no.” SATISFIABILITY INSTANCE: A set U of variables and a collection C of clauses over U. QUESTION: Is there a satisfying truth assignment for C? THEOREM (Cook’s Theorem): SATISFIABILITY is NP-complete. PROOF:

3

slide-4
SLIDE 4

SAT is NP-easy: It is easy to see that, given a truth assignment, it can be verified in polynomial time in the size of the problem instance ( O(|U| + |C|) ) whether or not C is satisfied under that assignment. SAT is NP-hard: Let LSAT denote the language of “yes” instances of SAT. We must show: ∀ L ∈ NP, L ∝ LSAT. We use a machine-based proof of this: ∀L ∈ NP, ∃ an NDTM, M, that recognizes L in polynomial time. We show that ∀x, input to M, there exists an instance of SAT that is “yes” ⇐ ⇒ M accepts x. Let M denote an arbitrary polynomial-time NDTM specified by: Γ, Σ, b, Q, q0, qY , qN, and δ. Let LM denote the language accepted by M.

4

slide-5
SLIDE 5

Let p(n) be a polynomial over the integers that bounds the number of steps that M takes in input of size n (i.e., the worst case over all inputs

  • f size n).

Assume wlog that p(n) ≥ n, ∀n ∈ Z+. We describe a generic polynomial transformation fL, that depends on L. The polynomial transformation fL is described in terms of M’s param- eters, and p(n), the polynomial time bound. Our goal is to give fL the property: ∀ x ∈ Σ∗, x ∈ L ⇐ ⇒ fL(x) is satisfiable. If x ∈ Σ∗, there exists an accepting computation for M on x such that the number of steps is bounded by p(|x|). Such a computation cannot involve any tape cells outside the interval [−p(|x|), p(|x|)]. Draw this.

5

slide-6
SLIDE 6

The state of M’s checking computation, at any time step in [0, p(|x|)], can be characterized by:

  • the contents of the relevant part of the tape
  • M’s state
  • the position of the read-write head.

The variables U that fL constructs are related to this characterization: Label the elements of Q as q0, q1 = qY , q2 = qN, q3, . . . , qr, where r = |Q| − 1. Label the elements of Γ as s0 = b, s1, s2, . . . , sv, where v = |Γ| − 1. We define the elements of U below, where by “at time i,” we mean “at the completion of the ith step of the checking computation.” n = |x|.

6

slide-7
SLIDE 7

Variable Range Intended meaning Q[i, k] 0 ≤ i ≤ p(n) At time i, M is in state qk. 0 ≤ k ≤ r H[i, j] 0 ≤ i ≤ p(n) At time i, the read-write head −p(n) ≤ j ≤ p(n) + 1 is scanning tape cell j. S[i, j, k] 0 ≤ i ≤ p(n) At time i, the contents of tape −p(n) ≤ j ≤ p(n) + 1 cell j is symbol sk. 0 ≤ k ≤ v Illustrate these with a machine drawing. If M halts before time step p(n), the halting configuration is propagated to all later times up to time step p(n). The tape contents consists of the input, x, in cells 1 - n. The guess, w, is in cells -1 - −|w|.

7

slide-8
SLIDE 8

All other squares initially are blank. We will show that the transformation fL constructs a collection of clauses that are satisfiable ⇐ ⇒ x is accepted by the NDTM M whose checking stage has at most p(n) steps and whose guessed string has length at most p(n): x ∈ L ⇐ ⇒ M accepts x ⇐ ⇒ M accepts x with at most p(n) steps in its checking stage and with a guessed string w of length at most p(n) ⇐ ⇒ the constructed collection of clauses is satisfiable. After this is shown, we need only show that the transformation can be constructed in an amount of time that is polynomial in n, the size of the input. We proceed to give the construction of the clauses, and argue that they

8

slide-9
SLIDE 9

are satisfiable ⇐ ⇒ x is accepted by M. There are 6 clause groups, whose purpose is described below.

9

slide-10
SLIDE 10

Clause group Restriction imposed G1 At step i, M is in exactly 1 state. G2 At step i, the read-write head is scanning exactly 1 cell. G3 At step i, each tape cell has exactly 1 symbol from Γ. G4 At step 0, the computation is in the initial configuration of its checking state for input x. G5 By step p(n), M is in qY , accepting x. G6 For each step i, 0 ≤ i < p(n), the configuration

  • f M at time i + 1 follows by a single

application of the transition function delta from the configuration at time i.

10

slide-11
SLIDE 11

Group G1

Group G1 consists of the following clauses: {Q[i, 0], Q[i, 1], . . . , Q[i, r]}, 0 ≤ i ≤ p(n) {Q[i, j], Q[i, j′]}, 0 ≤ i ≤ p(n), 0 ≤ j < j′ ≤ r The 1st p(n) + 1 of these clauses ensures that, for each step, M is in at least 1 state. The remaining clauses ensure that, for each step, M is in at most 1 state: Q[i, j] or Q[i, j′] is false ⇐ ⇒ at time i, M is in state j and is in state j′, for some j′ = j. Thus, G1 ensures that, at step i, M is in exactly 1 state.

11

slide-12
SLIDE 12

Group G2

Group G2 consists of the following clauses: {H[i, −p(n)], H[i, −p(n) + 1], . . . , H[i, p(n) + 1]}, 0 ≤ i ≤ p(n) {H[i, j], H[i, j′]}, 0 ≤ i ≤ p(n), −p(n) ≤ j < j′ ≤ p(n) + 1 The 1st p(n) + 1 of these clauses ensures that, for each step, M is scanning at least 1 cell. The remaining clauses ensure that, for each step, M is scanning at most 1 cell. Thus, G2 ensures that, at step i, the read-write head is scanning exactly 1 tape cell.

12

slide-13
SLIDE 13

Group G3

Group G3 consists of the following clauses: {S[i, j, 0], S[i, j, 1], . . . , S[i, j, v]}, 0 ≤ i ≤ p(n), −p(n) ≤ j ≤ p(n) + 1 {S[i, j, k], S[i, j, k′]}, 0 ≤ i ≤ p(n), −p(n) ≤ j ≤ p(n) + 1, 0 ≤ k < k′ ≤ v The 1st p(n) + 1 of these clauses ensures that, for each step, tape cell j has at least 1 symbol from Γ. The remaining clauses ensure that, for each step, tape cell j has at most 1 symbol from Γ. Thus, G3 ensures that, at step i, each tape cell has exactly 1 symbol from Γ.

13

slide-14
SLIDE 14

Group G4

Group G4 consists of the following clauses: {Q[0, 0], H[0, 1], S[0, 0, b]}, {S[0, 1, k1], S[0, 1, k2], . . . , S[0, 1, kn], }, {S[0, n + 1, 0], S[0, n + 2, 0], . . . , S[0, p(n) + 1, 0], }, where x = sk1sk2 · · · skn Note: In the initial configuration, tape cell 0 is blank; the guessed word, w, is in [−|w|, −1]. Thus, G4 ensures that, at step 0, the computation is in the initial configuration of its checking state for input x.

14

slide-15
SLIDE 15

Group G5

Group G5 consists of the following clause: {Q[p(n), qY ]} Thus, G5 ensures that, by step p(n), M is in qY , accepting x.

Group G6

The final group of clauses ensures that each successive configuration in the computation follows from the previous one by a single, legal step. This group consists of 2 subgroups of clauses.

The first subgroup G6

The 1st subgroup guarantees that if the read-write head is not scanning tape cell j at time i, then the symbol in cell j does not change between

15

slide-16
SLIDE 16

times i and i + 1. This 1st subgroup consists of the following clauses: {S[i, j, l], H[i, j], S[i + 1, j, l]}, 0 ≤ i < p(n), −p(n) ≤ j ≤ p(n) + 1, 0 ≤ l ≤ If the read-write head is NOT scanning cell j AND cell j has sl at time i AND it does NOT have it at time i+1, then the clause is false. Otherwise, it is true. That is, if H[i, j] (i.e., at time i, the read-write head is not scanning tape cell i) AND S[i, j, l], then we must have S[i + 1, j, l]. Thus, this subgroup of 2(p(n)+1)2(v+1) clauses perform their mission.

The last subgroup G6

The last subgroup of this last group guarantees that the changes from one configuration to the next are in accord with the transition function, δ, for

16

slide-17
SLIDE 17

M. In what follows, assume that the transition function, δ is such that: δ(qk, sl) = (qk′, sl′, ∆), where ∆ is either -1 or +1, when qk ∈ Q − {qY , qN}. (We are using the fact that nondeterminism was confined to the NDTM’s guessing stage.) When qk ∈ {qY , qN}, assume that ∆ = 0, k′ = k, and l′ = l in the transition described above. This last subgroup then consists of the following 3 clauses: {H[i, j], Q[i, k], S[i, j, l], H[i + 1, j + ∆]} {H[i, j], Q[i, k], S[i, j, l], Q[i + 1, k′]} {H[i, j], Q[i, k], S[i, j, l], S[i + 1, j, l′]}

17

slide-18
SLIDE 18

The 1st of these clauses imposes the following: at time i, if the tape cell scanned is j AND the state is j AND the tape symbol in cell j is sl, then at time i + 1 cell j + ∆ is scanned. These 6p(n)(p(n)+1)(r+1)(v+1) clauses impose the desired restriction

  • n satisfying truth assignments.

Thus, if x ∈ L, then there is an accepting computation of M on x of length ≤ p(n) steps. This computation translates to a truth assignment that satisfies all the clauses in C = G1 ∪ G2 ∪ G3 ∪ G4 ∪ G5 ∪ G6. Conversely, the construction of C is such that any satisfying truth as- signment must correspond to an accepting computation of M on x. Thus, the transformation fL(x) has a satisfying truth assignment ⇐ ⇒ x ∈ L.

18

slide-19
SLIDE 19

Polynomiality

It remains to be shown that the transformation can be constructed in time that is polynomial in n = |x|. Given L, we choose a particular NDTM M that accepts L in time bounded by a polynomial p. (We know such an NDTM exists, since L is assumed to be in NP. That is, this is not a constructive proof for fL.) Given M and p, we can construct U and C. The construction is poly- nomial: The size of the SAT problem can be thought of as |U| · |C|. There are at most 2|U| literals. Each can be described with log|U| + 1 bits. No clause can contain more than 2|U| literals. Since the number of states and the size of Γ do not depend on x, they are constants in this construction. |U| = O(p(n)2) = |C|. Thus, the transformation is O(p(n)4), a poly-

19

slide-20
SLIDE 20

nomial. We conclude that for every L ∈ NP, there is a polynomial transforma- tion from it to SAT: SAT is NP-complete.

20