=========================================================================== CSC 363H Lecture Summary for Week 2 Fall 2007 =========================================================================== Definitions: - Recall a language L is simply a subset of S* (set of all strings over alphabet S). - L is "Turing-recognizable" (recognizable/semi-decidable/recursively enumerable) if there is some TM M such that L = L(M). - L is "Turing-decidable" (decidable/recursive) if there is some TM M that halts on every input such that L = L(M). Such a TM is called a "decider". Previous examples show { 0^{2^n} | n >= 0 } and { w#w | w in {0,1}* } are decidable. We will see many other examples. -------- Variants -------- How do we know TMs are the "right" model? Consider different decisions we made when defining TMs and how they affect the outcome. Compare different models by the languages they recognize: models that can recognize the same class of languages are equivalent. Example: Finite-State Automata (FSA) are NOT equivalent to TMs (they are strictly weaker), because every language recognized by a FSA is regular and can be recognized by a TM, but TMs can recognize non-regular languages, such as { w#w | w in {0,1}* } or { 0^n1^n : n in N }. Turing machines with "stay put" head movement: - Allow head to stay on same square during a transition. Formally, d : Q-{q_A,q_R} x T -> Q x T x {L,R,S}. - Equivalent to TM: simulate stay put move by moving right to "extra" state then left to correct state (need more than one extra state). - Details: next problem set... Turing machines with doubly infinite tape: - Similar to regular TMs except no leftmost square. Tape initially all blank except for input, and head starts on first symbol of input. - Equivalent to regular TM: (main idea only) . Doubly-infinite tape TMs can simulate regular TMs: use a few extra states at start of computation to write a special symbol to the left of input; then, during computation, remain in same state and move right whenever special symbol is read. . Regular TMs can simulate doubly-infinite tape TMs: start by placing special symbol on leftmost square (shift input one square right); during computation, whenever special symbol is read, shift entire tape content one square right (insert blank), then return to leftmost blank square to continue computation. . Details: see separate notes on website. - Note that both directions are necessary (even if one is easier). Multi-tape Turing machines: - Allow more than 1 tape, each with independent head. Initially, all tapes blank except tape 1 that contains input. In one step, current state and symbols read on all tapes determine next state, symbols written and head movements for all tapes. Formally, d : Q-{q_A,q_R} x T^k -> Q x T^k x {L,R}^k. Note: Different from k independent machines running concurrently! - Equivalent to TM: keep track of contents of k tapes separated by special symbol, as well as head positions by using additional symbols (duplicates of tape alphabet), and use additional states to remember k symbols to read/write (since k is fixed). Simulating one step of multi-tape machine requires single-tape machine to scan over its entire tape twice: once to read k tapes, once to update k tapes. Other direction is trivial since 1 tape is just a special case of k tapes. - Details: Theorem 3.13 on p.149. Enumerators: - No input but two tapes and a special state q_print (q_P for short). Machine starts with both tapes blank and whenever it enters state q_P, string written on second tape is "printed". Language is set of strings printed during computation (could be infinite if computation never halts). - Example: Enumerator with states {q_P,q_A,q_R}, tape alphabet {_,0,1}, initial state q_P, and transition function d(q_P,a,a) = (q_P,a,L,0,R) for all a in tape alphabet. Language = { e, 0, 00, 000, ... } = 0* ('e' is empty string). - Equivalent to TMs: next week. Computing functions: - More "natural" notion of computing: TM works on input w and "produces" output f(w) (string left on tape when machine halts). Many possible formal definitions, depending on specific details. - Corresponds to recognizable languages -- see next week's exercises. --------------------------------------------------------------------------- [The following material was not covered during lecture.] More details on the difference between regular TMs and TMs that compute functions ("functional TMs"). - A regular TM with initial state q_1 begins computation in the configuration q_1 w (where w is the input string), then proceeds from one configuration to the next according to its state transition function. The TM either accepts w (by entering its accept state q_A), or rejects w (by entering its reject state q_W), or loops on w (when it never enters either q_A or q_R). - A functional TM (FTM) with initial state q_1 begins computation in the configuration q_1 w (where w is the input string), then proceeds from one configuration to the next according to its state transition function. FTMs are guaranteed to always end their computation in the accepting state q_A, with the string f(w) on the tape (i.e., f(w) is simply whatever string is left on the tape when the FTM accepts). In other words, FTMs never reject their input or enter infinite loops (although, we could extend the description to include these cases). The TM described in the "Example of Turing Machine Description" posted at the end of week 1 is *almost* a FTM, because it sometimes rejects its input. It would be a FTM if we changed each transition to q_R into a transition to q_A, so that no input string is rejected.