CS270 Exercises and Assignments
CS270
Exercises and Assignments
Spring 2021: Due dates to be announced.
Note all problems numbers are from the third edition. In case you don't have
that, henceforth the statements of all problems will be included here.
Recommended Exercises #1: 5.1, 5.2, 5.5, 5.6, 5.7, 5.9, 5.28, 5.30(a)
(These all have solutions except 5.1, 5.2, and 5.9, for which I will provide answers)
Assignment #1 (DUE: Tuesday 3/16):
- 5.12
- 5.13 (I will provide hints for this and 5.12)
- 5.20
- 5.23
- Prove, without using Rice's Theorem, that each of the following languages
is undecidable (see 5.9 for the technique):
- The language defined in 5.30(b)
- The language defined in 5.30(c)
- SA = {<M>
| L(M) ⊆ A}, where A is any set other
than ∅ or Σ*.
(Note here you are
proving an infinite family of undecidability results, one for each A.)
- Repeat the above, but directly appealing to Rice's Theorem (as in Problem 5.30).
Recommended Exercises #2
(recall these are not to be handed in; answers should be in the book, if not let me know):
- 6.3: Show that if \(A \le_{\rm T} B\) and \(B \le_{\rm T} C\),
then \(A \le_{\rm T} C\).
- 6.5: Is the statement
\(\exists x \forall y[x + y = y]\) a member
of Th\((\mathcal{N}, +)\)? Why or why not? What about
the statement \(\exists x \forall y [x + y = x] \)?
- 6.10: Give a model of the sentence:
$$\begin{eqnarray*}
\phi_{\rm eq} = &~& \forall x [R_1(x,x)] \\
&~& \wedge \forall x, y [R_1(x,y) \leftrightarrow R_1(y,x)]\\
&~& \wedge \forall x, y, z [(R_1(x,y) \wedge R_1(y,z))
\rightarrow R_(x,z)].
\end{eqnarray*}$$
- 6.12: Let \((\mathcal{N}, <)\) be the model with
universe \(\mathcal{N}\) and the "less than" relation.
show that Th\((\mathcal{N}, <)\) is decidable.
Assignment #2 (DUE: Tuesday, 3/30):
- 6.2: Show that any infinite subset of \(MIN_{\rm TM}\) is not
Turing-recognizable.
- 6.6: Describe two different Turing machines,
\(M\) and \(N\), where \(M\) outputs \(\langle N\rangle\)
and \(N\) outputs \(\langle M\rangle\).
- In the spirit of exercise 6.5, state whether or not each of the following is in
Th\((\mathcal{N},+)\), and explain your answer:
- \(\forall x \exists y [y + y = x] \)
- \( \exists x \forall y [y + y = x] \)
- \( \forall x \forall y \exists z [x \times y = z] \)
- Repeat the above exercise for Th\((\mathcal{N},+,\times)\).
- In the spirit of 6.12 (which means "look at its solution for a hint"): Let \((\mathcal{N}, = )\) be the model with
universe \(\mathcal{N}\) and the "equals" relation. Show that Th\((\mathcal{N},=)\) is decidable.
- 6.13: For each \(m > 1\) let
\(\mathcal{Z}_m = \{0,1,2,\dots,m-1\}\), and
let \(\mathcal{F}_m = (\mathcal{Z}_m,+,\times)\) be
the model whose universe is \(\mathcal{Z}_m\) and that has relations
corresponding to the \(+\) and \(\times\) relations modulo \(m\). Show that
for each \(m\), the theory Th\((\mathcal{F}_m)\) is decidable.
Recommended Exercises #3: 7.1c (\(n^2 = O(n\log^2 n)\)), d (\(n\log n = O(n^2)\)), 7.2c (\(2^n = o(3^n)\)), d (\(1 = o(n)\)).
Assignment #3 (DUE: Tuesday, 4/13):
- 6.21: Show how to compute the descriptive complexity of strings \(K(x)\)
with an oracle for \(A_{TM}\).
- 6.22: Use the result of Problem 6.21 to give a function
\(f\) that is computable with an oracle for \(A_{TM}\), where for
each \(n\), \(f(n)\) is an incompressible string of length \(n\).
- 6.24: Show that the set of incompressible strings is undecidable.
- For each of the following, answer true or false, and explain your answers:
- 7.1(a): \(2n = O(n)\)
- 7.1(b): \(n^2 = O(n) \)
- 7.1(e): \(3^n = 2^{O(n)}\)
- For each of the following, answer true or false, and explain your answers:
- 7.1(a): \(n = o(2n)\)
- 7.1(e): \(n = o(\log n)\)
- 7.1(f): \(1 = o(1/n)\)
- 7.6 (first part): Show that P is closed under union.
Recommended Exercises #4: 7.16 (Prove that NP is closed under Kleene star;
much easier than the analogous problem for P, see below.).
Assignment #4 (DUE: Tuesday, 5/4):
- 7.5: Is the following formula satisfiable? Explain your answer.
\((x\vee y) \wedge (x\vee \overline{y})\wedge (\overline{x}\vee y)
\wedge (\overline{x}\vee \overline{y})\)
- 7.6 (second and third parts): Show that P is closed under complement and
concatenation.
- 7.7: Show that NP is closed under union and concatenation. (Don't try to
prove it's closed under complement! It probably isn't!)
- 7.8: Let \(CONNECTED = \{\langle G\rangle | G\) is a connected
undirected graph\(\}\). Analyze the algorithm given on page 185/186 (example 3.23; pages 157/158 in 2nd edition) to
show that it is in P.
- In the proof of Theorem 7.36, there is an assertion
that "polynomial time reductions compose; that is, if
A is polynomial time reducible to B, and B in turn is
polynomial time reducible to C, then A is polynomial time
reducible to C." Another way of saying this is that
the relation \(\le_m^p\) (or \(\le_p\) as notated in the text) is transitive. Prove this
directly from Definition 7.29.
- 7.15: Prove that P is closed under Kleene star.
HINT:
Use dynamic programming. Consider any
\(A \in \) P. On input \(y = y_1\cdots y_n\) for
\(y_i \in \Sigma\), build a table indicating for each
\(i \le j\) whether the substring \(y_i\cdots y_j \in A^*\). (This is a nice exercise in dynamic programming!)
- 7.18: Show that if P = NP, then every language \(A \in \) NP, except
\(A = \) ∅ and \(A = \Sigma^*\), is NP-complete.
- Define the 3CNF formula \(\varphi = (x_1\vee \overline{x_2}\vee \overline{x_3})\wedge (\overline{x_1}\vee x_2\vee \overline{x_3}) \wedge (\overline{x_1}\vee \overline{x_2}\vee x_3)\). Write down the instance of vertex cover (both the graph \(G\)
and the parameter \(k\)) that is obtained from
\(\varphi\) via the reduction in Theorem 7.44.
Show both a satisfying assignment and a vertex cover in the graph.
Recommended Exercises #5: 7.23 and 7.40 (which is good preparation for 7.38).
Assignment #5 (DUE: Tuesday, 5/18):
- Consider the 3CNF formula \(\phi = (x_1\vee \overline{x_2}\vee x_3)\wedge
(\overline{x_1}\vee \overline{x_2} \vee \overline{x_3})\).
- Find a nice sharp pencil, a nice clean eraser, and a nice clean 8 1/2 x 11 sheet of paper.
- Using the construction given in Theorem 7.46 for \(\phi\),
draw a graph that has a Hamilton path iff \(\phi\) is satisfiable
(which it is in this case).
- Show two satisfying assignments and the corresponding two Hamilton paths in the resulting graph.
- Examine your graph and convince yourself that the only
Hamilton paths are (in the terminology of the proof of Theorem
7.46) "normal" ones. (This part doesn't have to be
handed in!)
- 7.21: Let \(G\) represent an undirected graph. Also let
$$\begin{eqnarray*}
SPATH & = & \{\langle G,a,b,k\rangle | G \mbox{ contains a simple path of}\\
& ~ & \mbox{length at most } k \mbox{ from } a
\mbox{ to } b \},
\end{eqnarray*}$$
and
$$\begin{eqnarray*}
LPATH & = & \{\langle G,a,b,k\rangle | G \mbox{ contains a simple path of}\\
& ~ & \mbox{length at least } k \mbox{ from } a
\mbox{ to } b \}.
\end{eqnarray*}$$
- Show that \(SPATH \in \) P.
- Show that \(LPATH\) is NP-complete.
- Show that each of the following are NP-complete:
- HC = \(\{\langle G\rangle | G \mbox{ has a Hamilton circuit}\}\). (A Hamilton circuit is a closed path that touches each node in the graph once.)
(HINT: Reduce from UHAMPATH.)
- TSP = \(\{\langle G, k\rangle | G \) is a weighted graph with a tour of length at most \(k\}\). (A tour is a closed path that touches each node in the graph once, as above. A weighted graph has numbers assigned to each edge. The length of a tour is just the sum of the weights of the edges in the tour. Use the result of part (a) for this proof.)
- 7.22: Let DOUBLE-SAT \( = \{\langle \phi\rangle | \phi \) has at least
two satisfying assignments\(\}\). Show that DOUBLE-SAT is
NP-complete.
- 7.26: Let \(\phi\) be a 3cnf-formula.
An \(\not =\)-assignment to the variables of \(\phi\)
is one where each clause contains two literals with unequal truth values. In other words, an \(\not =\)-assignment satisfies \(\phi\) without assigning three true
literals in any clause.
- Show that the negation of any \(\not = \)-assignment to
\(\phi\) is also an \(\not = \)-assignment.
- Let \(\not =\)SAT be the collection of 3cnf-formulas that have
an \(\not = \)-assignment. Show that we obtain a polynomial time reduction from
\(3SAT\) to \(\not =\)SAT by replacing each clause \(c_i\)
$$\begin{eqnarray*}
(y_1\vee y_2\vee y_3)
\end{eqnarray*}$$
with the two clauses
$$\begin{eqnarray*}
(y_1\vee y_2\vee z_i) ~~~\mbox{and}~~~ (\overline{z_i}\vee y_3 \vee b),
\end{eqnarray*}$$
where \(z_i\) is a new variable for each clause \(c_i\), and \(b\) is a single
additional new variable.
- Conclude that \(\not =\)SAT is NP-complete.
- 7.38: Show that if P = NP, a polynomial-time algorithm exists that produces a satisfying assignment when given a satisfiable Boolean formula.
(Note: The algorithm you are asked to provide computes a function; but NP contains languages, not functions. The P = NP assumption implies that SAT is
in P, so testing satisfiability is solvable in polynomial time. But the assumption doesn't say anything about how this test is done, and the test may not reveal a satisfying assignment. You must show that you can find them anyway. Hint: Use the satisfiability
tester repeatedly to find the assignment bit-by-bit.)
Further remarks: This is a starred problem, but it's actually not that difficult.
An alternate way to think of it is as follows: Suppose you are given an oracle
for SAT, so you can decide if a formula is satisfiable in unit time.
Use the oracle to determine a satisfying assignment, assuming the oracle says
it's satisfiable to begin with.
Recommended Exercises #6: 8.5, 8.7, 9.1, 9.2, 9.3
Assignment #6 (DUE: Tuesday, 6/1):
- 8.4: Show that PSPACE is closed under the operations union, complementation, and star.
- 8.6: Show that any PSPACE-hard language is also NP-hard.
- 8.11: Show that if every NP-hard language is also PSPACE-hard, then PSPACE=NP.
- 8.25 (should look familiar!): An undirected graph is bipartite if its nodes may be divided into two sets so that all edges go from a node in one set to a node in the other set. Show that a graph is bipartite if and only if it doesn't contain a cycle that has an odd number of nodes. Let BIPARTITE = \(\{\langle G \rangle | G\) is a bipartite graph\(\}\). Show that BIPARTITE \(\in\) NL.
- Define a reasonable definition of "verifier" appropriate for the class NL. Show that NL is the same as the class of languages with such verifiers.
- 9.6: Prove that if \(A \in \) P, then P\(^A = \) P.
- 9.12: Describe the error in the following "proof" that P \(\not = \) NP. Assume that P \( = \) NP and obtain a contradiction. If P \( = \) NP then \(SAT \in \) P, and so for some \(k\), \(SAT \in \) TIME\((n^k)\). Because every language in NP is polynomial time reducible to \(SAT\), you have NP \(\subseteq \) TIME\((n^k)\). Therefore,
P \(\subseteq \) TIME\((n^k)\). But by the time hierarchy theorem,
TIME\((n^{k+1})\) contains a language that isn't in TIME\((n^k)\), which contradicts
P \(\subseteq \) TIME\((n^k)\). Therefore P \(\not = \) NP.
- 9.20: Prove that an oracle \(C\) exists for which NP\(^C \not = \) coNP\(^C\).
Back to CS270 Home Page