Homework 10
Last updated: Fri, 7 May 2021 09:31:24 -0400
Out: Wed April 21, 00:00 EST Due: Tue April 27, 23:59 EST
This homework covers material from Chapter 7 of the textbook.
Homework Problems
Big-O True/False (6 points)
Computing Languages With "Brute Force" (2 + 2 = 4 points)
Computing Running Time (6 points)
DFAs That Accept Everything, Is Poly Time? (6 points)
Closure Operations for Poly Time Languages (4 + 4 + 4 = 12 points)
README (2 points)
Total: 36 points
Submitting
Submit this assignment at Gradescope hw10.
should only include pdf or plain text files,
and each file must be assigned to the correct problem in Gradescope.
1 Big-O True/False
For each equality below, say whether it is true or false.
You may give an extra explanation if you think it would help clarify your answer.
4n+2 = O(n)
n^2+4n+2 = O(n)
n^2+4n+2 = O(n^2)
n^2+4n+2 = O(n\log n)
n^2+4n+2 = 2^{O(n)}
100^{11n}+5 = 2^{O(n)}
2 Computing Languages With "Brute Force"
In the DFAs and the Language They Recognize problem from Homework 2, or the NFAs and the Language They Recognize problem from Homework 3, you had to compute the language of a finite automaton by trying all strings with your "run" function.
For some given alphabet, if you wanted to call a "run" function once for each possible string, give an upper bound for the number of times "run" must be called. Express your answer as a function on n, where n is the length of the longest possible string. You may assume an alphabet of ASCII characters.
Express the answer to the first part in big-O notation.
3 Computing Running Time
Give an upper bound, i.e., use big-O notation, on the running time for the TM from Example 3.7 of the textbook, i.e., the decider for the language:
A = \{\texttt{0}^{2^n}\mid n\geq 0\}
Let m be the length of the input to the decider. Your answer should be in terms of m.
4 DFAs That Accept Everything, Is Poly Time?
Show that the \textrm{ACCEPTEVERYTHING}_{DFA} language (from the DFAs That Accept Everything problem in Homework 8) is in \textbf{\textrm{P}}.
If it would help, here’s a decider M for \textrm{ACCEPTEVERYTHING}_{DFA}:
Apply S to \left\langle D\right\rangle to get \left\langle D_{not} \right\rangle.
Apply T to \left\langle D_{not}\right\rangle and accept if T accepts, else reject.
S is a machine implementing a solution for the The Complement Operation for Regular Languages (Bonus) problem from Homework 7.
Specifically, S, on input \left\langle D \right\rangle, where D is a DFA \left\langle Q,\Sigma,\delta,q_0,F\right\rangle, changes its tape contents to \left\langle Q,\Sigma,\delta,q_0,Q - F\right\rangle.
In other words, accept states in D become non-accept states in the output, and vice versa. All other parts of the DFA are kept the same.
T is the decider for E_{DFA} from Theorem 4.4.
5 Closure Operations for Poly Time Languages
Here are some solution sketches to the Closure Operations and Turing Machines problem from Homework 6.
To show that Turing-decidable languages are closed under union:
Let M_1 and M_2 be deciders for some languages L_1 and L_2, respectively.
Then the following machine M decides L_1 \cup L_2: on input x, run M_1 on x and accept if it accepts, else run M_2 on x and accept if it accepts, else reject.
M always halts and is a decider because M_1 and M_2 are deciders and always halt.
To show that Turing-decidable languages are closed under concat:
Let M_1 and M_2 be deciders for some languages L_1 and L_2, respectively.
Then the following machine M decides L_1 \circ L_2: on input x, nondeterministically split x into all possible pairs of substrings y and z, and for each split run M_1 on y and M_2 on z, and accept if both accept, else reject.
M always halts and is a decider because M_1 and M_2 are deciders and always halt.
To show that Turing-decidable languages are closed under Kleene:
Let M_1 be a decider some language L_1.
Note: Updated this solution on 2021-04-23 to get rid of equal-length requirement
Then the following machine M decides L_1^*: on input x, nondeterministically split x into all possible equal-length splittings, and for each split run M_1 on each of the substrings in that splitting and accept if all accept, else reject. M always halts and is a decider because M_1 is a decider and always halts.
Your Tasks
Explain whether the same solution could also be used to prove closure if the languages L_1 and L_2 were instead in \textbf{\textrm{P}} and the deciders M_1 and M_2 ran in poly time.
If the answer is that the old solution cannot be used, give another proof that \textbf{\textrm{P}} is closed for the operation in question.
Remember that \textbf{\textrm{P}} is the set of languages that can be decided by a deterministic single-tape TM that runs in TIME(n^k), for some constant k.