cs151 complexity theory lecture 4 april 11, 2013
TRANSCRIPT
![Page 1: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/1.jpg)
CS151Complexity Theory
Lecture 4
April 11, 2013
![Page 2: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/2.jpg)
April 11, 2013 2
Ladner’s Theorem
• Assuming P ≠ NP, what does the world (inside NP) look like?
NPC
P
NP:
NPC
P
NP:
![Page 3: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/3.jpg)
April 11, 2013 3
Ladner’s Theorem
Theorem (Ladner): If P ≠ NP, then there exists L NP that is neither in P nor NP-complete.
• Proof: “lazy diagonalization”– deal with similar problem as in NTIME
Hierarchy proof
![Page 4: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/4.jpg)
April 11, 2013 4
Ladner’s Theorem
• Try to “merge”:
• on input x, either– answer SAT(x)– answer TRIV(x)
• if can decide which
one in P, L NP
SAT TRIVMi
M0
L
N0
Ni
: :
: :
. . . ≠
≠
≠
≠
![Page 5: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/5.jpg)
April 11, 2013 5
Ladner’s Theorem
• General scheme: f(n) slowly increasing function
– f(|x|) even: answer SAT(x)– f(|x|) odd: answer TRIV(x)
• notice choice only depends on length of input… that’s OK
L . . .
f(|x|) 0 0 0 1 1 1 2 2 2 2 . . .
SAT
TRIV
![Page 6: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/6.jpg)
April 11, 2013 6
Ladner’s Theorem
• 1st attempt to define f(n)• “eager f(n)”: increase at 1st opportunity• Inductive definition: f(0) = 0; f(n) =
– if f(n-1) = 2i, trying to kill Mi
• if z < 1n s.t. Mi(z) ≠ SAT(z), then f(n) = f(n-1) + 1; else f(n) = f(n-1)
– if f(n-1) = 2i+1, trying to kill Ni
• if z < 1n s.t. Ni(z) ≠ TRIV(z), then f(n) = f(n-1) + 1; else f(n) = f(n-1)
![Page 7: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/7.jpg)
April 11, 2013 7
Ladner’s Theorem
• Problem: eager f(n) too difficult to compute• on input of length n,
– look at all strings z of length < n
– compute SAT(z) or Ni(z) for each !
• Solution: “lazy” f(n) – on input of length n, only run for 2n steps– if enough time to see should increase (over f(n-1)), do
it; else, stay same– (alternate proof: give explicit f(n) that grows slowly
enough…)
![Page 8: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/8.jpg)
April 11, 2013 8
Ladner’s Theorem
• Key: n eventually large enough to notice completed previous stage
L
f 0 0 1 1 k k k
. . .
. . .
Mi
input xinput z < x
≠
suppose k = 2i
• I’m sup-posed to ensure Mi is killed• I finally have enough time to check input z• I notice z did the job, increase f to k+1
k k
![Page 9: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/9.jpg)
April 11, 2013 9
Ladner’s Theorem
• Inductive definition of f(n)– f(0) = 0– f(n): for n steps compute f(0), f(1), f(2),…
L
f 0 0 1 1 k k k
. . .
. . . . . .
. . .
input x, |x| = n
got this far in n steps
![Page 10: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/10.jpg)
April 11, 2013 10
Ladner’s Theorem
– if k = 2i:• for n steps try (lex order) to find z s.t.
SAT(z) ≠ Mi(z) and f(|z|) even
• if found, f(n) = f(n-1)+1 else f(n-1)– if k = 2i + 1:
• for n steps try (lex order) to find z s.t. TRIV(z) ≠ Ni(z) and f(|z|) odd
• if found, f(n) = f(n-1)+1 else f(n-1)
![Page 11: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/11.jpg)
April 11, 2013 11
Ladner’s Theorem
• Finishing up:
L = { x | x SAT if f(|x|) even,
x TRIV if f(|x|) odd }
• L NP since f(|x|) can be computed in O(n) time
![Page 12: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/12.jpg)
April 11, 2013 12
Ladner’s Theorem
• suppose Mi decides L– f gets stuck at 2i
– L SAT for z : |z| > no
– implies SAT P. Contradiction.
• suppose Ni decides L– f gets stuck at 2i+1
– L TRIV for z : |z| > no
– implies L(Ni) P. Contradiction.
• (last of diagonalization…)
![Page 13: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/13.jpg)
April 11, 2013 13
A puzzle
• cover up nodes with c colors• promise: never color “arrow” same as “blank”• determine which kind of tree in poly(n, c) steps?
. . . . . .
depth n
A puzzle: two kinds of trees
![Page 14: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/14.jpg)
April 11, 2013 14
A puzzle
. . . . . .
depth n
![Page 15: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/15.jpg)
April 11, 2013 15
A puzzle
. . . . . .
depth n
![Page 16: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/16.jpg)
April 11, 2013 16
Introduction• Ideas
– depth-first-search; stop if see– how many times may we see a given “arrow
color”?• at most n+1
– pruning rule?• if see a color > n+1 times, it can’t be an
arrow node; prune– # nodes visited before know answer?
• at most c(n+2)
![Page 17: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/17.jpg)
April 11, 2013 17
Sparse languages and NP
• We often say NP-compete languages are “hard”
• More accurate: NP-complete languages are “expressive”– lots of languages reduce to them
![Page 18: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/18.jpg)
April 11, 2013 18
Sparse languages and NP
• Sparse language: one that contains at most poly(n) strings of length ≤ n
• not very expressive – can we show this cannot be NP-complete (assuming P ≠ NP) ?
– yes: Mahaney ’82 (homework problem)
• Unary language: subset of 1* (at most n strings of length ≤ n)
![Page 19: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/19.jpg)
April 11, 2013 19
Sparse languages and NP
Theorem (Berman ’78): if a unary language is NP-complete then P = NP.
• Proof: – let U 1* be a unary language and assume
SAT ≤ U via reduction R
– φ(x1,x2,…,xn) instance of SAT
![Page 20: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/20.jpg)
April 11, 2013 20
Sparse languages and NP
– self-reduction tree for φ:
. . .
φ(x1,x2,…,xn)
φ(1,x2,…,xn)φ(0,x2,…,xn)
φ(0,0,…,0) φ(1,1,…,1)
.
.
.
satisfying assignment
![Page 21: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/21.jpg)
April 11, 2013 21
Sparse languages and NP
– applying reduction R:
. . .
R(φ(x1,x2,…,xn))
R(φ(1,x2,…,xn))R(φ(0,x2,…,xn))
R(φ(0,0,…,0)) R(φ(1,1,…,1))
.
.
.
satisfying assignment
![Page 22: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/22.jpg)
April 11, 2013 22
Sparse languages and NP
• on input of length m = |φ(x1,x2,…,xn)|, R produces string of length ≤ p(m)
• R’s different outputs are “colors”– 1 color for strings not in 1*
– at most p(m) other colors
• puzzle solution can solve SAT in poly(p(m)+1, n+1) = poly(m) time!
![Page 23: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/23.jpg)
April 11, 2013 23
Summary
• nondeterministic time classes:
NP, coNP, NEXP
• NTIME Hierarchy Theorem:
NP ≠ NEXP
• major open questions:
P = NP NP = coNP? ?
![Page 24: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/24.jpg)
April 11, 2013 24
Summary
• NP-“intermediate” problems (unless P = NP)
– technique: delayed diagonalization
• unary languages not NP-complete (unless P = NP)
– true for sparse languages as well (homework)
• complete problems:– circuit SAT is NP-complete– UNSAT is coNP-complete– succinct circuit SAT is NEXP-complete
![Page 25: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/25.jpg)
April 11, 2013 25
Summary
EXP
PSPACE
P
L
NEXP
NP coNP
coNEXP
![Page 26: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/26.jpg)
April 11, 2013 26
Remainder of lecture
• nondeterminism applied to space
• reachability
• two surprises:
– Savitch’s Theorem
– Immerman/Szelepcsényi Theorem
![Page 27: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/27.jpg)
April 11, 2013 27
Nondeterministic space
• NSPACE(f(n)) = languages decidable by a multi-tape NTM that touches at most f(n) squares of its work tapes along any computation path, where n is the input length, and f :N ! N
![Page 28: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/28.jpg)
April 11, 2013 28
Nondeterministic space
• Robust nondeterministic space classes:
NL = NSPACE(log n)
NPSPACE = k NSPACE(nk)
![Page 29: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/29.jpg)
April 11, 2013 29
Reachability
• Recall: at most nk configurations of given NTM M running in NSPACE(log n).
qstartx1x2x3…xn
qaccept qreject
xL
qaccept qreject
xL• easy to determine if C yields C’ in one step• configuration graph for M on input x:
![Page 30: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/30.jpg)
April 11, 2013 30
Reachability
• Conclude: NL P – and NPSPACE EXP
• S-T-Connectivity (STCONN): given directed graph G = (V, E) and nodes s, t, is there a path from s to t ?
Theorem: STCONN is NL-complete under logspace reductions.
![Page 31: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/31.jpg)
April 11, 2013 31
Reachability
• Proof:– in NL: guess path from s to t one node at a
time– given L NL decided by NTM M construct
configuration graph for M on input x (can be done in logspace)
– s = starting configuration; t = qaccept
![Page 32: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/32.jpg)
April 11, 2013 32
Two startling theorems
• Strongly believe P ≠ NP
• nondeterminism seems to add enormous power
• for space: Savitch ‘70:
NPSPACE = PSPACE
and
NL SPACE(log2n)
![Page 33: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/33.jpg)
April 11, 2013 33
Two startling theorems
• Strongly believe NP ≠ coNP
• seems impossible to convert existential into universal
• for space: Immerman/Szelepscényi ’87/’88:
NL = coNL
![Page 34: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/34.jpg)
April 11, 2013 34
Savitch’s Theorem
Theorem: STCONN SPACE(log2 n)
• Corollary: NL SPACE(log2n)
• Corollary: NPSPACE = PSPACE
![Page 35: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/35.jpg)
April 11, 2013 35
Proof of Theorem
– input: G = (V, E), two nodes s and t– recursive algorithm:
/* return true iff path from x to y of length at most 2i */
PATH(x, y, i)
if i = 0 return ( x = y or (x, y) E ) /* base case */
for z in V
if PATH(x, z, i-1) and PATH(z, y, i-1) return(true);
return(false);
end
![Page 36: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/36.jpg)
April 11, 2013 36
Proof of Theorem
– answer to STCONN: PATH(s, t, log n)– space used:
• (depth of recursion) x (size of “stack record”)
– depth = log n– claim stack record: “(x, y, i)” sufficient
• size O(log n)
– when return from PATH(a, b, i) can figure out what to do next from record (a, b, i) and previous record
![Page 37: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/37.jpg)
April 11, 2013 37
Nondeterministic space
• Robust nondeterministic space classes:
NL = NSPACE(log n)
NPSPACE = k NSPACE(nk)
![Page 38: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/38.jpg)
April 11, 2013 38
Second startling theorem
• Strongly believe NP ≠ coNP
• seems impossible to convert existential into universal
• for space: Immerman/Szelepscényi ’87/’88:
NL = coNL
![Page 39: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/39.jpg)
April 11, 2013 39
I-S Theorem
Theorem: ST-NON-CONN NL
• Proof: slightly tricky setup:– input: G = (V, E), two nodes s, t
t
s
“yes”
t
s
“no”
![Page 40: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/40.jpg)
April 11, 2013 40
I-S Theorem
– want nondeterministic procedure using only O(log n) space with behavior:
“yes” input
“no” input
qaccept qreject qaccept qreject
t
s
t
s
![Page 41: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/41.jpg)
April 11, 2013 41
I-S Theorem
– observation: given count of # nodes reachable from s, can solve problem• for each v V, guess if it is reachable• if yes, guess path from s to v
– if guess doesn’t lead to v, reject. – if v = t, reject. – else counter++
• if counter = count accept
![Page 42: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/42.jpg)
April 11, 2013 42
I-S Theorem
– every computation path has sequence of guesses…
– only way computation path can lead to accept:• correctly guessed reachable/unreachable
for each node v• correctly guessed path from s to v for each
reachable node v• saw all reachable nodes• t not among reachable nodes
![Page 43: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/43.jpg)
April 11, 2013 43
I-S Theorem
– R(i) = # nodes reachable from s in at most i steps
– R(0) = 1: node s
– we will compute R(i+1) from R(i) using O(log n) space and nondeterminism
– computation paths with “bad guesses” all lead to reject
![Page 44: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/44.jpg)
April 11, 2013 44
I-S Theorem
– Outline: in n phases, compute
R(1), R(2), R(3), … R(n) – only O(log n) bits of storage between phases– in end, lots of computation paths that lead to
reject– only computation paths that survive have
computed correct value of R(n)– apply observation.
![Page 45: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/45.jpg)
April 11, 2013 45
I-S Theorem
– computing R(i+1) from R(i):
– Initialize R(i+1) = 0– For each v V, guess if v reachable from s in
at most i+1 steps
R(i) = R(2) = 6
![Page 46: CS151 Complexity Theory Lecture 4 April 11, 2013](https://reader036.vdocuments.us/reader036/viewer/2022062417/551c0a7f550346a84f8b50ba/html5/thumbnails/46.jpg)
April 11, 2013 46
I-S Theorem
– if “yes”, guess path from s to v of at most i+1 steps. Increment R(i+1)
– if “no”, visit R(i) nodes reachable in at most i steps, check that none is v or adjacent to v• for u V guess if reachable in ≤ i steps;
guess path to u; counter++• KEY: if counter ≠ R(i), reject• at this point: can be sure v not reachable