0% found this document useful (0 votes)
44 views18 pages

Turing Machine 1

Uploaded by

geetha megharaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views18 pages

Turing Machine 1

Uploaded by

geetha megharaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

FSM-Regular languge

PDA : powerful than FSM, CFL


Turing Machine : Recursively Enumerable Language

Data structures
FSM : only Input string, control, limited power
PDA : Input string, stack, remember, more powerful, CFL
TM : Tape, sequence of infinite symbols, tape head, pointer read
write head
Alan Turing in 1936 gave various models using the concept of
Turing machines.

The Turing's formulation is accepted as a model of algorithm or


computation. The Church-Turing thesis states that any
algorithmic procedure that can be carried out by human
beings/computer can be carried out by a Turing machine.
Representation of Turing Machine

• Turing Machine is represented by-


• M=(Q,, Γ,δ,q0,B,F) ,
• Where
• Q is the finite state of states
•  a set of τ not including B, is the set of input symbols,
• τ is the finite state of allowable tape symbols,
• δ is the next move function, a mapping from Q × Γ to
• Q × Γ ×{L,R}
• Q0 in Q is the start state,
• B a symbol of Γ is the blank,
• F is the set of final states.
TRANSITION FUNCTION
 One move (denoted by |---) in a TM does the
following:

δ(q , X) = (p ,Y ,R/L)

 q is the current state


 X is the current tape symbol pointed by tape head
 State changes from q to p
TURING MACHINE AS LANGUAGE ACCEPTORS
 A Turing machine halts when it no longer has available
moves.
 If it halts in a final state, it accepts its input, otherwise it
rejects its input
TURING MACHINE MODEL

The Turing machine can be thought of as finite control


connected to a R/W (read/write) head. It has one tape
which is divided into a number of cells.

Block Diagram
• Each cell can store only one symbol.
• The input to and the output from the finite state automaton are
effected by the R/W head which can examine one cell at a time.
• In one move, the machine examines the present symbol under
the R/W head on the tape
• The present state of an automaton to determine
(i) a new symbol to be written on the tape in the cell under the
R/W head,
(ii) a motion of the R/W head along the tape: either the head
moves one cell left (L). or one cell right (R),
(iii) the next state of the automaton, and
(iv) whether to halt or not.
Design a TM that accepts {0n1n | n>=1}.

Solution

the following moves:


(a) If the leftmost symbol in the given input string w is 0, replace it by x and
move right till we encounter a leftmost 1 in w. Change it to y and move
backwards.
(b) Repeat (a) with the leftmost 0. If we move back and forth and no 0 or 1
remains. move to a final state.
(c) For strings not in the form 0n1n , the resulting state has to be nonfinal.
q0aabb |-xxq2yy
|-xq1abb |-xq2xyy
|-xaq1bb |-xxq0yy
|-xaq2yb |-xxyq3y
|-xq2ayb |-xxyyq3
|-q2xayb |-xxyyqf
|-xq0ayb
|-xxq1yb
|-xxyq1b
δ (q0,a) |-(q1, x, R)
δ (q1,a) |-(q1, a, R)
δ (q1,b) |-(q2, y, L)
δ (q2,a) |-(q2, a, L)
δ (q2,x) |-(q0, x, R)
δ (q1,y) |-(q1, y, R)
δ (q2, y) |-(q2, y, L)
δ (q0, y) |-(q3, y, R)
δ (q3,y) |-(q3, y, R)
δ (q3, □) |-(qf, □)
Solution
Before designing the required Turing machine M, let us evolve a procedure for processing the input string
aabbcc. The processing is done by using five steps:

Step 1 q0 is the initial state. The RJW head scans the leftmost a , replaces a by x, and moves to the right. M
enters q1
Step 2 On scanning the leftmost b, the RJW head replaces b by y and moves to the right. M enters q2
Step 3 On scanning the leftmost c. the RJW head replaces c by z, and moves to the right. M enters q3
Step 4 After scanning the rightmost c, the RJW heads moves to the left until it finds the leftmost a
Step 5 Steps 1-4 are repeated until all a’s, b's and c's are replaced by x,y,z respectively
q0aabbcc |-xxyq1bzc
|-xq1abbcc |-xxyyq2zc |-xxyyq4zz
|-xaq1bbcc |-xxyyzq2c |-xxyyzq5z
|-xayq2bcc |-xxyyq3zz |-xxyyzzq5
|-xaybq2cc |-xxyq3yzz |-xxyyzzqf
|-xayq3bzc |-xxq3yyzz
|-xaq3ybzc |-xq3xyyzz
|-xq3aybzc |-xxq0yyzz
|-q3xaybzc |-xxyq4yzz
|-xq0aybzc
|-xxq1ybzc
δ (q0,a)=(q1, x, R)
δ (q1,a)=(q1, a, R)
δ (q1,b) =(q2, y, R)
δ (q2,b) =(q2, b, R)
δ (q2,c) =(q3, z, L)
δ (q3,b) =(q3, b, L)
δ (q3,y) =(q3, y, L)
δ (q3,a) =(q3, a, L)
δ (q3,x) =(q0, x, R)
δ (q1,y) =(q1, y, R)
δ (q2,z) =(q2, z, R)
δ (q3,z) |-(q3, z, L)
δ (q0,y) |-(q4, y, R)
δ (q4,z) |-(q5, z, R)
δ (q5, □) |-(qf, □, R)

You might also like