CMPSCI 501: Theory of Computation
Second Midterm Exam, Spring 2017
David Mix Barrington
11 April 2017
Directions:
- Answer the problems on the exam pages.
- There are eight problems (some with multiple parts)
for 125 total points.
Actual scale was A = 100, C = 64.
- If you need extra space use the back of a page.
- No books, notes, calculators, or collaboration.
- The first six questions are statements -- in each case say
whether
the statement is true or false and give a convincing justification
of your answer --
a proof, counterexample, quotation from the book or from lecture, etc.
You get five points for the correct boolean answer (so
there is no reason not to guess if you don't know) and up to five for
the justification.
Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 10 points
Q6: 10 points
Q7: 30 points
Q8: 35 points
Total: 125 points
The set N of natural numbers is {0, 1, 2, 3,...}, not quite as
defined in Sipser.
For this exam, the input alphabet of all machines will be Σ =
{0, 1}.
A palindrome is a string that is equal to its own reversal.
Let PAL = {w: w is a palindrome}.
If C is any class of things that have languages, such as DFA's, CFG's, TM's, strange
variant TM's, etc., remember that (M) is the canonical string
representing the thing M in C. We define the following languages:
- AC = {(M, w): M is a computer in C and w ∈ L(M)}
- EC = {(M): M is a computer in C and L(M) =
∅}
- ALLC = {(M): M is a computer in C and L(M) =
Σ*}
- SINGC = {(M): M is a computer in C and L(M)
has exacctly one element}
A language is Turing recognizable (TR) if it is equal to
L(M) for some Turing machine M.
A language is Turing decidable (TD) if it is equal to L(M)
for some Turing machine M that halts on every input.
A language is co-TR if and only if its complement is TR.
(Similarly for co-NP, etc.)
A function f from strings to strings is Turing computable
if there exists a Turing machine M such that for any string w, M
when started on w halts with f(w) on its tape. It is poly-time
computable if in addition, M always computes f(w) using time
polynomial in the length of w.
Recall that if A and B are two languages, A is mapping
reducible to B, written A ≤m B, if there exists a
Turing computable function f: Σ* →
Σ* such that for any string w, w ∈ A ↔
f(w) ∈ B. A is poly-time reducible to B, written
A ≤p B, if in addition the function f is poly-time
computable.
The language BPCP, for Bounded Post Correspondence
Problem, is the set of pairs (P, m) were P is a sest of dominoes
(as in the ordinary PCP), m is a number written in binary, and P has
a match that uses at most m total dominoes. (Recall that a match
can use the same domino multiple times, and we are counting them
with multiplicity. For example, the same domino used 100 times
counts as 100 dominoes.)
The following languages were proved to be NP-complete either in the
text of Sipser or in the exercises. You may assume without proof
that they are NP-complete.
- 3-SAT = {φ φ is a satisfiable formula in 3-CNF}
- 3-COLOR = {G: G is an undirected graph and the vertices of
G may each be assigned one of three colors so that no edge
connects two vertices of the same color}
- DHAMPATH = {(G, s, t): G is a directed graph in which
there is a directed path from vertex s to vertex t such that the
path visits each vertex of G exactly once}
- SUBSET-SUM = {(a1,..., ak, t): the
ai's and t are binary positive integers and there is a
subset of the ai's that adds to exactly t}
- CLIQUE = {(G, k): G is an undirected graph and G has a set
S of k vertices such that every two distinct vertices in S have an
edge between them}
- VERTEX-COVER = {(G, k): G is an undirected graph and G has
a set S of k vertices such that every edge in G has at least one
endpoint in S}
The following two languages are to be proved NP-complete on this
exam:
- PIC = {(G, k): G is an undirected graph and the vertices of
G may be partitioned into k disjoing subsets such that for each
subset S, every two distinct vertices in S have an edge between
them} (The name of the language abbreviates Partition Into
Cliques.)
- KNAPSACK = {(w1, v1),...,
(wk, vk), wt, vt): the wi's,
vi's, wt, and vt are binary positive integers and
there is subset of the i's such that the wi's in the
subset add to exactly wt, and the vi's in the subset
add to at least vt.} (Think of the input as defining k
items, each with a weight and a value. We
want a set of items for our knapsack that meets the weight
target exactly, while meeting or exceeding the value
taget.