Chapter 6

Computational Complexity

[57/32%]
Show
LaTeX
Example 6.1

Suppose we are given three pegs and nn disks, with all nn disks having different size. Initially, the nn disks are stacked in decreasing size, from bottom to top, in the first peg (see Figure 6.1). The Tower of Hanoi problem is to transfer the entire tower of nn disks from the first peg to the second peg, moving one disk at a time and never putting a larger disk on top of a smaller disk. What is the fastest solution to this problem? Is the fastest solution feasible for size n=64n=64 (the size of the original Tower of Hanoi problem)?

Figure 6.1: The Tower of Hanoi problem.Figure 6.1: The Tower of Hanoi problem.

?
Example 6.3

Show that the function 2log⁡n2^{\sqrt{\log n}} grows slower than every function in the polynomial sequence, but faster than every function in the poly-log sequence.

?
Example 6.4

Suppose f(n)≺g(n)f(n) \prec g(n). Show that there exists a function h(n)h(n) such that f(n)≺h(n)≺g(n)f(n) \prec h(n) \prec g(n).

?
Example 6.5

Show that log⁡∗n≺log⁡(m)n\log^{*} n \prec \log^{(m)} n for any constant integer m≥1m \geq 1.

?
Problem 6.1.1

Show that 2ln⁡n=o(n)2^{\ln n}=o(n) and 2log⁡(2n)=O(n)2^{\log (2 n)}=O(n).

?
Problem 6.1.2

Show that (log⁡n)10≺n10≺2(log⁡n)10(\log n)^{10} \prec n^{10} \prec 2^{(\log n)^{10}}.

?
Problem 6.1.3

Compare the following three functions using the ≺\prec notation:

2nlog⁡n,n(log⁡n)2,(log⁡n)2n 2^{n^{\log n}}, \quad n^{(\log n)^{2}}, \quad (\log n)^{2^{n}}
?
Problem 6.1.4

Compare 2log⁡∗n2^{\log { }^{*} n} with nn using the ≺\prec notation.

?
Problem 6.1.5

Suppose that f(n)≺g(n)f(n) \prec g(n). Is it true that for any increasing function h(n)h(n) with lim⁡n→∞h(n)=∞,h(f(n))≺h(g(n))\lim_{n \rightarrow \infty } h(n)=\infty , h(f(n)) \prec h(g(n))? Present a proof or a counterexample.

?
Problem 6.1.6

Prove that log⁡(k+1)≺log⁡(k)n\log^{(k+1)} \prec \log^{(k)} n for any k≥0k \geq 0.

?
Problem 6.1.7

Denote log⁡∗∗n=min⁡{k∣(log⁡∗)(k)n≤1,k≥1}\log^{* *} n=\min \left\{ k \mid \left(\log^{*}\right)^{(k)} n \leq 1, k \geq 1\right\}. Compare log⁡∗∗n\log^{* *} n with log⁡∗n\log^{*} n.

?
Problem 6.1.8

Recall the Ackermann function AA defined in Exercise 8 of Section 4.8.

?
(a)

Compare the function f(n)=A(n,n)f(n)=A(n, n) with 22n2^{2^{n}}.

(b)

Compare the function g(n)=max⁡{k∣A(k,k)≤n}g(n)=\max \left\{ k \mid A(k, k) \leq n\right\} with log⁡∗n\log^{*} n.

Example 6.11

Suppose lim⁡n→∞t1(n)/n=∞\lim_{n \rightarrow \infty } t_{1}(n) / n=\infty. If t1(n)=t2(n)t_{1}(n)=t_{2}(n) for sufficiently large nn, then DTIME⁡(t1(n))=DTIME⁡(t2(n))\operatorname {DTIME}\left(t_{1}(n)\right)=\operatorname {DTIME}\left(t_{2}(n)\right).

?
Example 6.12

If c>1c>1, then for any ϵ>0,DTIME⁡(cn)=DTIME⁡((1+ϵ)n\epsilon >0, \operatorname {DTIME}(c n)=\operatorname {DTIME}((1+ \epsilon ) n).

?
Example 6.13

Show that if A,B∈PA, B \in P, then AB∈PA B \in P.

?
Example 6.14

Show that if A∈PA \in P, then A∗∈PA^{*} \in P.

?
Example 6.15

PSPACE⁡⊆EXPPOLY⁡\operatorname {PSPACE}\subseteq \operatorname {EXPPOLY}.

?
Problem 6.2.1

Suppose that s(n)≥log⁡ns(n) \geq \log n. Prove that if a Turing machine halts on all inputs and has a space bound s(n)s(n), then it must have a time bound cs(n)c^{s(n)} for a constant cc. Use this result to show that, for any s(n)s(n), every set in DSPACE⁡(s(n))\operatorname {DSPACE}(s(n)) is a recursive set.

?
Problem 6.2.2

Show that every finite set of strings belongs to DTIME⁡(n)\operatorname {DTIME}(n).

?
Problem 6.2.3

Let A∈DTIME⁡(f(n))A \in \operatorname {DTIME}(f(n)) and B∈DTIME⁡(g(n))B \in \operatorname {DTIME}(g(n)). Prove that A∪BA \cup B and A∩BA \cap B are in DTIME⁡(max⁡{f(n),g(n)})\operatorname {DTIME}(\max \left\{ f(n), g(n)\right\} ). Conclude from these results that the complexity classes P,PSPACE,EXPP, \mathrm{PSPACE}, \mathrm{EXP} and EXPPOLY\mathrm{EXPPOLY} are all closed under Boolean operations union, intersection and complementation.

?
Problem 6.2.4

In the proof of Theorem 6.10, we can actually use nine moves of M′M^{\prime }, instead of ten moves, to simulate at least mm moves of MM. This can be done by merging the fourth and fifth moves into one move. Can you use less than nine moves in M′M^{\prime } to do the same job?

?
Problem 6.2.5

Estimate how many possible local configurations there are in the proof of Theorem 6.10.

?
Problem 6.2.6

Show that every context-free language is in PP (i.e., for every context-free grammar, there is a polynomial-time parsing algorithm).

?
Problem 6.2.7

Show that if AA and BB are in PSPACE\mathrm{PSPACE}, then ABA B and A∗A^{*} are also in PSPACE\mathrm{PSPACE}.

?
Problem 6.2.8

Let A,B⊆1(0+1)∗+0A, B \subseteq 1(0+1)^{*}+0 such that each string xx in AA or BB is a binary representation of a natural number. We let n(x)n(x) be the natural number whose binary representation is xx.

?
(a)

Let A+B={x∈1(0+1)∗+0∣n(x)=n(y)+n(z) for some y∈A and z∈B}A+B=\left\{ x \in 1(0+1)^{*}+0 \mid n(x)=n(y)+n(z)\text{ for some }y \in A\text{ and }z \in B\right\}. Show that if A,B∈PSPACEA, B \in \mathrm{PSPACE}, then A+BA+B is also in PSPACE.

(b)

Let A⋆B={x∈1(0+1)∗+0∣n(x)=n(y)⋅n(z) for some y∈A and z∈B}A \star B=\left\{ x \in 1(0+1)^{*}+0 \mid n(x)=n(y) \cdot n(z)\text{ for some }y \in A\text{ and }z \in B\right\}. Show that if A,B∈PSPACEA, B \in \mathrm{PSPACE} then A⋆BA \star B is also in PSPACE.

(c)

Assume that A,B∈PA, B \in P. Is it true that A+BA+B is also in PP? Is it true that A⋆BA \star B is also in PP?

Example 6.18

Show that (n+2)2(n+2)^{2} is fully time-constructible.

?
Example 6.19

Show that ⌈n⌉\lceil \sqrt{n}\rceil is fully space-constructible.

?
Example 6.20

P⊂≠EXP\quad P \underset {\neq }{\subset } \mathrm{EXP}.

?
Example 6.21

EXP≠PSPACE\mathrm{EXP} \neq \mathrm{PSPACE}.

?
Problem 6.3.1

Describe the detail of the 3-worktape DTM M∗M^{*} of Theorem 6.16. In particular, describe how M∗M^{*} works using input ww as both the machine code for MwM_{w} and as the input to MwM_{w}, while it is stored in the read-only input tape.

?
Problem 6.3.2

In the proof of Theorem 6.17, we used the dovetailing technique to perform the parallel simulation of MwM_{w} and McM^{c}. Can we use, instead, the product Turing machine method of Example 5.9 to perform the parallel simulation?

?
Problem 6.3.3
?
(a)

Show that ⌈log⁡n⌉\lceil \log n\rceil is fully space-constructible.

(b)

Show that n3n^{3} is fully time-constructible.

Problem 6.3.4
?
(a)

Show that if t(n)t(n) is fully time-constructible, then DTIME⁡(t(n))⊆DSPACE⁡(t(n))\operatorname {DTIME}(t(n)) \subseteq \operatorname {DSPACE}(t(n)).

(b)

Show that if s(n)s(n) is fully space-constructible and s(n)≥log⁡ns(n) \geq \log n, then DSPACE⁡(s(n))⊆DTIME⁡(2c⋅s(n))\operatorname {DSPACE}(s(n)) \subseteq \operatorname {DTIME}\left(2^{c \cdot s(n)}\right) for some constant c>0c>0.

Problem 6.3.5

Assume that A≤mBA \leq_{m} B by a reduction function ff with time bound 2n2^{n}. Also assume that B∈DTIME⁡(2n)B \in \operatorname {DTIME}(2^{n}). What can you say about the time complexity of set AA?

?
Problem 6.3.6

Show that DSPACE⁡(n(log⁡∗n)100)≠⊂DSPACE⁡(nlog⁡n)\operatorname {DSPACE}\left(n\left(\log^{*} n\right)^{100}\right) \stackrel{\subset }{\neq } \operatorname {DSPACE}(n \log n).

?
Problem 6.3.7

Show that EXP ⊊≠\underset {\neq }{\subsetneq } EXPPOLY.

?
Problem 6.3.8

Show that PSPACE ∪≠⋃c>0DSPACE⁡(2cn)\underset {\neq }{\cup } \bigcup_{c>0} \operatorname {DSPACE}\left(2^{c n}\right).

?
Example 6.22

Let L={ai1bai2b⋯baikbbaj∣i1,…,ik,j>0,∑r∈Air=j for some A⊆{1,2,…,k}}L=\left\{ a^{i_{1}} b a^{i_{2}} b \cdots b a^{i_{k}} b b a^{j} \mid i_{1}, \ldots , i_{k}, j>0, \sum_{r \in A} i_{r}=j\text{ for some }A \subseteq \left\{ 1,2, \ldots , k\right\} \right\}. Find an NTM accepting the language LL.

?
Example 6.30

Show that NSPACE⁡(n)⊆≠NSPACE⁡(n2log⁡n)\operatorname {NSPACE}(n) \underset {\neq }{\subseteq } \operatorname {NSPACE}(n^{2} \log n).

?
Example 6.32

Show that NSPACE⁡(n)⊆≠NSPACE⁡(n1.5)\operatorname {NSPACE}(n) \underset {\neq }{\subseteq } \operatorname {NSPACE}\left(n^{1.5}\right).

?
Problem 6.4.1

Construct multi-tape NTM's to accept the following languages in time t(n)=2nt(n)=2 n :

?
(a)

L1={ai1bai2b⋯baik∣i1,i2,…,ik≥0,k≥3,ir=is=it for some 1≤r<s<t≤k}L_{1}=\left\{ a^{i_{1}} b a^{i_{2}} b \cdots b a^{i_{k}} \mid i_{1}, i_{2}, \ldots , i_{k} \geq 0, k \geq 3, i_{r}=i_{s}=i_{t}\text{ for some }1 \leq r<s<t \leq k\right\}.

(b)

L2={x1cx2c⋯cxmccy∣x1,…,xm,y∈{a,b}∗,(∃i1,…,ik)[1≤i1<⋯<ik≤m,xi1xi2⋯xik=y]}L_{2}=\left\{ x_{1} c x_{2} c \cdots c x_{m} c c y \mid x_{1}, \ldots , x_{m}, y \in \left\{ a, b\right\}^{*},\left(\exists i_{1}, \ldots , i_{k}\right)[1 \leq \left.i_{1}<\cdots <i_{k} \leq m, x_{i_{1}} x_{i_{2}} \cdots x_{i_{k}}=y\right]\right\}.

Problem 6.4.2
?
(a)

A regular expression rr is called a starless regular expression if it does not contain the symbol * (the Kleene star). Show that the problem of determining whether two starless regular expressions r1r_{1} and r2r_{2} are not equivalent (i.e., whether L(r1)≠L(r2)L\left(r_{1}\right) \neq L\left(r_{2}\right)) is in NP\mathrm{NP}.

(b)

Show that the problem of determining whether two regular expressions are not equivalent is in NSPACE⁡(n)\operatorname {NSPACE}(n).

(c)

An extended regular expression is a regular expression that can use an additional intersection operation (denoted by ∩\cap). Show that the problem of determining whether two extended regular expressions are not equivalent is in ⋃c>0NSPACE⁡(2cn)\bigcup_{c>0} \operatorname {NSPACE}\left(2^{c n}\right).

Problem 6.4.3

In the proof of Theorem 6.27, the predicate reach⁡(α1,α2,2i)\operatorname {reach}\left(\alpha_{1}, \alpha_{2}, 2^{i}\right) was solved by a deterministic recursive algorithm. Convert it to an equivalent nonrecursive algorithm that uses space O((s(n))2)O\left((s(n))^{2}\right).

?
Problem 6.4.4

Show that the complexity class NP is closed under union, intersection, concatenation and Kleene closure.

?
Problem 6.4.5

Show that, for any real numbers r≥1r \geq 1 and 0<ϵ<10<\epsilon <1,

NSPACE⁡(nr)≠⊂NSPACE⁡(nr+ϵ). \operatorname {NSPACE}\left(n^{r}\right) \stackrel{\subset }{\neq } \operatorname {NSPACE}\left(n^{r+\epsilon }\right).
?
Problem 6.4.6
?
(a)

Show that Lemma 6.31 still holds if we replace the conditions s2(n)≥ns_{2}(n) \geq n and f(n)≥nf(n) \geq n by s2(n)≥log⁡ns_{2}(n) \geq \log n and log⁡(f(n))=O(s2(n))\log (f(n))= O\left(s_{2}(n)\right). [Hint: Note that NTM M3M_{3} can simulate M2M_{2} on input y=xSf(∣x∣)−∣x∣y=x S^{f(\left|x\right|)-\left|x\right|} without writing down the string yy on the second tape. Instead, it may simply write down, in the second tape, the position kk of the input tape head of M2M_{2} and use kk to determine what input symbol M2M_{2} 's tape head is scanning.]

(b)

Show that, for any real numbers r>0r>0 and 0<ϵ<10<\epsilon <1,

NSPACE⁡(nr)≠⊂NSPACE⁡(nr+ϵ). \operatorname {NSPACE}\left(n^{r}\right) \stackrel{\subset }{\neq } \operatorname {NSPACE}\left(n^{r+\epsilon }\right).
Problem 6.4.7

Show that if t1(n),t2(n)t_{1}(n), t_{2}(n), and f(n)f(n) are fully time-constructible functions with t2(n)≥nt_{2}(n) \geq n and f(n)≥nf(n) \geq n, then NTIME⁡(t1(n))⊆NTIME⁡(t2(n))\operatorname {NTIME}\left(t_{1}(n)\right) \subseteq \operatorname {NTIME}\left(t_{2}(n)\right) implies NTIME⁡(t1(f(n)))⊆NTIME⁡(t2(f(n)))\operatorname {NTIME}\left(t_{1}(f(n))\right) \subseteq \operatorname {NTIME}\left(t_{2}(f(n))\right).

?
Problem 6.4.8
?
(a)

Show that EXP≠NP\mathrm{EXP} \neq \mathrm{NP}.

(b)

Show that EXP ≠⋃c>0DTIME⁡(2nc)\neq \bigcup_{c>0} \operatorname {DTIME}\left(2^{n^{c}}\right).

Problem 6.4.9

Show that if P=NPP=\mathrm{NP}, then

⋃c>0DTIME⁡(2nc)=⋃c>0NTIME⁡(2nc). \bigcup _{c>0} \operatorname {DTIME}\left(2^{n^{c}}\right)=\bigcup _{c>0} \operatorname {NTIME}\left(2^{n^{c}}\right).
?
Example 6.33

Find a context-sensitive grammar for the language

L={a2n∣n≥0} L=\left\{ a^{2^{n}} \mid n \geq 0\right\}
?
Example 6.34

Find a context-sensitive grammar for the language

L={an2∣n≥1} L=\left\{ a^{n^{2}} \mid n \geq 1\right\}
?
Problem 6.5.1

Construct context-sensitive grammars for the languages of Examples 4.17 and 4.18, and for the languages in Exercises 3(b)-3(i) of Section 4.5.

?
Problem 6.5.2

Complete the last part of the proof of Theorem 6.35. That is, describe how to attach the leftmost and rightmost blanks to their neighboring symbols to convert grammar G2G_{2} to a context-sensitive grammar.

?
Problem 6.5.3

Show that the class of context-sensitive languages is closed under union, intersection, concatenation, and Kleene closure.

?
Problem 6.5.4

Find a recursive language LL that is not context-sensitive.

?
Problem 6.5.5

What is wrong if we use the following simpler algorithm to compute NkN_{k} in the proof of Theorem 6.36?

For each kk, to compute NkN_{k}, we generate each configuration α∈Cx\alpha \in C_{x} one by one and, for each one, nondeterministically verify whether reach⁡(β,α,k)\operatorname {reach}(\beta , \alpha , k) (by machine M1M_{1}), and increments the counter for NkN_{k} by one if reach⁡(β,α,k)\operatorname {reach}(\beta , \alpha , k) holds.

?
Problem 6.5.6

Recall, from Exercise 6 of Section 3.5, the notion of 2-stack PDA's. Show that each language accepted by a 2 -stack PDA is a context-sensitive language.

?