computational complexity

127
Computational Complexity Lecture 3 in which we come across Diagonalization and Time-hierarchies (But first some more of NP-completeness) 1

Upload: others

Post on 25-Apr-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational Complexity

Computational Complexity

Lecture 3in which we come across

Diagonalization and Time-hierarchies(But first some more of NP-completeness)

1

Page 2: Computational Complexity

NP-Complete Languages

2

Page 3: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

2

Page 4: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

Trivial example: L1 = TMSAT

2

Page 5: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

Trivial example: L1 = TMSAT

First interesting example: L1 = CKT-SAT

2

Page 6: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

Trivial example: L1 = TMSAT

First interesting example: L1 = CKT-SAT

Convert x into a circuit C s.t. C is satisfiable iff x in L

2

Page 7: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

Trivial example: L1 = TMSAT

First interesting example: L1 = CKT-SAT

Convert x into a circuit C s.t. C is satisfiable iff x in L

More examples, bootstrapping from CKT-SAT

2

Page 8: Computational Complexity

NP-Complete Languages

A language L1 is NP-complete if L1 is in NP and any NP language L can be reduced to L1 (Karp reduction: polynomial time many-one reduction)

Trivial example: L1 = TMSAT

First interesting example: L1 = CKT-SAT

Convert x into a circuit C s.t. C is satisfiable iff x in L

More examples, bootstrapping from CKT-SAT

If L ≤p L1 and L1 ≤p L2, then L ≤p L2

2

Page 9: Computational Complexity

CKT-SAT ≤p SAT

3

Page 10: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

3

Page 11: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

Converting a circuit to a collection of clauses:

3

Page 12: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

Converting a circuit to a collection of clauses:

For each wire (connected component), add a variable

3

Page 13: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

Converting a circuit to a collection of clauses:

For each wire (connected component), add a variable

Add output variable as a clause. And for each gate, add a clause involving variables for wires connected to the gate:

3

Page 14: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

Converting a circuit to a collection of clauses:

For each wire (connected component), add a variable

Add output variable as a clause. And for each gate, add a clause involving variables for wires connected to the gate:

e.g. : (z⇒x), (z⇒y), (¬z ⇒ ¬x ∨ ¬y). i.e., (¬z ∨ x), (¬z ∨ y), (z ∨ ¬x ∨ ¬y).

AND

xy z

3

Page 15: Computational Complexity

CKT-SAT ≤p SATSAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)

Converting a circuit to a collection of clauses:

For each wire (connected component), add a variable

Add output variable as a clause. And for each gate, add a clause involving variables for wires connected to the gate:

e.g. : (z⇒x), (z⇒y), (¬z ⇒ ¬x ∨ ¬y). i.e., (¬z ∨ x), (¬z ∨ y), (z ∨ ¬x ∨ ¬y).

and : (z⇒x ∨ y), (¬z⇒¬x), (¬z⇒¬y).

AND

xy z

OR

xy z

3

Page 16: Computational Complexity

SAT ≤p 3SAT

4

Page 17: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

4

Page 18: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

More directly:

4

Page 19: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

More directly:

(a ∨ b ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ y), (¬y ∨ d ∨ e)

4

Page 20: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

More directly:

(a ∨ b ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ y), (¬y ∨ d ∨ e)

Reduction needs 3SAT

4

Page 21: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

More directly:

(a ∨ b ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ y), (¬y ∨ d ∨ e)

Reduction needs 3SAT

2SAT is in fact in P! [Exercise]

4

Page 22: Computational Complexity

SAT ≤p 3SATPrevious reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.

More directly:

(a ∨ b ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ d ∨ e) → (a ∨ b ∨ x), (¬x ∨ c ∨ y), (¬y ∨ d ∨ e)

Reduction needs 3SAT

2SAT is in fact in P! [Exercise]

Reduction not parsimonious (can you make it? [Exercise])

4

Page 23: Computational Complexity

3SAT ≤p CLIQUE

5

Page 24: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

5

Page 25: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

(x ∨ ¬y ∨ ¬z)

(w ∨ x ∨ ¬z)

(w ∨ y)

5

Page 26: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z)

(w ∨ x ∨ ¬z)

(w ∨ y)

5

Page 27: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z)

(w ∨ x ∨ ¬z)

0*1*1*1*

1*0*

(w ∨ y)

5

Page 28: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z)

(w ∨ x ∨ ¬z)

0*1*1*1*

1*0*

(w ∨ y)

5

Page 29: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)

0*1*1*1*

1*0*

(w ∨ y)

5

Page 30: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)

0*1*1*1*

1*0*

(w ∨ y)

5

Page 31: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 32: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 33: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 34: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 35: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 36: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 37: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 38: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

edges between consistent assignments

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 39: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

edges between consistent assignments

m-clique iff all m clauses satisfiable

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 40: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

edges between consistent assignments

m-clique iff all m clauses satisfiable

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

5

Page 41: Computational Complexity

3SAT ≤p CLIQUECLIQUE: Does graph G have a clique of size m?

Clauses → Graph

vertices: each clause’s satisfying assignments (for its variables)

edges between consistent assignments

m-clique iff all m clauses satisfiable

(x ∨ ¬y ∨ ¬z) *000

*001*010

*100

*101*110

*111

(w ∨ x ∨ ¬z)00*0

01*101*0

10*0

10*111*0

11*1

0*1*1*1*

1*0*

(w ∨ y)

1*1**11011*0----1110sat assignment

3-Clique

5

Page 42: Computational Complexity

INDEP-SET and VERTEX-COVER

6

Page 43: Computational Complexity

INDEP-SET and VERTEX-COVER

CLIQUE ≤p INDEP-SET

6

Page 44: Computational Complexity

INDEP-SET and VERTEX-COVER

CLIQUE ≤p INDEP-SET

G has an m-clique iff Gc has an m-independent-set

6

Page 45: Computational Complexity

INDEP-SET and VERTEX-COVER

CLIQUE ≤p INDEP-SET

G has an m-clique iff Gc has an m-independent-set

INDEP-SET ≤p VERTEX-COVER

6

Page 46: Computational Complexity

INDEP-SET and VERTEX-COVER

CLIQUE ≤p INDEP-SET

G has an m-clique iff Gc has an m-independent-set

INDEP-SET ≤p VERTEX-COVER

G has an m-indep-set iff G has an (n-m)-vertex-cover

6

Page 47: Computational Complexity

NP, P, co-NP and NPC

P

NP coNP

NPC coNPC

7

Page 48: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

P

NP coNP

NPC coNPC

7

Page 49: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

P

NP coNP

NPC coNPC

7

Page 50: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

P

NP coNP

NPC coNPC

7

Page 51: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

If any NPC language is in P, then NP = P

P

NP coNP

NPC coNPC

7

Page 52: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

If any NPC language is in P, then NP = P

If any NPC language is in co-NP, then NP = co-NPP

NP coNP

NPC coNPC

7

Page 53: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

If any NPC language is in P, then NP = P

If any NPC language is in co-NP, then NP = co-NP

Note: X ⊆ co-X ⇒ X = co-X (Why?)P

NP coNP

NPC coNPC

7

Page 54: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

If any NPC language is in P, then NP = P

If any NPC language is in co-NP, then NP = co-NP

Note: X ⊆ co-X ⇒ X = co-X (Why?)

L is NP-complete iff Lc is co-NP-complete (Why?)

P

NP coNP

NPC coNPC

7

Page 55: Computational Complexity

NP, P, co-NP and NPCWe say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X

e.g. P, NP are closed under polynomial reductions

So is co-NP (If X is closed, so is co-X. Why?)

If any NPC language is in P, then NP = P

If any NPC language is in co-NP, then NP = co-NP

Note: X ⊆ co-X ⇒ X = co-X (Why?)

L is NP-complete iff Lc is co-NP-complete (Why?)

co-NP complete = co-(NP-complete)

P

NP coNP

NPC coNPC

7

Page 56: Computational Complexity

Separating Classes

8

Page 57: Computational Complexity

Separating Classes

How to prove a set X strictly bigger than Y

8

Page 58: Computational Complexity

Separating Classes

How to prove a set X strictly bigger than Y

Show an element not in Y, but in X? For us, not in Y may often be difficult to prove for (familiar) elements

8

Page 59: Computational Complexity

Separating Classes

How to prove a set X strictly bigger than Y

Show an element not in Y, but in X? For us, not in Y may often be difficult to prove for (familiar) elements

Count? What if both infinite?!

8

Page 60: Computational Complexity

Separating Classes

How to prove a set X strictly bigger than Y

Show an element not in Y, but in X? For us, not in Y may often be difficult to prove for (familiar) elements

Count? What if both infinite?!

Comparing infinite sets: diagonalization!

8

Page 61: Computational Complexity

Cantor’s Diagonal Slash

9

Page 62: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

9

Page 63: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

9

Page 64: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

Ri

R1 =

R2 =

R3 =

R4 =

R5 =

R6 =

R7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 19

Page 65: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

Consider the real number corresponding to the “flipped diagonal”

Ri

R1 =

R2 =

R3 =

R4 =

R5 =

R6 =

R7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 19

Page 66: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

Consider the real number corresponding to the “flipped diagonal”

Ri

R1 =

R2 =

R3 =

R4 =

R5 =

R6 =

R7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 19

Page 67: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

Consider the real number corresponding to the “flipped diagonal”

Doesn’t appear in this table!

Ri

R1 =

R2 =

R3 =

R4 =

R5 =

R6 =

R7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 19

Page 68: Computational Complexity

Cantor’s Diagonal SlashAre real numbers (say in the range [0,1) ) countable?

Suppose they were: consider enumerating them along with their binary representations in a table

Consider the real number corresponding to the “flipped diagonal”

Doesn’t appear in this table!

Ri

R1 =

R2 =

R3 =

R4 =

R5 =

R6 =

R7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

This table

can’t

have all re

als

9

Page 69: Computational Complexity

Undecidable Languages

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 70: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 71: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors

TMs can be enumerated!

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 72: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors

TMs can be enumerated!

Table of languages recognized by the TMs

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 73: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors

TMs can be enumerated!

Table of languages recognized by the TMs

L = ”diagonal language”

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 74: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors

TMs can be enumerated!

Table of languages recognized by the TMs

L = ”diagonal language”

Lc does not appear as a row in this table. Hence not recognizable!

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 110

Page 75: Computational Complexity

Undecidable LanguagesLanguages, like real numbers, can be represented as infinite bit-vectors

TMs can be enumerated!

Table of languages recognized by the TMs

L = ”diagonal language”

Lc does not appear as a row in this table. Hence not recognizable!

LM1 =

LM2 =

LM3 =

LM4 =

LM5 =

LM6 =

LM7 =

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

This table ca

n’t have

all language

s

10

Page 76: Computational Complexity

Diagonalization to Separate Classes

Diagonalization can separate the class of decidable languages (from the class of all languages)

Plan: Use similar techniques to separate complexity classes

11

Page 77: Computational Complexity

DTIME Hierarchy

12

Page 78: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

12

Page 79: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

DTIME(T) = class of languages that can be decided in O(T(n)) time, by such a TM

12

Page 80: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

DTIME(T) = class of languages that can be decided in O(T(n)) time, by such a TM

Theorem: DTIME(nc) ⊊ DTIME(nc+1) for all c ≥ 1

12

Page 81: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

DTIME(T) = class of languages that can be decided in O(T(n)) time, by such a TM

Theorem: DTIME(nc) ⊊ DTIME(nc+1) for all c ≥ 1

More generally DTIME(T) ⊊ DTIME(T’) if T, T’ “nice” (and ≥ n)

and T(n)log(T(n)) = o(T’(n))

12

Page 82: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

DTIME(T) = class of languages that can be decided in O(T(n)) time, by such a TM

Theorem: DTIME(nc) ⊊ DTIME(nc+1) for all c ≥ 1

More generally DTIME(T) ⊊ DTIME(T’) if T, T’ “nice” (and ≥ n)

and T(n)log(T(n)) = o(T’(n))

Consequences, for e.g., P ⊊ EXP

12

Page 83: Computational Complexity

DTIME HierarchyFix a TM model (one-tape, binary alphabet)

DTIME(T) = class of languages that can be decided in O(T(n)) time, by such a TM

Theorem: DTIME(nc) ⊊ DTIME(nc+1) for all c ≥ 1

More generally DTIME(T) ⊊ DTIME(T’) if T, T’ “nice” (and ≥ n)

and T(n)log(T(n)) = o(T’(n))

Consequences, for e.g., P ⊊ EXP

P ⊆ DTIME(2n) ⊊ DTIME(22n) ⊆ EXP

12

Page 84: Computational Complexity

DTIME Hierarchy: Proof

13

Page 85: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

DTIME Hierarchy: Proof

13

Page 86: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

13

Page 87: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

T’ large and nice enough to allow

simulation

13

Page 88: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 89: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 90: Computational Complexity

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

Let L’ = inverted diagonal.

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 91: Computational Complexity

L’ in DTIME(T’)

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

Let L’ = inverted diagonal.

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 92: Computational Complexity

L’ in DTIME(T’)

On input i, run UTM|T’ (Mi,i), modified to invert output

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

Let L’ = inverted diagonal.

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 93: Computational Complexity

L’ in DTIME(T’)

On input i, run UTM|T’ (Mi,i), modified to invert output

L’ not in DTIME(T)

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

Let L’ = inverted diagonal.

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 94: Computational Complexity

L’ in DTIME(T’)

On input i, run UTM|T’ (Mi,i), modified to invert output

L’ not in DTIME(T)

If M accepts L’ in time T, then for sufficiently large i s.t. Mi=M, UTM can finish simulating Mi(i). Then table(i,i)=L’(i)!

Mi be an enumeration of TMs, each TM appearing infinitely often

Consider table(i,j) = UTM|T’ (Mi,j), where T log T = o(T’)

Let L’ = inverted diagonal.

DTIME Hierarchy: Proof

Mi

1 0 0 1 0 0 0 0 1

0 0 1 0 1 0 0 1 1

1 1 1 1 1 1 1 0 0

1 1 0 1 0 1 0 1 1

1 1 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 0

0 1 0 1 0 1 0 1 1

j

Think DTIME(T) ⊆ rows

T’ large and nice enough to allow

simulation

13

Page 95: Computational Complexity

NTIME Hierarchy

14

Page 96: Computational Complexity

NTIME Hierarchy

Finer hierarchy

14

Page 97: Computational Complexity

NTIME Hierarchy

Finer hierarchy

NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice

14

Page 98: Computational Complexity

NTIME Hierarchy

Finer hierarchy

NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice

Because a more sophisticated Universal NTM has less overhead

14

Page 99: Computational Complexity

NTIME Hierarchy

Finer hierarchy

NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice

Because a more sophisticated Universal NTM has less overhead

Diagonalization is more complicated

14

Page 100: Computational Complexity

NTIME Hierarchy

Finer hierarchy

NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice

Because a more sophisticated Universal NTM has less overhead

Diagonalization is more complicated

Issue: NTIME(T’) enough to simulate NTIME(T), but not to simulate co-NTIME(T)!

14

Page 101: Computational Complexity

NTIME Hierarchy

Finer hierarchy

NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice

Because a more sophisticated Universal NTM has less overhead

Diagonalization is more complicated

Issue: NTIME(T’) enough to simulate NTIME(T), but not to simulate co-NTIME(T)!

In fact,

T(n+1) = o(

T’(n))

14

Page 102: Computational Complexity

NTIME Hierarchy

15

Page 103: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

15

Page 104: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

Think NTIME(T) ⊆ rows15

Page 105: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

Think NTIME(T) ⊆ rows15

Page 106: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Think NTIME(T) ⊆ rows15

Page 107: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

f(1) f(2) f(3) f(4) f(5)

Think NTIME(T) ⊆ rows15

Page 108: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

f(1) f(2) f(3) f(4) f(5)

Think NTIME(T) ⊆ rows15

Page 109: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

f(1) f(2) f(3) f(4) f(5)

L

Think NTIME(T) ⊆ rows15

Page 110: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 111: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 112: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 113: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 114: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 115: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

L’ not in NTIME(T), but is in NTIME(T’)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows15

Page 116: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

L’ not in NTIME(T), but is in NTIME(T’)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows

Flip, Diagonal

15

Page 117: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

L’ not in NTIME(T), but is in NTIME(T’)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows

Flip, Diagonal

15

Page 118: Computational Complexity

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

L’ not in NTIME(T), but is in NTIME(T’)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows

Flip, Diagonal

15

Page 119: Computational Complexity

Delay, R

apid

thicken

ing

NTIME Hierarchy“Delayed flip” on a “rapidly thickening diagonal”

f(i+1)=exp(f(i))

Let L be the “diagonal” language

L’(j)=L(j+1)

except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)

L’ not in NTIME(T), but is in NTIME(T’)

f(1) f(2) f(3) f(4) f(5)

L

L’

Think NTIME(T) ⊆ rows

Flip, Diagonal

15

Page 120: Computational Complexity

Time Hierarchy

16

Page 121: Computational Complexity

Time Hierarchy

Within DTIME and NTIME fine gradation

16

Page 122: Computational Complexity

Time Hierarchy

Within DTIME and NTIME fine gradation

In particular P ⊊ EXP, NP ⊊ NEXP

16

Page 123: Computational Complexity

Time Hierarchy

Within DTIME and NTIME fine gradation

In particular P ⊊ EXP, NP ⊊ NEXP

Tells nothing across DTIME and NTIME

16

Page 124: Computational Complexity

Time Hierarchy

Within DTIME and NTIME fine gradation

In particular P ⊊ EXP, NP ⊊ NEXP

Tells nothing across DTIME and NTIME

P and NP?

16

Page 125: Computational Complexity

Time Hierarchy

Within DTIME and NTIME fine gradation

In particular P ⊊ EXP, NP ⊊ NEXP

Tells nothing across DTIME and NTIME

P and NP?

Just diagonalization won’t help (next lecture)

16

Page 126: Computational Complexity

Today

DTIME Hierarchy

DTIME(T) ⊊ DTIME(T’) if T log T = o(T’)

NTIME Hierarchy

NTIME(T) ⊊ NTIME(T’) if T = o(T’)

Using diagonalization

17

Page 127: Computational Complexity

Next Lecture

Another application of diagonalization

Ladner’s Theorem: If P≠NP, NP language which is neither in P nor NP-complete

Limits of Diagonalization

Starting Space Complexity

18