• Home
  • Textbooks
  • Quantum Computing for Computer Scientists
  • Theoretical Computer Science

Quantum Computing for Computer Scientists

Noson S. Yanofsky, Mirco A. Mannucci

Chapter 8

Theoretical Computer Science - all with Video Answers

Educators


Section 1

Deterministic and Nondeterministic Computations

Problem 1

Write a deterministic Turing machine that determines if the input string has a substring "101." You might have to begin by moving off the center a little. For an input of size $n$, how many moves does the Turing machine have to make in the worst case?
What can and cannot be computed is not our exclusive interest. Another important issue is what can be computed efficiently. We shall be looking at different sets of problems of various degrees of difficulty. A complexity class is a set of problems that can all be solved by a certain model of computation within certain efficiency bounds. By examining and comparing different complexity classes, we shall derive principles about different models of computation.
The number of computational time steps that a machine must undergo before it enters an accepting or rejecting state is the number of steps for the computation. The number will usually depend on the size of the input. Hence we describe a function from the size of an input to the number of steps in the computation. Such a function might be a polynomial. If every input to a problem can be solved within a polynomial number of steps, then the problem is said to be solvable in a polynomial number of steps.
$$
\begin{array}{|l|}
\hline \text { Complexity Class. P is the set of problems that can be solved by a deterministic } \\
\text { Turing machine in a Polynomial number of steps. } \\
\hline
\end{array}
$$
This complexity class is important because of the following thesis:
Thesis. The Cook-Karp Thesis states that problems that are "tractably computable" can be computed by a deterministic Turing machine in polynomial time, i.e., are in $\mathbf{P}$.
This thesis also cannot be proved because it is impossible to give an exact definition of what we informally mean by "tractably computable." In fact, one would be hard-pressed to argue that a problem that demands $n^{100}$ steps for an input of size $n$ is tractable. Nevertheless, $n^{100}$ is a function that grows slower than any nontrivial exponential function (including $1.001^n$ ).

Check back soon!
23:32

Problem 2

Find the least $n$ such that $1.001^n \geq n^{100}$.
There are other interesting models of computation. A nondeterministic Turing machine is similar to a deterministic Turing machine, but we eliminate the requirement that at every step of the computation, the machine proceeds to exactly one subsequent step. In other words, for a given $q \in Q$ and a $\sigma \in \Sigma$, the machine can enter into a subset (possibly empty) of $Q \times \Sigma \times\{L, R\}$. Formally, a nondeterministic Turing machine $M$ is a 6-tuple
$$
M=\left(Q, \Sigma, q_{\text {start }}, q_{\text {accept }}, q_{\text {reject }}, \delta\right),
$$
where $Q, \Sigma, q_{\text {start }}, q_{\text {accept }}, q_{\text {reject }}$ are as before and $\delta$ is a function
$$
\delta: Q \times \Sigma \longrightarrow \wp(Q \times \Sigma \times\{L, R\})
$$
where $\wp$ is the powerset function. For a given $q \in Q$ and $\sigma \in \Sigma$ if $\left(q^{\prime}, \sigma^{\prime}, D\right) \in$ $\delta(q, \sigma)$, we mean that
If Turing machine $M$ is in state $q$ and the eye encounters symbol $\sigma$, then one of the actions that the machine could perform is to exchange symbol $\sigma$ for $\sigma^{\prime}$, move one box in the direction $D \in\{L, R\}$, and enter state $q^{\prime} \in Q$.

Just as we rewrote function (8.2), we might also rewrite function (8.11) as
$$
\bar{\delta}: Q \times \Sigma \longrightarrow\{0,1\}^{Q \times \Sigma \times\{L, R\}}
$$
where $\{0,1\}^{Q \times \Sigma \times\{L, R\}}$ is the set of functions from $Q \times \Sigma \times\{L, R\}$ to $\{0,1\}$. Whereas $\delta$ in function (8.11) chooses a subset of $Q \times \Sigma \times\{L, R\}, \bar{\delta}$ in function (8.12) chooses the characteristic function of the same subset. We may write this $\bar{\delta}$ similar to function $(8.3)$ :
$$
\delta^{\prime}: Q \times \Sigma \times Q \times \Sigma \times\{L, R\} \longrightarrow\{0,1\}
$$
but this time we do not insist on the requirement that $\delta^{\prime}$ must satisfy Equation (8.5). In other words,
$$
(\forall q \in Q)(\forall \sigma \in \Sigma) \sum_{q^{\prime} \in Q, \sigma^{\prime} \in \Sigma, D \in\{L, R\}} \delta^{\prime}\left(q, \sigma, q^{\prime}, \sigma^{\prime}, D\right)=0 \text {, or } 1 \text {, or } 2 \text {, or } \ldots, \text { or } n .
$$
The largest $n$ is $|Q \times \Sigma \times\{L, R\}|$.

Chris Trentman
Chris Trentman
Numerade Educator

Problem 3

Show that every nondeterministic Turing machine is equivalent to a nondeterministic Turing machine that bifurcates into exactly two states at every time step. Another way of stating this is that the summation in Equation (8.14) is exactly 2.
In nondeterministic Turing machines, a computation can perform one of several different tasks at each time step. We say that a word is accepted by such a machine $M$ if there exists a computational path that ends in $q_{a c c e p t}$.
$$
\begin{array}{|l|}
\hline \begin{array}{l}
\text { Complexity Class. NP is the set of problems that can be solved by Nondeter- } \\
\text { ministic Turing machines in a Polynomial number of steps. }
\end{array} \\
\hline
\end{array}
$$
Because every deterministic Turing machine is also a nondeterministic Turing machine (i.e., any $\delta^{\prime}$ that satisfies Equation (8.5) also satisfies Equation (8.14)), every problem that can be solved in polynomial time by a deterministic Turing machine can also be solved by a nondeterministic Turing machine in polynomial time. Hence, $\mathbf{P} \subseteq \mathbf{N P}$. The million-dollar question is whether $\mathbf{P}=\mathbf{N P}$. Alas, this question shall not be answered in this text.
If a problem has a "yes" answer, then the complement of the problem has a "no" answer, and vice versa. Hence, we define the following:
$$
\begin{array}{|l|}
\hline \begin{array}{l}
\text { Complexity Class. coP is the set of problems whose complements can be solved } \\
\text { by a deterministic Turing machine in a Polynomial number of steps. }
\end{array} \\
\hline
\end{array}
$$
$$
\begin{array}{|l|}
\hline \text { Complexity Class. coNP is the set of problems whose complements can be } \\
\text { solved by a Nondeterministic Turing machine in a Polynomial number of steps. } \\
\hline
\end{array}
$$
If we can solve a problem with a deterministic Turing machine, then by swapping the $q_{\text {accept }}$ and the $q_{\text {reject }}$ states, we can solve the complement of the problem. From this we know that $\mathbf{P}=\mathbf{c o P}$. Notice that this trick does not work for nondeterministic Turing machines: a nondeterministic Turing machine accepts a word if there exists at least one computational path that ends with an accepting state. If a computation has all but one path ending with an accepting state, then the word would be accepted. If we swapped the accepting and rejecting states, then all but one path would end in a rejecting state and exactly one path would end in an accepting state. Because of the single accepting state, the computation would also be accepted. So a word would be accepted by both a problem in NP and its corresponding problem in coNP. This cannot be. In conclusion, although it is known that $\mathbf{P}=\mathbf{c o P}$, we do not know if $\mathbf{N P}=$ coNP. In fact, most researchers believe that $\mathbf{N P} \neq$ coNP. For the same reason that $\mathbf{P} \subseteq \mathbf{N P}$, we have that
$$
\mathbf{P}=\operatorname{coP} \subseteq \operatorname{coNP} .
$$
We are interested in not only how much time a computation uses but also how much of the Turing machine's infinite tape is used.
$$
\begin{array}{|l|}
\hline \text { Complexity Class. PSPACE is the set of problems that can be solved by deter- } \\
\text { ministic Turing machines using a Polynomial number of SPACEs on the tape. } \\
\hline
\end{array}
$$
We could have written the same definition using a nondeterministic Turing machine. It is a consequence of Savitch's theorem ${ }^4$ that when looking at space (as opposed to time), the distinction between deterministic polynomial space and nondeterministic polynomial space is not essential.

Because a (nondeterministic) Turing machine can change only one box per time step, machines that use $p(n)$ time steps to solve a problem cannot use more than $p(n)$ spaces of its infinite tape. Hence, we have NP $\subseteq$ PSPACE. For similar reasons, coNP $\subseteq$ PSPACE.

Check back soon!