Whenever people ask about the halting problem as it pertains to programming, people respond with \"If you just add one loop, you\'ve got the halting program and therefore yo
A proof from another perspective
Suppose we got a cpu with instructions like mov, add, jmp, but without in nor out. And we got memory. Not like other cpus, this one has another register, called paraReg. This register is like a file, we can mov unlimited content into it, get the size of it, seek to the middle of it, delete some of the content from it, which are done through some additional instructions .
Before we start, let's define some words. A program is a bunch of instructions, which is a string. Before we run a program, we clear all the registers and memory to zero except paraReg , which holds the parameter(a string), and then put the program into memory location zero and set ip register to zero. A process is when a program is running.
Now the halting problem can be stated like this : given any program, called proObj(if it takes a parameter para0, we add an instruction on the first line of it: mov paraReg , para0), is there a program which takes proObj as the parameter and can decide whether proObj will halt when proObj starts to run on paraReg set to zero?
Suppose we got such a program, called p1. Then we can create another program, called p2 which takes a parameter para0. Through p1, we can tell if a program whose content is para0, whose parameter is para0, will halt or not.(We do it this way. Construct a program whose first line is [mov paraReg , para0], the rest is para0. Name this program pro0. Then we set paraReg to pro0 and call p1. ) If it will halt,we let p2 enter into an infinite loop, otherwise we let p2 halt.
If we put p2 into paraReg and run p2, will the process halt or not? If it halts, from the definition of p2, we know when we put p2 into paraReg and run p2, it should not halt; likewise , if it doesn't halt, we know when put p2 into paraReg and run p2 ,it should halt. Then we can say there is no p2, and there is no p1.