2. Costas Busch - LSU 2
The Language Hierarchy
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww?
**ba
?
3. Costas Busch - LSU 3
*a
Regular Languages
Context-Free Languages
nn
ba R
ww
nnn
cba ww
**ba
Languages accepted by
Turing Machines
4. Costas Busch - LSU 4
A Turing Machine
............
Tape
Read-Write head
Control Unit
5. Costas Busch - LSU 5
The Tape
............
Read-Write head
No boundaries -- infinite length
The head moves Left or Right
6. Costas Busch - LSU 6
............
Read-Write head
The head at each transition (time step):
1. Reads a symbol
2. Writes a symbol
3. Moves Left or Right
7. Costas Busch - LSU 7
............
Example:
Time 0
............
Time 1
1. Reads
2. Writes
a a cb
a b k c
a
k
3. Moves Left
8. Costas Busch - LSU 8
............
Time 1
a b k c
............
Time 2
a k cf
1. Reads
2. Writes
b
f
3. Moves Right
9. Costas Busch - LSU 9
The Input String
............ ๏ ๏ ๏ ๏
Blank symbol
head
๏ a b ca
Head starts at the leftmost position
of the input string
Input string
10. Costas Busch - LSU 10
States & Transitions
1q 2qLba ,๏ฎ
Read Write
Move Left
1q 2qRba ,๏ฎ
Move Right
11. Costas Busch - LSU 11
Example:
1q 2qRba ,๏ฎ
............ ๏ ๏ ๏ ๏ ๏ a b ca
Time 1
1q
current state
12. Costas Busch - LSU 12
............ ๏ ๏ ๏ ๏ ๏ a b ca
Time 1
1q 2qRba ,๏ฎ
............ ๏ ๏ ๏ ๏ ๏ a b cb
Time 2
1q
2q
13. Costas Busch - LSU 13
............ ๏ ๏ ๏ ๏ ๏ a b ca
Time 1
1q 2qLba ,๏ฎ
............ ๏ ๏ ๏ ๏ ๏ a b cb
Time 2
1q
2q
Example:
14. Costas Busch - LSU 14
............ ๏ ๏ ๏ ๏ ๏ a b ca
Time 1
1q 2qRg,๏ฎ๏
............ ๏ ๏ ๏ ๏ ga b cb
Time 2
1q
2q
Example:
15. Costas Busch - LSU 15
Determinism
1q
2qRba ,๏ฎ
Allowed Not Allowed
3qLdb ,๏ฎ
1q
2qRba ,๏ฎ
3qLda ,๏ฎ
No lambda transitions allowed
Turing Machines are deterministic
16. Costas Busch - LSU 16
Partial Transition Function
1q
2qRba ,๏ฎ
3qLdb ,๏ฎ
............ ๏ ๏ ๏ ๏ ๏ a b ca
1q
Example:
No transition
for input symbol c
Allowed:
17. Costas Busch - LSU 17
Observation:
In order to accept an input string,
it is not necessary to scan all the
symbols in the string
18. Costas Busch - LSU 18
Halting
The machine halts in a state if there is
no transition to follow
19. Costas Busch - LSU 19
Halting Example 1:
............ ๏ ๏ ๏ ๏ ๏ a b ca
1q
1q No transition from
HALT!!!
1q
20. Costas Busch - LSU 20
Halting Example 2:
............ ๏ ๏ ๏ ๏ ๏ a b ca
1q
1q
2qRba ,๏ฎ
3qLdb ,๏ฎ
No possible transition
from and symbol
HALT!!!
1q c
21. Costas Busch - LSU 21
Accepting States
1q 2q Allowed
1q 2q Not Allowed
โขAccepting states have no outgoing transitions
โขThe machine halts and accepts
22. Costas Busch - LSU 22
Acceptance
Accept Input
If machine halts
in an accept state
Reject Input
If machine halts
in a non-accept state
or
If machine enters
an infinite loop
string
string
37. Costas Busch - LSU 37
๏ ๏ ๏ ๏ baTime 2
0q
a
๏ ๏ ๏ ๏ baTime 3
0q
a
๏ ๏ ๏ ๏ baTime 4
0q
a
๏ ๏ ๏ ๏ baTime 5
0q
a
Infiniteloop
38. Costas Busch - LSU 38
Because of the infinite loop:
โขThe accepting state cannot be reached
โขThe machine never halts
โขThe input string is rejected
39. Costas Busch - LSU 39
Another Turing Machine Example
Turing machine for the language }{ nn
ba
0q 1q 2q3q
Rxa ,๏ฎ
Raa ,๏ฎ
Ryy ,๏ฎ
Lyb ,๏ฎ
Laa ,๏ฎ
Lyy ,๏ฎ
Rxx ,๏ฎ
Ryy ,๏ฎ
Ryy ,๏ฎ
4q
L,๏ ๏ฎ๏
1๏ณn
40. Costas Busch - LSU 40
Match aโs with bโs:
Repeat:
replace leftmost a with x
find leftmost b and replace it with y
Until there are no more aโs or bโs
If there is a remaining a or b reject
Basic Idea:
55. Costas Busch - LSU 55
If we modify the
machine for the language }{ nn
ba
we can easily construct
a machine for the language }{ nnn
cba
Observation:
59. Costas Busch - LSU 59
Turing Machine:
),,,,,,( 0 FqQM ๏ ๏๏๏ฝ ๏ค
States
Input
alphabet
Tape
alphabet
Transition
function
Initial
state
blank
Accept
states
60. Costas Busch - LSU 60
Configuration
๏ ๏ ๏ ba
1q
a
Instantaneous description:
c๏
baqca 1
61. Costas Busch - LSU 61
๏ ๏ yx
2q
a b
Time 4
๏ ๏ yx
0q
a b
Time 5
๏ ๏
A Move: aybqxxaybq 02 ๏ฆ
62. Costas Busch - LSU 62
๏ ๏ yx
2q
a b
Time 4
๏ ๏ yx
0q
a b
Time 5
๏ ๏
bqxxyybqxxaybqxxaybq 1102 ๏ฆ๏ฆ๏ฆ
๏ ๏ yx
1q
x b
Time 6
๏ ๏ yx
1q
x b
Time 7
๏ ๏
A computation
64. Costas Busch - LSU 64
Initial configuration: wq0
๏ ๏ ba
0q
a b ๏
w
Input string
65. Costas Busch - LSU 65
The Accepted Language
For any Turing Machine M
}:{)( 210 xqxwqwML f
๏ช
๏ฝ ๏ฆ
Initial state Accept state
66. Costas Busch - LSU 66
If a language is accepted
by a Turing machine
then we say that is:
โขTuring Acceptable
โขRecursively Enumerable
M
L
L
โขTuring Recognizable
Other names used: