Computational Complexity
Lecture 3 in which we come across Diagonalization and Time-hierarchies (But first some more of NP-completeness)
1 NP-Complete Languages
2 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 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 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 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 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 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 CKT-SAT ≤p SAT
3 CKT-SAT ≤p SAT SAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)
3 CKT-SAT ≤p SAT SAT: Are all given “clauses” simultaneously satisfiable? (Conjunctive Normal Form)
Converting a circuit to a collection of clauses:
3 CKT-SAT ≤p SAT SAT: 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 CKT-SAT ≤p SAT SAT: 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 CKT-SAT ≤p SAT SAT: 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: x AND ⇒ ⇒ ⇒ ∨ e.g. y z : (z x), (z y), (¬z ¬x ¬y). i.e., (¬z ∨ x), (¬z ∨ y), (z ∨ ¬x ∨ ¬y).
3 CKT-SAT ≤p SAT SAT: 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: x AND ⇒ ⇒ ⇒ ∨ e.g. y z : (z x), (z y), (¬z ¬x ¬y). i.e., (¬z ∨ x), (¬z ∨ y), (z ∨ ¬x ∨ ¬y).
x and y OR z : (z⇒x ∨ y), (¬z⇒¬x), (¬z⇒¬y).
3 SAT ≤p 3SAT
4 SAT ≤p 3SAT
Previous reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.
4 SAT ≤p 3SAT
Previous reduction was to 3SAT, so 3SAT is NP-complete. And SAT is in NP. So SAT ≤p 3SAT.
More directly:
4 SAT ≤p 3SAT
Previous 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 SAT ≤p 3SAT
Previous 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 SAT ≤p 3SAT
Previous 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 SAT ≤p 3SAT
Previous 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 3SAT ≤p CLIQUE
5 3SAT ≤p CLIQUE
CLIQUE: Does graph G have a clique of size m?
5 3SAT ≤p CLIQUE
CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) have a clique of size m?
(w ∨ y)
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) have a clique of size m?
Clauses → Graph (w ∨ y)
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) have a clique of size m?
Clauses → Graph (w ∨ y)
1*0* 1*1* 0*1*
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) have a clique of size m?
Clauses → Graph (w ∨ y)
1*0* 1*1* 0*1*
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y)
1*0* 1*1* 0*1*
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y)
1*0* 1*1* 0*1*
(w ∨ x ∨ ¬z)
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y)
1*0* 1*1* 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
00*0 (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
edges between 00*0 consistent assignments (w ∨ x ∨ ¬z) 11*1 10*0
01*1 01*0 10*1 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
edges between 00*0 consistent assignments (w ∨ x ∨ ¬z) 11*1 10*0
01*1 m-clique iff all m 01*0 10*1 clauses satisfiable 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
edges between 00*0 consistent assignments (w ∨ x ∨ ¬z) 11*1 10*0
01*1 m-clique iff all m 01*0 10*1 clauses satisfiable 11*0
5 3SAT ≤p CLIQUE
*000 CLIQUE: Does graph G (x ∨ ¬y ∨ ¬z) *111 *100 have a clique of size m? *101 *010 *110 *001 Clauses → Graph (w ∨ y) vertices: each clause’s satisfying assignments 1*0* 1*1* (for its variables) 0*1*
edges between 00*0 consistent assignments (w ∨ x ∨ ¬z) 11*1 10*0 3-Clique 1*1* 01*1 m-clique iff all m *110 01*0 10*1 clauses satisfiable 11*0 ---- 11*0 sat assignment 1110 5 INDEP-SET and VERTEX-COVER
6 INDEP-SET and VERTEX-COVER
CLIQUE ≤p INDEP-SET
6 INDEP-SET and VERTEX-COVER
CLIQUE ≤p INDEP-SET
G has an m-clique iff Gc has an m-independent-set
6 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 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 NP, P, co-NP and NPC
NP coNP
NPC coNPC
P
7 NP, P, co-NP and NPC
We say class X is “closed under polynomial reductions” if (L1 ≤p L2 and L2 in class X) implies L1 in X
NP coNP
NPC coNPC
P
7 NP, P, co-NP and NPC
We 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
NP coNP
NPC coNPC
P
7 NP, P, co-NP and NPC
We 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?) NP coNP
NPC coNPC
P
7 NP, P, co-NP and NPC
We 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?) NP coNP If any NPC language is in P, then NP = P
NPC coNPC
P
7 NP, P, co-NP and NPC
We 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?) NP coNP If any NPC language is in P, then NP = P
NPC coNPC If any NPC language is in co-NP, then NP = co-NP P
7 NP, P, co-NP and NPC
We 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?) NP coNP If any NPC language is in P, then NP = P
NPC coNPC If any NPC language is in co-NP, then NP = co-NP P Note: X ⊆ co-X ⇒ X = co-X (Why?)
7 NP, P, co-NP and NPC
We 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?) NP coNP If any NPC language is in P, then NP = P
NPC coNPC If any NPC language is in co-NP, then NP = co-NP P Note: X ⊆ co-X ⇒ X = co-X (Why?)
L is NP-complete iff Lc is co-NP-complete (Why?)
7 NP, P, co-NP and NPC
We 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?) NP coNP If any NPC language is in P, then NP = P
NPC coNPC If any NPC language is in co-NP, then NP = co-NP P 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) 7 Separating Classes
8 Separating Classes
How to prove a set X strictly bigger than Y
8 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 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 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 Cantor’s Diagonal Slash
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable?
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable?
Suppose they were: consider enumerating them along with their binary representations in a table
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable? Ri Suppose they were: R1 = 1 0 0 1 0 0 0 0 1 consider enumerating them R2 = 0 0 1 0 1 0 0 1 1 along with their binary representations in a table R3 = 1 1 1 1 1 1 1 0 0
R4 = 1 1 0 1 0 1 0 1 1
R5 = 1 1 0 0 0 0 1 0 0
R6 = 0 0 0 0 0 0 1 1 0
R7 = 0 1 0 1 0 1 0 1 1
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable? Ri Suppose they were: R1 = 1 0 0 1 0 0 0 0 1 consider enumerating them R2 = 0 0 1 0 1 0 0 1 1 along with their binary representations in a table R3 = 1 1 1 1 1 1 1 0 0
Consider the real number R4 = 1 1 0 1 0 1 0 1 1 corresponding to the “flipped diagonal” R5 = 1 1 0 0 0 0 1 0 0
R6 = 0 0 0 0 0 0 1 1 0
R7 = 0 1 0 1 0 1 0 1 1
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable? Ri Suppose they were: R1 = 1 0 0 1 0 0 0 0 1 consider enumerating them R2 = 0 0 1 0 1 0 0 1 1 along with their binary representations in a table R3 = 1 1 1 1 1 1 1 0 0
Consider the real number R4 = 1 1 0 1 0 1 0 1 1 corresponding to the “flipped diagonal” R5 = 1 1 0 0 0 0 1 0 0
R6 = 0 0 0 0 0 0 1 1 0
R7 = 0 1 0 1 0 1 0 1 1
9 Cantor’s Diagonal Slash
Are real numbers (say in the range [0,1) ) countable? Ri Suppose they were: R1 = 1 0 0 1 0 0 0 0 1 consider enumerating them R2 = 0 0 1 0 1 0 0 1 1 along with their binary representations in a table R3 = 1 1 1 1 1 1 1 0 0
Consider the real number R4 = 1 1 0 1 0 1 0 1 1 corresponding to the “flipped diagonal” R5 = 1 1 0 0 0 0 1 0 0
R6 = Doesn’t appear in this 0 0 0 0 0 0 1 1 0 table! R7 = 0 1 0 1 0 1 0 1 1
9 an’t Cantor’s Diagonal Slash able c is t ls Th ll rea have a Are real numbers (say in the range [0,1) ) countable? Ri Suppose they were: R1 = 1 0 0 1 0 0 0 0 1 consider enumerating them R2 = 0 0 1 0 1 0 0 1 1 along with their binary representations in a table R3 = 1 1 1 1 1 1 1 0 0
Consider the real number R4 = 1 1 0 1 0 1 0 1 1 corresponding to the “flipped diagonal” R5 = 1 1 0 0 0 0 1 0 0
R6 = Doesn’t appear in this 0 0 0 0 0 0 1 1 0 table! R7 = 0 1 0 1 0 1 0 1 1
9 Undecidable Languages
LM1 = 1 0 0 1 0 0 0 0 1
LM2 = 0 0 1 0 1 0 0 1 1
LM3 = 1 1 1 1 1 1 1 0 0
LM4 = 1 1 0 1 0 1 0 1 1
LM5 = 1 1 0 0 0 0 1 0 0
LM6 = 0 0 0 0 0 0 1 1 0
LM7 = 0 1 0 1 0 1 0 1 1
10 Undecidable Languages
Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1
LM2 = 0 0 1 0 1 0 0 1 1
LM3 = 1 1 1 1 1 1 1 0 0
LM4 = 1 1 0 1 0 1 0 1 1
LM5 = 1 1 0 0 0 0 1 0 0
LM6 = 0 0 0 0 0 0 1 1 0
LM7 = 0 1 0 1 0 1 0 1 1
10 Undecidable Languages
Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1 TMs can be enumerated! LM2 = 0 0 1 0 1 0 0 1 1
LM3 = 1 1 1 1 1 1 1 0 0
LM4 = 1 1 0 1 0 1 0 1 1
LM5 = 1 1 0 0 0 0 1 0 0
LM6 = 0 0 0 0 0 0 1 1 0
LM7 = 0 1 0 1 0 1 0 1 1
10 Undecidable Languages
Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1 TMs can be enumerated! LM2 = 0 0 1 0 1 0 0 1 1
Table of languages LM3 = 1 1 1 1 1 1 1 0 0 recognized by the TMs LM4 = 1 1 0 1 0 1 0 1 1
LM5 = 1 1 0 0 0 0 1 0 0
LM6 = 0 0 0 0 0 0 1 1 0
LM7 = 0 1 0 1 0 1 0 1 1
10 Undecidable Languages
Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1 TMs can be enumerated! LM2 = 0 0 1 0 1 0 0 1 1
Table of languages LM3 = 1 1 1 1 1 1 1 0 0 recognized by the TMs LM4 = 1 1 0 1 0 1 0 1 1 L = ”diagonal language” LM5 = 1 1 0 0 0 0 1 0 0
LM6 = 0 0 0 0 0 0 1 1 0
LM7 = 0 1 0 1 0 1 0 1 1
10 Undecidable Languages
Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1 TMs can be enumerated! LM2 = 0 0 1 0 1 0 0 1 1
Table of languages LM3 = 1 1 1 1 1 1 1 0 0 recognized by the TMs LM4 = 1 1 0 1 0 1 0 1 1 L = ”diagonal language” LM5 = 1 1 0 0 0 0 1 0 0 Lc does not appear as a row in this table. Hence LM6 = 0 0 0 0 0 0 1 1 0 not recognizable! LM7 = 0 1 0 1 0 1 0 1 1
10 ve Undecidable Languages ’t ha e can abl es This t guag all lan Languages, like real numbers, can be represented as infinite bit-vectors LM1 = 1 0 0 1 0 0 0 0 1 TMs can be enumerated! LM2 = 0 0 1 0 1 0 0 1 1
Table of languages LM3 = 1 1 1 1 1 1 1 0 0 recognized by the TMs LM4 = 1 1 0 1 0 1 0 1 1 L = ”diagonal language” LM5 = 1 1 0 0 0 0 1 0 0 Lc does not appear as a row in this table. Hence LM6 = 0 0 0 0 0 0 1 1 0 not recognizable! LM7 = 0 1 0 1 0 1 0 1 1
10 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 DTIME Hierarchy
12 DTIME Hierarchy
Fix a TM model (one-tape, binary alphabet)
12 DTIME Hierarchy
Fix 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 DTIME Hierarchy
Fix 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 DTIME Hierarchy
Fix 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 DTIME Hierarchy
Fix 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 DTIME Hierarchy
Fix 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 DTIME Hierarchy: Proof
13 DTIME Hierarchy: Proof
Mi be an enumeration of TMs, each TM appearing infinitely often
13 DTIME Hierarchy: Proof
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’)
j 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 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice enough to allow simulat ion j 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 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice enough to allow simulat ion j 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 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice enough to allow simulat ion j 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 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice Let L’ = inverted diagonal. enough to allow simulat ion j 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 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice Let L’ = inverted diagonal. enough to allow simulation L’ in DTIME(T’) j 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 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice Let L’ = inverted diagonal. enough to allow simulation L’ in DTIME(T’) j Mi On input i, run UTM|T’ (Mi,i), modified to 1 0 0 1 0 0 0 0 1 invert output 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 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice Let L’ = inverted diagonal. enough to allow simulation L’ in DTIME(T’) j Mi On input i, run UTM|T’ (Mi,i), modified to 1 0 0 1 0 0 0 0 1 invert output 0 0 1 0 1 0 0 1 1 L’ not in DTIME(T) 1 1 1 1 1 1 1 0 0
1 1 0 1 0 1 0 1 1 Think DTIME(T) 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 DTIME Hierarchy: Proof
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’)
T’ large and nice Let L’ = inverted diagonal. enough to allow simulation L’ in DTIME(T’) j Mi On input i, run UTM|T’ (Mi,i), modified to 1 0 0 1 0 0 0 0 1 invert output 0 0 1 0 1 0 0 1 1 L’ not in DTIME(T) 1 1 1 1 1 1 1 0 0 If M accepts L’ in time T, then for 1 1 0 1 0 1 0 1 1 sufficiently large i s.t. Mi=M, UTM can Think DTIME(T) finish simulating Mi(i). Then table(i,i)=L’(i)! 1 1 0 0 0 0 1 0 0 ⊆ rows 0 0 0 0 0 130 1 1 0
0 1 0 1 0 1 0 1 1 NTIME Hierarchy
14 NTIME Hierarchy
Finer hierarchy
14 NTIME Hierarchy
Finer hierarchy
NTIME(T) ⊊ NTIME(T’) if T(n)=o(T’(n)), and T, T’ nice
14 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 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 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 NTIME Hierarchy
act, In f ’(n)) Finer hierarchy T(n+1) = o(T
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 NTIME Hierarchy
15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i))
Think NTIME(T) ⊆ rows 15 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) ⊆ rows 15 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) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i))
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1)
Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) 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’) Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1) l agona Flip, Di L’ not in NTIME(T), but is in NTIME(T’) Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1) l agona Flip, Di L’ not in NTIME(T), but is in NTIME(T’) Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1) l agona Flip, Di L’ not in NTIME(T), but is in NTIME(T’) Think NTIME(T) ⊆ rows 15 NTIME Hierarchy
“Delayed flip” on a “rapidly thickening diagonal”
f(i+1)=exp(f(i)) L’
Let L be the “diagonal” L language f(1) f(2) f(3) f(4) f(5) L’(j)=L(j+1)
except if j=f(i), then L’(j) = 1 - L(f(i-1)+1) l agona Flip, Di L’ not in NTIME(T), but pid , Ra ay ing Del en is in NTIME(T’) ick ⊆ th Think NTIME(T) rows 15 Time Hierarchy
16 Time Hierarchy
Within DTIME and NTIME fine gradation
16 Time Hierarchy
Within DTIME and NTIME fine gradation
In particular P ⊊ EXP, NP ⊊ NEXP
16 Time Hierarchy
Within DTIME and NTIME fine gradation
In particular P ⊊ EXP, NP ⊊ NEXP
Tells nothing across DTIME and NTIME
16 Time Hierarchy
Within DTIME and NTIME fine gradation
In particular P ⊊ EXP, NP ⊊ NEXP
Tells nothing across DTIME and NTIME
P and NP?
16 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 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 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