Turing Machines - PowerPoint PPT Presentation

About This Presentation
Title:

Turing Machines

Description:

Definition: A function is computable if. there is a Turing Machine such that: ... separates the two numbers. Costas Busch - RPI. 71. Start. Finish. final state ... – PowerPoint PPT presentation

Number of Views:124
Avg rating:3.0/5.0
Slides: 99
Provided by: costas
Learn more at: http://www.cs.rpi.edu
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
Input string
Blank symbol
......
......
head
Remark the input string is never empty
11
States Transitions
Write
Read
Move Left
Move Right
12
Example
Time 1
......
......
current state
13
Time 1
......
......
Time 2
......
......
14
Example
Time 1
......
......
Time 2
......
......
15
Example
Time 1
......
......
Time 2
......
......
16
Determinism
Turing Machines are deterministic
Not Allowed
Allowed
No lambda transitions allowed
17
Partial Transition Function
Example
......
......
Allowed
No transition for input symbol
18
Halting
The machine halts if there are no possible
transitions to follow
19
Example
......
......
No possible transition
HALT!!!
20
Final States
Allowed
Not Allowed
  • Final states have no outgoing transitions
  • In a final state the machine halts

21
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
22
Turing Machine Example
A Turing machine that accepts the language
23
Time 0
24
Time 1
25
Time 2
26
Time 3
27
Time 4
Halt Accept
28
Rejection Example
Time 0
29
Time 1
No possible Transition
Halt Reject
30
Infinite Loop Example
A Turing machine for language
31
Time 0
32
Time 1
33
Time 2
34
Time 2
Time 3
Infinite loop
Time 4
Time 5
35
  • Because of the infinite loop
  • The final state cannot be reached
  • The machine never halts
  • The input is not accepted

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

53
Transition Function
54
Transition Function
55
Turing Machine
Input alphabet
Tape alphabet
States
Transition function
Final states
Initial state
blank
56
Configuration
Instantaneous description
57
Time 4
Time 5
A Move
58
Time 4
Time 5
Time 6
Time 7
59
Equivalent notation
60
Initial configuration
Input string
61
The Accepted Language
For any Turing Machine
Initial state
Final state
62
Standard Turing Machine
The machine we described is the standard
  • Deterministic
  • Infinite tape in both directions
  • Tape is the input/output file

63
Computing FunctionswithTuring Machines

64
A function
has
Result Region
Domain
65
A function may have many parameters
Example
Addition function
66
Integer Domain
Decimal
5
Binary
101
Unary
11111
67
Definition
A function is computable if there is
a Turing Machine such that
Initial configuration
Final configuration
final state
initial state
For all
Domain
68
In other words
A function is computable if there is
a Turing Machine such that
Initial Configuration
Final Configuration
For all
Domain
69
Example
is computable
The function
are integers
Turing Machine
Input string
unary
Output string
unary
70
Start
initial state
The 0 is the delimiter that separates the two
numbers
71
Start
initial state
Finish
final state
72
The 0 helps when we use the result for other
operations
Finish
final state
73
Turing machine for function
74
Execution Example
Time 0
(2)
(2)
Final Result
75
Time 0
76
Time 1
77
Time 2
78
Time 3
79
Time 4
80
Time 5
81
Time 6
82
Time 7
83
Time 8
84
Time 9
85
Time 10
86
Time 11
87
Time 12
HALT accept
88
Another Example
is computable
The function
is integer
Turing Machine
Input string
unary
Output string
unary
89
Start
initial state
Finish
final state
90
Turing Machine Pseudocode for
  • Replace every 1 with
  • Repeat
  • Find rightmost , replace it with 1
  • Go to right end, insert 1

Until no more remain
91
Turing Machine for
92
Example
Start
Finish
93
Another Example
if
The function
if
is computable
94
Turing Machine for
if
if
Input
or
Output
95
Turing Machine Pseudocode
  • Repeat

Match a 1 from with a 1 from
Until all of or is matched
  • If a 1 from is not matched
  • erase tape, write 1
  • else
  • erase tape, write 0

96
Combining Turing Machines

97
Block Diagram
Turing Machine
input
output
98
Example
if
if
Adder
Comparer
Eraser
Write a Comment
User Comments (0)
About PowerShow.com