Академический Документы
Профессиональный Документы
Культура Документы
Domain:
Computing Functions
with
Turing Machines
f (w)
has:
Result Region:
D
f (w)
w D
f ( w) S
Integer Domain
Addition function
f ( x, y ) = x + y
Decimal:
Binary:
101
Unary:
11111
Definition:
In other words:
A function
f
is computable if
there is a Turing Machine M such that:
A function
f
is computable if
there is a Turing Machine M such that:
Initial configuration
q0 initial state
For all
w D
q0 w q f f ( w)
Final configuration
f (w)
q f final state
Domain
Initial
Configuration
For all
Final
Configuration
w D
Domain
1
PDF created with pdfFactory Pro trial version www.pdffactory.com
Example
The function
f ( x, y ) = x + y
x, y
is computable
Start
1 1
are integers
1 0 1
q0
initial state
Turing Machine:
Input string:
x0 y
unary
Output string:
xy0
unary
x
Start
1 1
1 0 1
q0 initial state
x+ y
Finish
1 1
x+ y
q f final state
1 1, R
Finish
1 1 0
1 1
1 1, R
10
Execution Example:
x = 11
(2)
y = 11
(2)
1 1, L
Time 0
1 1 0 1 1
q0
Final Result
q0 0 1, R q1 , L q2 1 0, L q3
x+ y
, R
q4
1 1 0
q f final state
f ( x, y ) = x + y
11
1 1 1 1 0
q4
12
2
PDF created with pdfFactory Pro trial version www.pdffactory.com
Time 0
1 1 0 1 1
Time 1
1 1 0 1 1
q0
q0
1 1, R
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
Time 2
, R
q4
13
1 1 0 1 1
Time 3
1 1 1 1 1
q0
1 1, R
q1
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
Time 4
, R
q4
15
1 1 1 1 1
Time 5
16
1 1 1 1 1
q1
1 1, R
14
q1
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
17
, R
q4
18
3
PDF created with pdfFactory Pro trial version www.pdffactory.com
Time 6
1 1 1 1 1
Time 7
1 1 1 1 0
q3
q2
1 1, R
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
Time 8
, R
q4
19
1 1 1 1 0
Time 9
1 1 1 1 0
q3
1 1, R
q3
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
Time 10
, R
q4
21
1 1 1 1 0
Time 11
q3
1 1, R
20
22
1 1 1 1 0
q3
1 1, R
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
1 1, R
1 1, L
q0 0 1, R q1 , L q2 1 0, L q3
, R
q4
23
, R
q4
24
4
PDF created with pdfFactory Pro trial version www.pdffactory.com
Another Example
1 1 1 1 0
Time 12
f ( x) = 2 x
The function
q4
1 1, R
1 1, R
1 1, L
Turing Machine:
Input string:
, R
q4
Output string:
unary
xx
unary
25
x
1 1
is integer
q0 0 1, R q1 , L q2 1 0, L q3
Start
is computable
26
f ( x) = 2 x
q0 initial state
Repeat:
Find rightmost $, replace it with 1
2x
Finish
1 1
1 1 1
q f final state
28
Start
f ( x) = 2 x
Example
1 1
1 1 1 1
q0
1 $, R
1 1, L
1 1, R
q0 , L q1 $ 1, R
, R
q3
q3
1 $, R
q2
Finish
1 1, L
1 1, R
q0 , L q1 $ 1, R
1, L
29
, R
q3
q2
1, L
30
5
PDF created with pdfFactory Pro trial version www.pdffactory.com
Another Example
f ( x, y ) =
The function
is computable
if
if
x>y
f ( x, y ) =
x y
Input:
Output:
if
x>y
if
x y
x0 y
1
or
31
32
x with a 1 from y
x or y is matched
( x > y)
( x y)
33
34
Example:
f ( x, y ) =
Block Diagram
input
Turing
Machine
x + y if x > y
x, y
output
x, y
Comparer
Adder
x+ y
Eraser
x> y
x y
35
if x y
36
6
PDF created with pdfFactory Pro trial version www.pdffactory.com
Turings Thesis
Intuitive answer: Yes
37
38
Turings thesis:
Any computation carried out
by mechanical means
can be performed by a Turing Machine
A computation is mechanical
if and only if
it can be performed by a Turing Machine
(1930)
39
Definition of Algorithm:
40
When we say:
There exists an algorithm
We mean:
There exists a Turing Machine
that executes the algorithm
41
42
7
PDF created with pdfFactory Pro trial version www.pdffactory.com