150 likes | 264 Views
Computability. Catch up last lecture. Turing machines. Variations Homework: Check out videos. Describe certain TMs. What next?. It wasn't done this way, but, how can we define a machine more powerful than PDA (which was more powerful than FSM)
E N D
Computability Catch up last lecture. Turing machines. Variations Homework: Check out videos. Describe certain TMs
What next? • It wasn't done this way, but, how can we define a machine more powerful than PDA (which was more powerful than FSM) • Still talking about recognizers: something that accepts a string as a member of a language • Put input on tape • Add scanning back and forth • Add writing on the tape • Keep finite number of states • Keep finite rules
Turing Machines Informal definition: • Finite number of states • Tape without end. Finite input starts at one end. A special symbol stands for blank. Initial tape holds input and then blanks. • TM can write on the tape and • TM can go back and forth. • TM accepts a string (which may no longer be on the tape) if it stops in a state labeled as an accepting state. • TM rejects a string if it stops in a state labeled as a rejecting state. • TM may not stop!
Turing Machines Formal definition: A TM is a 7-tuple: Q set of states A input alphabet G tape alphabet, including a blank character and A is contained in G. The TM can write and read extra symbols. Transition function: f: QxG QxGx {L,R}, meaning for each pair of states and symbols in tape alphabet, there is a [possibly new] state, a possibly, new symbol written on the tape, and the TM head moves left or right. q0 is the initial state qaccept is a state in Q that is the accepting state. qreject is a state in Q that is the rejecting state. Not equal to accepting state.
Alternative formalism • TM is a set of quintuples: <qj,ai,qk,bn,M> where M is L for left or R for right or H for halt and interpretation for <qj,ai,qk,bn,R> would be: in state qj reading ai, change to state qk, write bn and move right on the tape. • [Note: some books use quadruples: you write or move, not both. Can simulate the quintuple way by specifying additional states.]
Comment • Using quintuples may be easier way to think about the transition function, especially when adding non-determinism. • Think: is there a quintuple starting with qj,ai, ? or Take all the quintuples …
Advance notice • Later, define TM for computing functions • input is encoded on tape • (n+1) 1s standing for the the number n • output is what remains on the tape after TM halts.
FSM can be simulated by TM • How?
FSM • Define a TM with the same states as the FSM plus 1 designated accepting state and 1 designated reject state. • Starting state is the TM starting state.. • Nearly same transition function: state q scanning symbol a goes to state p and move right if state q goes to state p in FSM. Never write on the tape. • When machine sees blank, if in one of accepting states for the FSM, go to new designated accepting state for TM. If NOT in one of the FSM accepting states, go to the new designated reject state.
Pushdown automata What to do? • Add new tape symbols for start S and end E of stack and create additional states, including start state, that scans to end of input string and places S and E • 1011 input. add 1011SE • Using instructions of PDA, for every instruction that has state q, scanning a, add b to stack, change to state p • ???
FSM examples directly • {1n | n is divisible by 3 } • { larry, curly, moe} • { all strings w that contain larry, curly, moe somewhere } • ?
PDA example directly • {wwR | w a string in {0,1}* }
{ww | w a string in {0,1}* } • So we don't have a stack, but we can write on tape, specifically we can erase….
Classwork/Homework Describe TMs to recognize • {0n1n | n>=0} • {anbncn | n >= 0} • {0p | p = 2n for n>=0} See Sipser text. For each compare to what is allowed and what is not allowed (available) in FSM or PDA.
Homework • Video clip of sections from one of Turing's papers:http://www.youtube.com/watch?v=mPec64RUCsk&feature=related • Post response on moodle