Download Turing Machines: Understanding Recursively Enumerable and Decidable Languages and more Slides Theory of Computation in PDF only on Docsity!
BCSE304L TOC
Turing Machine
2
Turing Machines are…
- (^) Very powerful (abstract) machines that could simulate any modern
day computer (although very, very slowly!)
- (^) Why design such a machine?
- (^) If a problem cannot be “solved” even using a TM, then it implies that the
problem is undecidable
- (^) Computability vs. Decidability For every input, answer YES or NO
4
A Turing Machine (TM)
,B,F)
…^ B^ B^ B^ X 1 X 2 X 3 …^ Xi …^ Xn B^ B …
Finite control Infinite tape with tape symbols B: blank symbol (special symbol reserved to indicate data boundary) Input & output tape symbols Tape head This is like the CPU & program counter Tape is the memory
Turing Machines
- (^) A Turing Machine (TM) has finite-state control (like PDA), and an
infinite read-write tape.
- (^) The tape serves as both input and unbounded storage device.
- (^) The tape is divided into cells, and each cell holds one symbol from the
tape alphabet.
- (^) There is a special blank symbol B. At any instant, all but finitely many
cells hold B.
- (^) Tape head sees only one cell at any instant. The contents of this cell
and the current state determine the next move of the TM.
7
Way to check for Membership
- (^) Is a string w accepted by a TM?
- (^) Initial condition:
- (^) The (whole) input string w is present in TM, preceded and followed by infinite
blank symbols
- (^) Final acceptance:
- (^) Accept w if TM enters final state and halts
- (^) If TM halts and not final state, then reject
8
Example: L = {
n
n
| n≥1}
- (^) Strategy: w = 000111 … B B^0 00 1 1 1 B^ B … … B B X^00 1 1 1 B^ B … … B B X 0 0 Y 1 1 B B … … B B X^ X^0 Y^1 1 B^ B … B B X X 0 Y Y 1 B B … … B B X X X Y Y 1 B B … B B X X X Y Y Y B B … Accept B B X X X Y Y Y B B …
10
TM for {
n
n
| n≥1}
Next Tape Symbol Curr. State
0 1 X Y B
q 0 (q 1 ,X,R) - - (q 3 ,Y,R) - q 1 (q 1 ,0,R) (q 2 ,Y,L) - (q 1 ,Y,R) - q 2 (q 2 ,0,L) - (q 0 ,X,R) (q 2 ,Y,L) - q 3 - - - (q 3 ,Y,R) (q 4 ,B,R) *q 4 - -- - - - Table representation of the state diagram *state diagram representation preferred
11
TM for {
n
2n
| n≥1}
q 0 q 1
0 X,R
0 0,R
q 3
1 Y,L
Y Y,L
0 0,L
X / X,R
q 4
Y Y,R
Y Y,R
q 5
B B,R
Y Y,R
q 2
1 Y,R
- (^) Draw a Turing machine for L = {a^i b^j c^k | i>j>k; k ≥ 1}
- (^) Draw Turing machines for L={w#w, w is from {0,1}*}}
A language is called Turing-recognizable or
recursively enumerable (r.e.) if some TM
recognizes it.
A language is called decidable or recursive
if some TM decides it.
recursive
languages
r.e.
languages
recursive
languages
r.e.
languages
Decidable Vs Recursive Enumerable
Whether the following languages are decidable?
1. {a
n
b
2n
| n≥1}
2. {ww | n≥1}
3. {a
n
b
2n
a
n
| n≥1}
4. {a
n
b
m
a
n
| n≥1}
5. {(ab)
n
c
n
(ad)
n
| n≥1}