Turing Machines - PowerPoint PPT Presentation

1 / 69
About This Presentation
Title:

Turing Machines

Description:

The Language Hierarchy A Turing Machine The Tape The Input String States & Transitions Determinism Partial Transition Function Halting Final States Acceptance Turing ... – PowerPoint PPT presentation

Number of Views:207
Avg rating:3.0/5.0
Slides: 70
Provided by: prismGat4
Category:

less

Transcript and Presenter's Notes

Title: Turing Machines


1
Turing Machines

2
The Language Hierarchy
?
?
Context-Free Languages
Regular Languages
3
Languages accepted by Turing Machines
Context-Free Languages
Regular Languages
4
A Turing Machine
Tape
......
......
Read-Write head
Control Unit
5
The Tape
No boundaries -- infinite length
......
......
Read-Write head
The head moves Left or Right
6
......
......
Read-Write head
The head at each time step 1.
Reads a symbol 2. Writes a
symbol 3. Moves Left or Right
7
Example
Time 0
......
......
Time 1
......
......
1. Reads
2. Writes
3. Moves Left
8
Time 1
......
......
Time 2
......
......
1. Reads
2. Writes
3. Moves Right
9
The Input String
Input string
Blank symbol
......
......
head
Head starts at the leftmost position of the input
string
10
States Transitions
Write
Read
Move Left
Move Right
11
Example
Time 1
......
......
current state
12
Time 1
......
......
Time 2
......
......
13
Example
Time 1
......
......
Time 2
......
......
14
Example
Time 1
......
......
Time 2
......
......
15
Determinism
Turing Machines are deterministic
Not Allowed
Allowed
No epsilon transitions allowed
16
Partial Transition Function
Example
......
......
Allowed
No transition for input symbol
17
Halting
The machine halts if there are no possible
transitions to follow
18
Example
......
......
No possible transition
HALT!!!
19
Final States
Allowed
Not Allowed
  • Final states have no outgoing transitions
  • In a final state the machine halts

20
Acceptance
If machine halts in a final state
Accept Input
If machine halts in a non-final state
or If machine enters an infinite loop
Reject Input
21
Turing Machine Example
A Turing machine that accepts language a
22
Time 0
23
Time 1
24
Time 2
25
Time 3
26
Time 4
Halt Accept
27
Rejection Example
Time 0
28
Time 1
No possible Transition
Halt Reject
29
Infinite Loop Example
Another Turing machine for language aand is
this one correct???
30
Time 0
31
Time 1
32
Time 2
33
Time 2
Time 3
Time 4
Time 5
... Infinite Loop
34
  • Because of the infinite loop
  • The final state cannot be reached
  • The machine never halts
  • The input is not accepted

35
Another Turing Machine Example
Turing machine for the language
36
Time 0
37
Time 1
38
Time 2
39
Time 3
40
Time 4
41
Time 5
42
Time 6
43
Time 7
44
Time 8
45
Time 9
46
Time 10
47
Time 11
48
Time 12
49
Time 13
Halt Accept
50
Observation
If we modify the machine for the language
we can easily construct a machine for the
language
51
Formal Definitionsfor Turing Machines

52
Transition Function
53
Transition Function
54
Turing Machine
Input alphabet
Tape alphabet
States
Transition function
Final states
Initial state
blank
55
Configuration
Instantaneous description
56
Time 4
Time 5
ayb
q
x
xayb
q
A Move
?
0
2
57
Time 4
Time 5
Time 6
Time 7
b
q
xxy
yb
q
xx
ayb
q
x
xayb
q
?
?
?
1
1
0
2
58
b
q
xxy
yb
q
xx
ayb
q
x
xayb
q
?
?
?
1
1
0
2

b
q
xxy
xayb
q
Equivalent notation
?
1
2
59
Initial configuration
Input string
60
The Accepted Language
For any Turing Machine




)
(
x
q
x
w
q
w
M
L

?
2
1
0
f
Initial state
Final state
61
Standard Turing Machine
The machine we described is the standard
  • Deterministic
  • Infinite tape in both directions
  • Tape is the input/output file

62
Implementation-level descriptions
ww contains an equal number of 0s and 1s
63
Implementation-level descriptions
ww contains an equal number of 0s and 1s
On input string w
64
Implementation-level descriptions
ww contains an equal number of 0s and 1s
  • On input string w
  • Scan the tape mark the 1st 0 which is unmarked.
    If none is found, go to 4. Otherwise, move the
    head back to the front of the tape.

65
Implementation-level descriptions
ww contains an equal number of 0s and 1s
  • On input string w
  • Scan the tape mark the 1st 0 which is unmarked.
    If none is found, go to 4. Otherwise, move the
    head back to the front of the tape.
  • Scan the tape mark the 1st 1 which is unmarked.
    If none is found, reject.

66
Implementation-level descriptions
ww contains an equal number of 0s and 1s
  • On input string w
  • Scan the tape mark the 1st 0 which is unmarked.
    If none is found, go to 4. Otherwise, move the
    head back to the front of the tape.
  • Scan the tape mark the 1st 1 which is unmarked.
    If none is found, reject.
  • Move the head back to the front of the tape go
    to 1.

67
Implementation-level descriptions
ww contains an equal number of 0s and 1s
  • On input string w
  • Scan the tape mark the 1st 0 which is unmarked.
    If none is found, go to 4. Otherwise, move the
    head back to the front of the tape.
  • Scan the tape mark the 1st 1 which is unmarked.
    If none is found, reject.
  • Move the head back to the front of the tape go
    to 1.
  • Move the head back to the front of the tape.
    Scan the tape to see if any unmarked 1s remain.
    If none are found, accept otherwise, reject.

68
Try this one
ww contains twice as many 0s as 1s
  • On input string w
  • Scan the tape ...
  • (Hint, you can mark and double mark.)

69
Try this one
ww anbn, n ? 0
  • On input string w
  • Scan the tape ...
Write a Comment
User Comments (0)
About PowerShow.com