Download presentation
Presentation is loading. Please wait.
Published byMohammed Golson Modified over 10 years ago
1
CS211 Problems: unsolvable, unfeasible and unsolved Topic 2: Halting problem
2
3 topics 1.Turing machines – as a definition of computable 2. An uncomputable problem and 3.Problems that take so long they might as well be – which leads to an unsolved problem in computer science (still open)
3
Some history 1920s Hilbert asked "Is mathematics decidable?" "Did there exist a definitive method which could, in principle, be applied to any assertion, and which guaranteed to produce a correct decision as to whether that assertion was true or false“ We call this decidable – reduce anything to yes/no Last time we looked at Turing machines inspired by this idea of a ‘definitive method’, today look at ‘decidable’
4
Church Turing thesis (1936) Everything algorithmically computable is computable by a Turing machine You can’t ‘prove’ this it is a definition really Evidence that it is reasonable is that there were several definitions running around of ‘computable’ and they all turned out to be equivalent Nowadays we can show that TMs and ‘real’ computers are equivalent (discuss in relation to unlimited memory and new advances)
5
So …. Last time we got a definition of ‘computable’ (i.e. to have an algorithm on a TM to solve) and hence ‘decidable’ (ie computable with a yes/no answer) Now, are there problems that are not decidable? Is it possible, in principle, to write a program to solve any problem?
6
BTW, Notice that you can write a TM to simulate any programming language –Sequence –Selection (check if 2 things are equal) –Loop –(in fact less powerful because infinite memory in TM) So, Is it possible, in principle, to write a TM program to solve any problem? Can you write a computer program to solve any problem?
7
First, what did I tell you to do over break? Draw a TM to –Copy a binary number –Multiply a binary number by 2 –Add 1 to a binary number –subtract unary (called monus – 7monus3 is 4 but 3monus7 is 0) –Decide if one number is bigger than another BTW my notation is from a book by Denning, Dennis and Qualitz
9
Back to main thread …. Last time we got a definition of ‘computable’ (i.e. to have an algorithm on a TM to solve) and hence ‘decidable’ (ie computable with a yes/no answer) Now, are there problems that are not decidable? Is it possible, in principle, to write a TM program to solve any problem?
10
The answer is that …. There are problems that can be stated but not decided Hence there are things that are not computable …. To describe them though we need to think ‘paradoxically’
11
Paradoxes – Grelling’s Divide all adjectives into two categories: autological: self-descriptive heterological: not self-descriptive Autological: pentasyllabic, awkwardnessful, recherché Heterological: bisyllabic, palindromic, edible
12
Now – what kind of adjective is ‘heterological’ Suppose it is heterological That means it does not describe itself – but it does! Suppose it is not-heterological That means it is not not self descriptive, ie it is self descriptive – but it isn’t!
13
The halting problem given a program and an input, will the program eventually halt on that input, or will it run forever? while True: continue –does not halt print "Hello World!" –halts very quickly
14
Here is an outline of the proof (based on http://www.cgl.uwaterloo.ca/~csk/halt/): Suppose, that given any program (p – expressing program as a TM) and any input (i) whether that program stops on that input is computable. (We will show a contradiction) That means there is an algorithm for deciding whether p stops on i, so, if there is an algorithm, there is another TM q where q(p, i) =1 if p doesn’t stop on i and 0if p does stop on i We can code up any machine as some number ‘x’ uniquely. Consider yet another turing machine r – almost like a backwards q, but it runs machines on codings of themselves r(x) = inf. loopif q(x,x) =0 // easy to put in inf loop 0if q(x,x) = 1 What happens if I apply r to itself?
15
If r(r) = inf loop (so q =0) would mean that q(r,r) =0, which means r stops on r – contradiction If r(r) = 0 (stops so q =1) would mean q(r,r) = 1, which means r doesn’t stop on r - contradiction Hence the initial assumption (that you can decide whether any program running on any input stops is computable) must be wrong! And so whether that initial program p stops on input i is NOT – computable. q(p, i) = 1 if p doesn’t stop on i and 0if p does stop on i
16
Breathe!
17
So what? Well it means that not all problems CAN be solved on a computer! We "assume" that any step-by-step reasoning will solve any technical or scientific problem. “No" says the halting problem. Other non-computable problems are often shown by being reduced to the halting problem
18
Raises the possibility of unsolvable problems There are others that are more ‘practical’ but harder to show But even the HP has simple consequences Student wanted to do an educational piece of software to detect all infinite loops – I said probably ‘no’ WHY??
19
OK, so now problems which are not solvable in reasonable amounts of time You’ve done O(?) with Richard right? 2 64 is 5 years worth of instructions on a supercomputer 2 128 is 600,000 times the age of the universe in nanoseconds N10100100010000100000 log 10 N12345 40N+34034003400034000034000003 N 2 /10000.110100010000010000000 2N2N 32?????
20
Anyone need a lifeline?
21
What have we done? Looked at a non-computable problem Seen some of the consequences Reviewed O(?) if necessary
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.