28
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff r(x) 2 L 2 L is NP-hard means: 8 L’ 2 NP: L’ · L L is in NPC means: L 2 NP and L is NP-hard

1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

1

• L is in NP means:

There is a language L’ in P and a polynomial p so that

• L1 · L2 means:

For some polynomial time computable map r :

8 x: x 2 L1 iff r(x) 2 L2

• L is NP-hard means:

8 L’ 2 NP: L’ · L

• L is in NPC means:

L 2 NP and L is NP-hard

Page 2: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

2

Polynomial time computable maps

f: {0,1}* ! {0,1}* is called polynomial time computable if for some polynomial p,

- For all x, |f(x)| · p(|x|).

- Lf 2 P.

Page 3: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

3

Equivalent definition

• A map is polynomial time computable if and only if there is a Turing machine that on every input x accepts after at most a polynomial number of steps and leaves f(x) on its tape when terminating.

Page 4: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

4

How to establish NP-hardness

• Lemma: If L1 is NP-hard and L1 · L2 then L2 is NP-hard.

Page 5: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

5

SAT

• SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?

• SAT: Given a CNF, is it true that it does not represent the constant-0 function?

• Input: (: x1 Ç : x2) Æ (x1 Ç x2)• Output: Yes.• Input: (: x1 Ç : x2) Æ (x1 Ç x2) Æ (x1 Ç : x2 ) Æ (: x1 Ç x2)• Output: No.

Page 6: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

6

SAT

• SAT is in NP.

• Cook’s theorem (1971): SAT is NP-hard.

Page 7: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

7

SAT

ILPMILP

MAX INDEPENDENT SET

MIN VERTEX COLORING

HAMILTONIAN CYCLE TSP

TRIPARTITE MATCHING

SET COVER

KNAPSACK

BINPACKING

Page 8: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

8

Usefulness of NPC

• Languages in NPC are the least likely problems in NP to be in P.

• Suppose we would like to find algorithm for L 2 NPC.

• If we believe that P is not NP, we know that no worst case efficient algorithm exists.

• If we have no opinion about P vs. NP, we know that if we find an efficient algorithm for L, we’ll earn $1,000,000.

Page 9: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

9

Cooks’ theorem: SAT is NP-hard

• Proof of Cook’s theorem:– CIRCUIT SAT is NP-hard.– CIRCUIT SAT reduces to SAT.– Hence, SAT is NP-hard.

Page 10: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

10

Boolean Circuits

X1 X2X3

Page 11: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

11

Circuits vs. Turing Machines

• Circuits can be given as inputs to algorithms but they can also be seen as computational devices themselves!

• Like Turing Machines, circuits C: {0,1}n ! {0,1} solve decision problems on {0,1}n.

• Unlike Turing machines, circuits takes inputs of a fixed input length n only.

Page 12: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

12

Theorem

• Given Turing Machine M running in time at most p(n) on inputs of length n, where p is a polynomial.

• For every n, there is a circuit Cn with at most O(p(n)2) gates so that

8 x 2 {0,1}n: Cn(x)=1 iff M accepts x.

• The map 1n ! Cn is polynomial time computable.

Page 13: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

13

Remark

• This is really just like the Polynomial Turing’s Thesis, only “in reverse”:

• We show that “a reasonable sequential model of computation” (computation by “uniform” families of circuits) has at least as much power as Turing Machines.

Page 14: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

14

Intuition behind proof

Page 15: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

15

Problem: Cycles!

Flip-Flop, stores one bit.

Page 16: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

16

The Tableau Method

Time 0

Time 1

Time t

1 2 s

Can be replaced byacyclic Booleancircuit of size ≈ s

Page 17: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

17

Cell state vectors

• Given a Turing Machine computation, an integer t and an integer i let cti 2 {0,1}s be a Boolean representation of the following information, a cell state vector:

– The symbol in cell i at time t– Whether or not the head is pointing to cell i at time t– If the head is pointing to cell i, what is the state of the finite control

of the Turing machine at time t?

• The integer s depends only on the Turing machine (not the input to the computation, nor t,i).

• To make cti defined for all t, we let c(t+1)i = ct i if the computation has already terminated at time t.

Page 18: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

18

Crucial Observation

• If we know the Turing machine and ct-1,i-1, ct-1,i, ct-

1, i+1, we also can determine ct,i.

• In other words, there is a Boolean function h depending only on the Turing machine so that ct,i = h(ct-1,i-1, ct-1,i, ct-1,i+1).

• A circuit D for h is the central building block in a circuit computing all cell state vectors for all times for a given input.

Page 19: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

192 t(n)

t(n)

x1 xn

Page 20: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

20

Cooks’ theorem: SAT is NP-hard

• Proof of Cook’s theorem:– CIRCUIT SAT is NP-hard.– CIRCUIT SAT reduces to SAT.– Hence, SAT is NP-hard.

Page 21: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

21

CIRCUIT SAT

• CIRCUIT SAT: Given a Boolean circuit, is there a way to assign truth values to the input gates, so that the output gate evaluates to true?

• Generalizes SAT, as CNFs are formulas and formulas are circuits.

Page 22: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

22

Example

X1 X2

X3

Input:

Output: Yes

Page 23: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

23

Example

X1 X2

X3

Input:

Output: No

Page 24: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

24

CIRCUIT SAT is NP-hard

• Given an arbitrary language L in NP we must show that L reduces to CIRCUIT SAT.

• This means: We must construct a polynomial time computable map r mapping instances of L to circuits, so that

8 x: x 2 L , r(x) 2 CIRCUIT SAT

• The only thing we know about L is that there is a language L’ in P and a polynomial p, so that:

Page 25: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

25

Theorem

• Given Turing Machine M for L’ running in time at most q(n) on inputs of length n, where q is a polynomial.

• For every n, there is a circuit Cn with at most O(q(n)2) gates so that

8 x 2 {0,1}n: Cn(x)=1 iff M accepts x.

• The map 1n ! Cn is polynomial time computable.

Page 26: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

26

Cooks’ theorem: SAT is NP-hard

• Proof of Cook’s theorem:– CIRCUIT SAT is NP-hard.– CIRCUIT SAT reduces to SAT.– Hence, SAT is NP-hard.

Page 27: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

27

SAT

ILPMILP

MAX INDEPENDENT SET

MIN VERTEX COLORING

HAMILTONIAN CYCLE TSP

TRIPARTITE MATCHING

SET COVER

KNAPSACK

BINPACKING

Page 28: 1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff

28

Remarks on Papadimitriou’s terminology

• When Papadimitriou writes “log space reduction”, just substitute “polynomial time reduction”.

• When Papadimitriou writes NL, just substitute P.

• Papadimtriou’s concepts are more restrictive, but the more restrictive definitions will play no role in this course.