Professional Documents
Culture Documents
Lecture 14-16
Ref. handout page 57 -65
an Turing
1912-1954
Great mathematician
The father of
the modern computer
Alan Turing`s Statue
at BIetchIey Park
Betchey Park
is near Miton Keynes
Haf hour from London
istorical Notes
For a ong time it was beieved that any
mathematica probem coud, at east in
principe, be proved from the basic axioms
1931, Kurt Gde proposed the theorem of
undecidabiity there exist theorems
which can neither be proved or disproved
Later, onso Church and an Turing
aso found other probems which had no
agorithmic soution
lan Turing was interested in
whether there was a way to define which
probems were/were not decidabe
(computabe)?
can we create a machine to simuate the
human brain so that those computabe
probems can be soved automaticay?
1935-36, Turing was working on a paper,
"computabe numbers. The Turing machine
in this paper turned out to be the simpest
prototype of a computers!
Turing`s Idea
thinks
State of mind changes
reads
The Turing Machines
nfiniteIy Iong) tape one symboI per square
control
unit
Current
state
Read/Write
head
...... ......
Turing Machine Conceptualization
start
reset
L
_
check
stop
check
carry
1
1
0
0
L
L
carry
carry
carry
carry
0
1
1
_
_
stop
stop
Cont. change to 3-tape TM
S 1 1 R S S 0 0 R S S L C
Program tape
1 1 0 1
S
Data tape
Extra tape
hat`s so $pecial?
UTM
The ever
many ifting jobs
The whee
ots of uses
UTM
anything you can
'program'
Memo Ior In-class test 15 | /5|
questions my
answers
correct
answers
comments
1
2
3
4
5
Real Computer
Contro unit:
processor
Data tape:
user memory
Program tape:
program memory
Extra tape:
system memory
/O faciities added
TMs and Real` Computer - 2
Write a TM which
simuates a PC
nything a rea computer can do,a TM can do
TM
TMs and Real` Computer - 1
Write a Java program
which simuates a TM
nything a TM can do, a rea computer can do
TM
The Church-Turing Thesis
nything which can be computed can be
computed by a Turing Machine
nything which can't be done by a TM
can't be done by any computer
.orollary
$o ......
f there is anything a TM can't do
it probaby can't be done
s there anything which
TMs can't do???
But may be a TM can do anything
we can imagine (?)
Decision Problems
t is harder to say what we wi never be
abe to do rather than what we can do
(.omputable).
Consider ony simper probems decision
probems where the answer is 'yea' or 'no'.
Consider ony TMs with two hat states
'yes' and 'no'.
probem is de.idable if we can have a
TM for it which eventuay enters either the
'yes' or 'no' state depending on its input.
The alting Problem
...... n searching of an undecidabe probem.
The best-known such probem is caed the
halting problem.
Given an arbitrary program with an arbitrary
input, can we make a Turing Machine to test
whether the program stop or oop forever?
The Barber Paradox (by Bertrand Russell )
n.e upon a time, a
village barber put a
noti.e outside his shop
shave a and ony those
men in the viage who do
not shave themseves.
Q. Does the barber shave
himsef?
The Barber Paradox
U = { every man in the viage }
S = { men shave themseves }
U \ S = { men don't shave themseves}
Where does the barber beong to, S or U \ S ?
The Barber Paradox trouble in either ways
ssume: the barber does shave himsef
ny man in this viage who shaves himsef is
not shaved by barber.
Therefore, the barber does not shave himsef.
ssume: the barber doesn't shave himsef
ny man in this viage is shaved by the barber
if and ony if he is not shaved by himsef.
Therefore, the barber does shaves himsef.
hy is the Barber Paradox important?
paradox with importance to mathematica
ogic and set theory.
t was constructed to demonstrate the sef-
contradictory nature of the eementary set
theory
t underies the proof of an Turing's proof of
the undesirabiity of the hating probem.
Program Testing
(another way to look at the halting problem)
Java program is stored in a fie
The tite is caed 'abc.java'
have tested 'abc' with different data
t aways works
t's never got into an infinite oop
Can be sure it never wi for any input?
utomated Program Testing
fie containing
a program
fie of test data
Prog Test
MyTest
infinite oop /hat
The Java Prog Test Class
public class Prog Test
Running MyTest
java MyTest MyTest.java
command to
run java
MyTest
(program
To test)
with itsef
as data
$uppose It Loops
static public void main(String` args)
String s = args`; s = y%est.java
if(ProgTest.halt(ss))
loop forever
while(true) continue;
Prog%est.haIty%est.java y%est.java")
The Dilemma
f it hats it oops forever ...
f it oops forever it hats ...
The $olution
The resut is nonsense
MyTest must hat or oop
We got into this mess by assuming that
!rogTest.halts coud be written
So !rogTest.halts doesn't (can't) exist.
Conclusion
!rogTest.halts can't be written
No program exists which can te whether any
given program hats for any given data
There are some things computer can't do
Memo Ior In-class test 16 | /5|
questions my
answers
correct
answers
comments
1
2
3
4
5