Cook - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

Cook

Description:

We will create a Boolean expression from the table that is satisfiable if and ... q0w1w2...wn ... Therefore, Initial tape contents w1w2...wn. The Expression ... – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 49
Provided by: robbko
Category:

less

Transcript and Presenter's Notes

Title: Cook


1
Cooks Theorem
  • Lecture 40
  • Section 7.4
  • Mon, Dec 3, 2007

2
Cooks Theorem
  • Cooks Theorem SAT ? P if and only if P NP.
  • Proof idea
  • First show that SAT is in NP.
  • Then show that every problem in NP is
    polynomial-time reducible to SAT.

3
Proof of Cooks Theorem
  • Proof
  • It is easy to see that SAT is in NP.
  • Simply nondeterministically choose Boolean values
    for each variable.
  • Then verify that the expression is true.

4
Proof of Cooks Theorem
  • Let A be a problem in NP.
  • Then there is a nondeterministic Turing machine M
    that decides A in polynomial time.
  • Let the run time of M be nk.
  • When M is run, it can access at most the first nk
    cells.

5
Proof of Cooks Theorem
  • Represent the execution of M by an nk ? nk array.
  • Each row contains a configuration of M.
  • The first row is the initial configuration, with
    input w.
  • The sequence of rows represents a computation of
    M that reaches a halting state.

6
Proof of Cooks Theorem
  • We will place the symbol in the first and last
    cells of each row, to help identify the ends of
    the tape.
  • In each row, each cell between the s will
    contain
  • A tape symbol x, or
  • A state q, or
  • A blank.

7
Proof of Cooks Theorem
  • That is, each cell contains one symbol from the
    set
  • C Q ?? ? ? .
  • We will create a Boolean expression from the
    table that is satisfiable if and only if the
    table represents a valid accepting computation of
    M.

8
Proof of Cooks Theorem
  • Our Boolean expression ? will be of the form
  • ?cell ? ?start ? ?accept ? ?move,
  • where
  • ?cell true if and only if every cell contains
    exactly one symbol.
  • ?start true if and only if row 1 is a valid
    start configuration.
  • ?accept true if and only if one of the rows is
    a valid accept configuration.

9
Proof of Cooks Theorem
  • ?move true if and only if each row yields the
    configuration in the next row.
  • These expressions will all be true if and only if
    the table represents a valid computation
    resulting in acceptance.

10
Proof of Cooks Theorem
  • For each row number i from 1 to nk, and for each
    column number j from 1 to nk, and for each symbol
    s in C, let xi, j, s be a Boolean variable that
    is true if cell (i, j) contains symbol s.

11
Example
  • Consider the Turing machine below processing the
    input 0110.

1 ? 0, R
1 ? 0, R
0 ? 1, R
r accept s reject
p
q
0 ? 1, R
_ ? _, R
_ ? _, R
s
r
12
Example
  • The computation table.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
13
Example
  • For example,
  • x1,1, true
  • x1,1,0 false
  • x1,2,p true
  • x1,3,0 true

14
The Expression ?cell
  • The expression ?cell consists of two parts.
  • The first part is true if and only if cell (i, j)
    contains at least one symbol.

15
The Expression ?cell
  • The second part is true if and only if cell (i,
    j) contains at most one symbol.

16
The Expression ?cell
  • Therefore,

17
The Expression ?cell
  • Therefore,

Every cell
18
The Expression ?cell
  • Therefore,

Every cell contains at least one symbol
19
The Expression ?cell
  • Therefore,

Every cell contains at least one symbol and
20
The Expression ?cell
  • Therefore,

Every cell contains at least one symbol
and contains at most one symbol.
21
The Expression ?cell
  • Therefore,

Every cell contains exactly one symbol.
22
The Expression ?start
  • The expression ?start is easy because we know
    what the start configuration looks like.
  • q0w1w2wn _ _ _..._
  • We simply verify that the cells contain those
    symbols.

23
The Expression ?start
  • Therefore,

24
The Expression ?start
  • Therefore,

Start state
25
The Expression ?start
  • Therefore,

Initial tape contents w1w2wn
26
The Expression ?accept
  • The expression ?accept is also very simple.
  • All we need to do is to guarantee that qacc
    occurs somewhere in the table.

27
The Expression ?accept
  • Therefore,

28
The Expression ?move
  • The expression ?move will take a bit more effort.
  • We will consider 2 ? 3 windows in the table.
  • Theorem The table represents a valid computation
    if and only if ?cell and ?start are true and
    every 2 ? 3 window is valid.

29
Example
  • The computation table.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
30
Example
  • Various 2 x 3 windows.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
31
Example
  • Various 2 x 3 windows.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
32
Example
  • Various 2 x 3 windows.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
33
Example
  • Various 2 x 3 windows.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
34
Example
  • Various 2 x 3 windows.

p 0 1 1 0 _ _ _
1 q 1 1 0 _ _ _
1 0 q 1 0 _ _ _
1 0 0 q 0 _ _ _
1 0 0 1 p _ _ _
1 0 0 1 _ r _ _
35
The Expression ?move
  • For any symbol x and any state q, the legal moves
    are
  • Write x, move left, and change state to q.
  • Write x, move right, and change state to q.
  • Recall that if we try to move left from the first
    cell, we remain in the first cell.

36
The Expression ?move
  • Valid 2 ? 3 windows for moving left (states p, q
    symbols a, b, c, x).

p a b
c x b
a p b
q a x
a b p
a q b
p a
q x
a b c
a b c
a b c
a b q
a p
q a
a b
a q
a b
a b
37
The Expression ?move
  • There is a similar set for a move to the right.
  • Let S be the set of all sextuples in C6
    representing valid 2 ? 3 windows.
  • Then S includes (p, a, b, c, x, b), (a, p, b, q,
    a, x), etc., for all a, b, c, and x in ?? and for
    all p and q in Q.

38
The Expression ?move
  • Then the expression
  • is true if and only if (x1, x2, x3, x4, x5, x6)
    is a valid sextuple in window (i, j).

39
The Expression ?move
  • So the expression
  • is true if and only if window (i, j) is valid.

40
The Expression ?move
  • Then the expression
  • is true if and only if every 2 ? 3 window in the
    table is valid.

41
Proof of Cooks Theorem
  • Then the Boolean expression
  • ?cell ? ?start ? ?accept ? ?move
  • is satisfiable if and only if w is accepted by
    M.
  • Therefore, SAT is NP-complete.

42
Building from Cooks Theorem
  • Now we may show that other problems are
    NP-complete by showing that SAT is
    polynomial-time reducible to them.

43
3SAT is NP-Complete
  • Theorem 3SAT is NP-complete.
  • Proof
  • We need only show that SAT is polynomial-time
    reducible to 3SAT.
  • Any boolean expression may be put into
    3-conjunctive normal form by the following
    technique.

44
3SAT is NP-Complete
  • Rewrite the each clause
  • x1 ? x2 ? x3 ? ? xn
  • as
  • (x1 ? x2 ? y1) ? (?y1 ? x3 ? y2) ? ? ? (?yn 3 ?
    xn 1 ? ?xn).

45
3SAT is NP-Complete
  • The expressions??cell, ??start, and ??accept are
    already in conjunctive normal form.
  • Apply the above technique to put them in
    3-conjunctive normal form.
  • The expression ??move is not in conjunctive
    normal form.

46
3SAT is NP-Complete
  • However, it may be rewritten in conjunctive
    normal form by repeatedly applying the
    distributive laws
  • x ? (y ? z) (x ? y) ? (x ? z)
  • and
  • x ? (y ? z) (x ? y) ? (x ? z).

47
3SAT is NP-Complete
  • For example,
  • (x ? y) ? (z ? w)
  • ((x ? y) ? z) ? ((x ? y) ? w)
  • ((x ? z) ? (y ? z)) ? ((x ? w) ? (y ? w))
  • (x ? z) ? (y ? z) ? (x ? w) ? (y ? w).

48
3SAT is NP-Complete
  • Therefore, the expression
  • ?cell ? ?start ? ?accept ? ?move
  • can be rewritten in 3-conjunctive normal form.
  • Therefore, 3SAT is NP-complete.
Write a Comment
User Comments (0)
About PowerShow.com