- 68 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Turing Machines' - deacon-wong

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

### Turing Machines

Hopcroft, Motawi, Ullman,Chap 8

Models of computation

- Finite automata and regular expressions
- Represent regular languages
- Can’t “count”

- Grammars and pushdown automata
- Represent context free languages
- Can count and remember symbols once

- Turing machines
- Represent recursive languages
- Models contemporary programs

Turing Machine Model

- Input tape surrounded by infinitely many blanks
- Tape head can move back and forth the tape and replace current symbol

…

…

BBBBBBB000111BBBBB

TM

TM definition

- A Turing Machine M is a tupleM = (Q, , , , q0, B, F), where:
- Q is a set of states
- is the input alphabet
- is the tape alphabet = {B} other tape symbols
- : Q Q D is the state transition function mapping (state, symbol) to (state, symbol, direction);D = {,}; may be undefined for some pairs
- q0 is the start state of M
- Bis the blank symbol (default symbol on input tape)
- F Q is the set of accepting states or final states of M(if applicable)

TM that accepts 0n1n

- Q={q0,q1 ,q2,q3,q4}, ={0,1}, ={0,1,B,Y}
- defined as follows:
- (q0,0) = (q1,B,) erase leftmost 0
- (q1,0) = (q1,0,) move to right until a 1(q1,Y) = (q1,Y,) is encountered, replace(q1,1) = (q2,Y,) that 1 with Y
- (q2,Y) = (q2,Y,) move to left until a blank(q2,0) = (q2,0,) is encountered, then go(q2,B) = (q0,B,) back to initial state
- (q0,Y) = (q3,Y,) if Y on tape go to state 3
- (q3,Y) = (q3,Y,) ensure only Y’s remain on tape(q3,B) = (q4,B,) accept once B is seen (F={q4})

TM that increments a bit-string

- Q={q0,q1 ,q2,q3}, ={0,1}, ={0,1,B,X}
- defined as follows:
- (q0,0) = (q0,0,) go to rightmost(q0,1) = (q0,1,) non-blank(q0,B) = (q1,B,)
- (q1,1) = (q1,0,) replace 1’s with 0’s(q1,0) = (q2,1,) until 0/B is encountered, (q1,B) = (q2,1,) replace that 0/B with a 1
- No applicable transitions from q2 means the turing machine halts

Instantaneous descriptions

- Instantaneous description (ID): depicts the characteristics of the machine as transitions are carried out
- For finite automata, the state of the machine and the remaining input is sufficient

- For TM’s, the following are needed for an ID:
- State
- Symbols on the tape
- Position of the tape head

- Can be expressed as X1X2…Xi-1qXiXi+1…Xnwhich means the TM is in state q, the tape contains X1X2…Xn and the tape head is at Xi

ID example

- Suppose for the first TM example,the input is 0011
- The initial ID is q00011

- After applying the transition(q0,0) = (q1,B,), ID: q1011
- Depict this as a move: q00011 |q1011

- Next 3 transitions:(q1,0) = (q1,0,), ID: 0q111(q1,1) = (q2,Y,), ID: q20Y1(q2,0) = (q2,0,), ID: q2B0Y1
- Eventually, ID will be YYBq4 (TM accepts)

TM as recognizer

- A TM accepts a string w if there exists a sequence of moves fromID q0w to ID uqfv (u,v *, qf F)
- q0w |* uqfv
- In the previous example, q00011 |* YYBq4

- Given a TM M, L(M) is the set of all strings that M accepts
- A language recognized by a TM is called a recursively enumerable language

TM halting on input

- TMs are also useful for computation
- In this case, what is important is the machine halts on input w (and leaves the appropriate output on the tape)
- A TM halts on input w if there exists a sequence of moves fromID q0w to ID uqixv (u,v*, x, qiQ)& (qi,x) is undefined (no transition applies)
- The TM can be viewed as a function; f(w) = uxv

About TMs

- Church-Turing Thesis: TMs represent what can be solved by a computer program(a mathematically unprovable statement)
- Some problems cannot be solved by a TM (e.g., the Halting Problem)
- TMs can be deterministic or nondeterministic; the variation helps in modeling problem complexity classes (P and NP)

Download Presentation

Connecting to Server..