CSE596, Fall 2015 Problem Set 4 Due Wed. 10/7

advertisement
CSE596, Fall 2015
Problem Set 4
Due Wed. 10/7
Reading. We are still finishing Chapter 2 and looking into Chapter 3. Skim sections 3.3
and 3.4, noting that the latter gives the historical origin of the terms computably/recursively
enumerable. Focus on the language K̄ on page 51, which I will re-name D for “the diagonal language,” while also reading https://rjlipton.wordpress.com/2014/11/26/cornell-cs-at-50/ (just
the first half of the “Variations” section). OK, here is the proof in its simplest form. Define D = {e(M ) : M does not accept e(M )}. Suppose (for sake of contradiction) that there
were a “quixotic” TM Q such that L(Q) = D. Then on input x = e(Q) we would get this
self-contradictory analysis:
x∈D
⇐⇒
⇐⇒
Q does not accept x,
Q does accept x,
(by definition of D since x = e(Q))
(by L(Q) = D).
Having a statement become equivalent to its negation is a contradiction in logic, so Q cannot
exist. Thus D is not c.e. Its complement, for which I’ll use the traditional name K but define
it as K = {e(M ) : e(M ) ∈ L(M )}, is c.e., since it is a “slice” of the language of the universal
Turing machine to come next week. It follows that K is c.e. but not decidable, so the class RE
of c.e./r.e. languages is different from the class REC of decidable languages. Understanding
this fact about REC and RE (and that the class REG of regular languages is a proper subclass
of REC) will be the end of what is expected on the first exam.
So the First Prelim Exam, which is definite for Monday, Oct. 12 in class period,
covers: text through page 51 (but skim/skipping sections 1.6–1.7 and 3.3–3.4), Dr. Ogihara’s
notes, and the Myhill-Nerode Theorem notes.
Office Hours and Review Session: My office hours next week begin their regular
schedule of Tuesdays 11am–12:30pm and Wednesdays 11am–1pm. The Review Session
now has a permanent room in Clemens 04, from next Monday 10/5 onward. Mike Wehar’s
other office hour remains Wednesdays 1–2pm. So we have hours the day before assignments
will be due from now on, and also hours right before them for last-minute questions.
Note that this set is due next Wednesday, not Friday—we will try to grade it by the
Friday befoe the exam. This time there are two “discussion problems” and neither has any
checkoff credit—nothing to submit but hopefully to discuss. The second one connects to the
for-credit problem (1).
(A) “Groundhog Day” is a fantasy romantic comedy movie about a guy stuck in a repeating
loop of the same day until he finds a way to “accept” his life. So let’s take a Turing machine
M that halts for all inputs and, given an input x, keep trying it the repeating inputs x, xx,
xxx, xxxx,. . . . Define the “Groundhog” language
GM = {x : for some i, M accepts xi }.
Is GM necessarily decidable? Is it c.e.? What do you think? Can you see any way to prove
your answer?
(B) Find the “lie” in the following demonstration that a Turing machine M 0 with a single
one-way-infinite tape can simulate a TM M with a single two-way-infinite tape with linear
time overhead:
1. On any input x 6= λ, M 0 first shuffles spaces inside x. Technically this means that M 0
produces the ID
I = ∧x1 %x2 %x3 . . . %xn $,
where I’ve thrown in the “UNIX ∧-$ endmarker” convention mentioned in lecture as
well. M 0 moves its head back to x1 and figuratively (not literally) enters the start state
s of M .
2. The % serves as a “secondary blank” and the alternate cells marked % represent the
virtual initially-blank left half of the two-way infinite tape of M . The idea is that
whenever M would cross from the right-half to the left-half by moving left from the cell
initially occupied by x1 , it will see the ∧ instead (which is never altered). The ∧ triggers
some special instructions that make M 0 enter a copy of the code of M that starts using
the alternate cells instead.
3. The original copy of the code is modified as well so that a single R move by M translates
into two R moves by M 0 , and a single L move by M becomes two L moves by M 0 (unless
the first moves onto the ∧). In the alternate copy, however, each L move by M becomes
two R moves by M 0 (since the alternate tape is extending right not left), and R by M
becomes two L moves by M 0 —which might hit ∧ again and trigger a crossover back to
the original side of the tape.
4. Changes to cells and S-moves are handled the same way as the original machine. In this
way M 0 simulates each step by M using at most three steps of its own—usually it is 2
steps, but a “crossover” can take 3.
5. Hence the total time is O(n) to set up the initial ID I, plus at most 3t steps by M 0 to
simulate any t virtual steps by M . This makes the overall time O(n + t) which counts
as linear time. (??)
For-credit part, please submit in class in hardcopy on Wednesday 10/7
(1) With reference to discussion problem (B)—and using ideas from the k-tapes-to-one
proof on Friday—fix the issue by not using the ID I after all. Describe your revised M 0 in
prose and show rigorously that it runs in O(n + t) time. Thus we can finally say that the two
flavors of one-tape Turing machines are equivalent not only in power but also in efficiency.
(18 pts.)
(2) Suppose A is a c.e. language, f and g are computable total functions, and B is a
language such that for all x ∈ Σ∗ , x ∈ B ⇐⇒ f (x) ∈ A, and x ∈
/ B ⇐⇒ g(x) ∈ A. Show
that B is decidable expressly by diagramming (in flowchart style) a total Turing machine MB
such that L(MB ) = B, given components MA , Mf , Mg that carry out the behavior specified
above. (18 pts., for 36 on the problem set)
Download