Download presentation

Presentation is loading. Please wait.

Published byIris Emberton Modified over 2 years ago

1
CS2303-THEORY OF COMPUTATION 1

2

3
Turing machine is a modified version of the PDA and it is much more powerful than PDA. Instead of using stack as in PDA,the TM uses the tape to store the symbols. The TM is a generalized machine which can recognize all types of languages like the type 3 grammar to the type 0 grammar.

4
…...a1a2a3….bbb….. Control unit Read-write head Tape

5
Components are: 1.Tape: which is used to store information and is divide into cells. 2.Read-Write Head: read or write into the location it is pointing to. 3.Control Unit: the reading from or writing into tape is controlled by this unit consulting the transition table.

6
δ Tape Symbols(Γ) states a b X Y B q0 (q1,X,R) - - (q3,Y,R) - q1 (q1,a,R)(q2,Y,R) - (q1,Y,R) - q2 (q2,a,L) - (q0,X,R)(q2,Y,L) - q (q3,Y,R)(q4,B,R) q

7
Qis set of finite states Σ is set of input alphabets Γ is set of tape symbols δ is transition function q 0 is the start state B is a special symbol indicating blank character F is the set of all final states

8
Unlike the id described in PDA, in TM,the id is defined on the whole string (not on the string to be scanned) and the current state of the machine. An id of TM is a string αqβ,where q is the current state,αβ is the string made from tape symbols. Initial id :qαβ Final id :αβqB

9
The formal definition of move for TM is : Let M=(Q,,Γ,δ,q,B,F)be a TM. Let the ID of M be a a a... a k-1 qa k a k+1...a n where a j ε Г for 1jn, qεQ is the current state and a k as the next symbol to be scanned. If there is a transition δ(q,a k )=(p,b,R) then the move of machine M will be a a a..a k-1 qa k a k+1..a n |-* a a a..a k-1 b p a k+1..a If there is a transition δ(q,a k )=(p,b,L) then move of machine M will be a a a..a k-1 qa k a k+1..a n |-* a a a.. p a k-l b a k+1..a n

10
Let M=(Q,,Γ,δ,q,B,F)be a TM. The language L(M) accepted by M is defined as: L(M)={w|qw|-*αpα where wε*,pεF and α,αεΓ*} where qw is the initial ID and αpα is the final ID. The set of all those words w in * which causes M to move from start state q to the final state p. A language is said to be recursively enumerable, if it is accepted by a TM.

11
Eg: Construct a turing machine to accept the language L={01|n1}. Ans: The language accepted by TM should have n number of 0s followed by n number of 1s. General procedure: Let q be the start state and let the read-write head points to the first symbol of the string to be scanned.

12
The steps which should be followed to solve the example are: 1. Replace the left most 0 by X and change the state to q and then move the read- write head towards right. This is because, after a zero is replaced, we have to replace to the corresponding 1 so that number of zeroes matches with number of 1s. 2. Search for the leftmost 1 and replace it by the symbol Y and move towards left (so as to obtain the leftmost 0 again).Steps 1 and 2 are repeated.

13
The transitions are represented as follows: δ(q, 0)= (q, X, R) δ (q, 0)= (q, 0, R) δ (q, Y)= (q, Y, R) δ (q, 1)= (q, Y, L) δ (q, Y)= (q, Y, L) δ (q, 0)= (q, 0, L) δ (q, X)= (q, X, R) δ (q, Y)= (q, Y, R) δ (q, B)= (q, B, R)

14
A transducer accepts some input and transform that input into the desired output. The transducer for a Turing machine is a function f defined by f(w)=w' w is input before computation & w' is output after computation such that qw |-* q f w' for q f ε F

15
transducers contd… Let M=(Q,Σ,δ,q,B,F) be a Turing Machine. The function f is Turing computable if and only if qw |-* q f w' for q f ε F and w ε Γ* The arithmetic operations such as addition, subtraction etc., including the common mathematical functions are Turing computable.

16
More complex operations can be achieved using Turing Machines. The interospective ability of both TM and computer programs is what enables us to prove problems undecidable.

17
We use finite control to hold a finite amount of data state storage q- control state A,B,C- data elements The state of the machine is thought of as a tuple [q,A,B,C] q A B C

18
Another useful trick is to think of the tape of a TM as composed of several tracks. Each track can hold one symbol and the tape alphabet of the TM consists of tuples, with one component for each track. A multitrack Turing Machine is a specific type of Multi-tape Turing Machine.

19
It helps to think of TM as built from a collection of interacting components or subroutines. This set of states includes start state & another temporary state. The call of a subroutine occurs when there is a transition to its initial state.

20
We can have so many variations of Standard Turing machines. Imposing certain restrictions on TM

21
In the standard turing machine,there was no boundary specified for the left side as well as right side of the tape. In this type, we restrict the read/write head to move only in one direction. From the fig it is clear that,there are no cells to the left hand side of initial head position

22
Generalizations of the PDAs TMs can accept languages that are not accepted by any PDA with one stack. A k-stack machine is a deterministic PDA with k stacks. It obtains its input from an input source rather than having the input placed in a tape. It has a finite control, which is in one of a finite set of states. It has a finite stack alphabet, which it uses for all its stacks.

23
Finite Control Finite Control Stack 1 Stack 2 Stack 3 InputAccept/reject

24
A move of a multistack machine is based on:1.The state of the finite control 2.The input symbol read, which is chosen from the finite input alphabet 3.The top stack symbol on each stack In one move: a multistack machine can change to a new state q є Q and replace the top symbol of each stack with a string of zero or more stack symbols X є Γ*.

25
Can be thought in one of two ways. Same structure as multistack machine. Each stack in the machine is replaced by a counter. Counter hold any nonnegative integer. The move of a machine depends on the 1.current state 2.current input symbol 3.if one of the value of the counter is zero

26
Also be regarded as a restricted multistack machine. Only two stack symbols say Z 0 and X Z 0 is initially on each stack May replace Z 0 only by a string of the form X i Z 0 for some i 0 Replace X only by X i for some i 0. That is, Z 0 appears only on the bottom of each stack and all other symbols, if any, are X.

27

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google