CS 3240: Languages and Computation - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

CS 3240: Languages and Computation

Description:

Proof of Cook-Levin theorem. First show that SAT is in NP. Easy ... If the Boolean expression in the proof of the Cook-Levin theorem can evaluate to TRUE then ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 23
Provided by: ble87
Category:

less

Transcript and Presenter's Notes

Title: CS 3240: Languages and Computation


1
CS 3240 Languages and Computation
  • NP-Completeness
  • Overview of PSPACE

2
NP-completeness
  • A problem C is NP-complete if finding a
    polynomial-time solution for C would imply PNP
  • Definition A language B is NP-complete if it
    satisfies two conditions
  • B is in NP, and
  • Every A in NP is polynomial time reducible to B

3
An NP-complete problem
  • A formula is Boolean if each of its variables can
    be assigned the values TRUE (1) or FALSE (0)
  • A Boolean formula is satisfiable if there is some
    assignment of values that results in the formula
    evaluating to TRUE
  • SAT Is a given Boolean formula satisfiable?
  • SAT is NP-complete

4
Examples
  • (x ? y) ? (? x ? y)
  • Satisfiable e.g., x y 1
  • ((x?y) ? (?x?z)) ? ((?x?y) ? (?y?z))
  • Satisfiable e.g., x 0, y z 1
  • ((x?y) ? (?x??z)) ? ((x??y) ? (?y?z))
  • Unsatisfiable

5
Cook-Levin theorem
  • SAT ltBgtB is a satisfiable Boolean expression
  • Theorem SAT is NP-complete
  • If SAT can be solved in polynomial time then any
    problem in NP can be solved in polynomial time

6
Proof of Cook-Levin theorem
  • First show that SAT is in NP
  • Easy
  • The show that SAT ? P implies P NP
  • Proof converts a non-deterministic Turing machine
    M with input w into a Boolean expression f
  • M accepts string w iff f is satisfiable
  • ltM,wgt is converted into f in polynomial time

7
Variables in proof of Cook-Levin Theorem
  • Ti,j,s is true if tape position i contains symbol
    s at step j of computation
  • O(p(n)2) variables
  • Hi,k is true if Ms tape head is at position i at
    step k of computation
  • O(p(n)2) variables
  • Qq,k is true if M is in state q at step k of the
    computation
  • O(p(n)) variables

8
Boolean expression
  • Using the variables Ti,j,k, Hi,k, and Qq,k, Cook
    Levin developed a Boolean expression that is
    satisfiable if and only if M accepts w
  • Expression reflects proper behavior of M
  • Qstart,0 ensures starts in start state
  • H0,0 ensures starts with tape head at start of
    tape
  • Ti,j,k ? ?Ti,j,k ensures one symbol per tape
    cell
  • Etc

9
Purpose of Boolean expression
  • If the Boolean expression in the proof of the
    Cook-Levin theorem can evaluate to TRUE then
  • Starting at the start state with w on the tape, M
    can take steps based on the transition function
    and end at the accept state
  • I.e., M accepts w
  • If the Boolean expression is unsatisfiable, then
    M rejects w

10
Length of Boolean expression
  • O((log p(n)) p(n)2)
  • Since p(n) is polynomial in the length of the
    input, so is the Boolean expression
  • If the satisfiability of the expression can be
    determined in polynomial time, we can determine
    in polynomial time whether M accepts or rejects w
  • Every problem in NP would be in P if SAT is in P

11
Another NP-complete problem
  • 3SAT
  • The Boolean expression must be in a specific form
    called 3-cnf
  • Conjunctive normal form
  • A literal is a Boolean variable or the negation
    of a Boolean variable
  • A clause is the disjunction (OR) of literals
  • A Boolean formula is in cnf if it is the
    conjunction (AND) of clauses
  • It is 3-cnf if all the clauses have 3 literals

12
Importance of Cook-Levin theorem
  • Cook Levin proved that SAT is NP-complete
  • If SAT can be solved in polynomial time, then any
    problem in NP can be solved in polynomial time
  • The showed that any problem in NP can be
    polynomially reduced to the SAT problem
  • The proof that 3SAT is NP-complete is similar
  • Generate a 3-cnf formula from a TM

13
Proving a problem is NP-complete
  • A problem C is NP-complete if finding a
    polynomial-time solution for C would imply PNP
  • If a polynomial-time solution is found for C,
    then that solution can be used to find a
    polynomial-time solution for any other problem in
    NP
  • What does this remind you of?
  • Reductions!

14
Polynomial reductions
  • Definition Language A is polynomial-time
    reducible to language B, written A P B, if a
    polynomial time computable function fS?S
    exists, where for every w
  • w ? A iff f(w) ? B

15
Reductions NP-completeness
  • Theorem If A P B and B?P, then A?P.
  • Proof Let M be the polynomial time algorithm
    that decides B and let f be the polynomial
    reduction from A to B. Consider the TM N
  • N On input w
  • Compute f(w)
  • Run M on f(w) and output Ms result
  • Then N decides A in polynomial time.

16
Implications of NP-completeness
  • Theorem If B is NP-complete and B?P, then P
    NP.
  • Theorem If B is NP-complete and BPC for some C
    in NP, then C is NP-complete

17
Showing a problem in NP-complete
  • Two steps to proving a problem L is NP-complete
  • Show the problem is in NP
  • Demonstrate there is a polynomial time verifier
    for the problem
  • Show some NP-complete problem can be polynomially
    reduced to L

18
Space Complexity
  • The space requirements of a computation are
    another important resource that we should be
    concerned about.
  • It will turn out that space behaves much nicer
    than time.
  • Space, unlike time, can be reused.

19
Space Complexity Classes
Definition Let fN?N be a function. The space
complexity classes SPACE(f(n)) and NSPACE(f(n))
are the following sets of languages SPACE(f(n))
L there is a TM that decides the
language L in space O(f(n))
NSPACE(f(n)) L there is a
nondeterministic
TM that decides the
language L in space O(f(n))
20
Savitchs Theorem
Theorem For any function fN?N with f(n)?nwe
have NSPACE(f(n)) ? SPACE((f(n))2). In other
words Nondeterminism does not give you much
extra for space complexity classes. Compare this
with our (lack of) understanding ofthe time
complexity classes TIME and NTIME.
21
PSPACE
Definition 8.6 The class of languages that
canbe decided by a single tape TM in
polynomialspace is denoted by PSPACE
Savitchs theorem tells us that
nondeterminismdoesnt matter for this class
PSPACENPSPACE.
22
A Hierarchy of Classes
EXPTIME
PSPACE
NP
P
P ? NP ? PSPACENPSPACE ? EXPTIME
We dont know how to prove P?PSPACEor
NP?EXPTIME. But we do know P?EXPTIME
Write a Comment
User Comments (0)
About PowerShow.com