Exercise 2 handout - Department of Computer Science

advertisement
CSC 363 H1F
Worth: 2%
Homework Exercise # 2
Fall 2010
Due: By 12 noon on Wednesday 29 September
Remember to write your full name and student number prominently on your submission.
Please read and understand the policy on Collaboration given on the Course Information Sheet. Then, to protect
yourself, list every source of information you used to complete this homework (other than your own lecture and
tutorial notes, the course webpage, and the required textbook) on the front of your submission. For example,
indicate clearly the name of every student with whom you had discussions, the title of every additional textbook
you consulted, the source of every additional web document you used, etc.
For each question, please write up detailed answers carefully. Make sure that you use notation and terminology
correctly, and that you explain and justify what you are doing. Marks will be deducted for incorrect or ambiguous
use of notation and terminology, and for making incorrect, unjustified, ambiguous, or vague claims in your solutions.
1. A “Functional Turing Machine” (FTM) is similar to a regular TM except that it captures the notion of
computing some function f ∶ Σ∗ → Σ∗ (rather than deciding some language L ⊆ Σ∗ ).
Technically, an FTM does not have special “accepting” and “rejecting” states (qA , qR )—all states are similar,
except for one singled-out initial state. An FTM does not have a full transition function δ defined for all
q ∈ Q − {qA , qR }, a ∈ Γ—instead, it has a set ∆ of individual transitions (q, a, r, b, d) ∈ Q × Γ × Q × Γ × {L, R},
where no two transitions in ∆ have the same first two components—to guarantee it is deterministic.
On input w ∈ Σ∗ , an FTM starts in initial configuration “⊔ q0 w” (where q0 is the FTM’s initial state), and
carries out its computation in the same way as a regular TM. There are three possible outcomes:
● The FTM eventually reaches a configuration “⊔ q z” for some z ∈ Σ∗ such that there is no transition in
∆ from state q on the first symbol of z. In this case, we say that the FTM computes value z on input
w, i.e., f (w) = z.
● The FTM eventually reaches some other configuration (with the head on some square other than the
second square, or the leftmost square not blank, or the rest of the tape containing some symbols outside
the input alphabet) for which there is no transition. In this case, we say that the FTM does not provide
a value on input w, i.e., f (w) is undefined.
● The FTM never halts. In this case also, we say that the FTM does not provide a value on input w, i.e.,
f (w) is undefined.
Note that with this convention, every FTM defines a unique partial function, i.e., a function that may be
undefined for some values of its argument. By contrast, a function that is defined for every value of its
argument is said to be total.
Write a detailed proof that a total function f ∶ Σ∗ → Σ∗ is “computable” (i.e., there is some FTM that
computes f (w) for all w ∈ Σ∗ , as described above) if and only if the language Lf = {w#f (w) ∶ w ∈ Σ∗ } is
decidable, where # ∉ Σ is a special symbol. (Note that the input/output alphabet for f is Σ, while the input
alphabet for Lf is Σ ∪ {#}.)
Give implementation-level descriptions in your proof, leaving out details of the exact states used to carry
out various stages, but including details of the tape contents and how various portions of the tape are used
to carry out parts of the computations.
Dept. of Computer Science, University of Toronto (St. George Campus)
Page 1 of 1
Download