3

i have researched it on wikipedia and it produces me an unusual example and stories about Turing,so what i understand is if an program run in loop,an electronic device in cpu or in computer structure would stop that program,or an code will be processed by the input to decide if the program will be executed or will be halted after that.So what is the halting problem actually?

Lan...
  • 161
  • 7

2 Answers2

4

Consider the set of all possible pairs $ \langle M, w \rangle$, where $M$ is a Turing machine and $w$ is some string on a fixed alphabet. Also note that some $M$ may halt on input $w$, and some may not.

Basically, the Halting problem asks to create a Turing machine that takes a pair $ \langle M, w \rangle$ as input, and eventually halts with answer "YES" if $M(w)$ halts, and "NO" if $M(w)$ does not halt.

If you are familiar with programming you could interpret this problem as following. The Halting problem asks you to write a C++ program which reads another target program together with its input written in C/C++, and always stops and prints "YES" if the target program eventually stops on the input, and prints "NO" otherwise. Note that your program must work for any finite size of target program and any finite size of input.

As for its history, this is one of famous David Hilbert's 23 questions posed in 1900 at the Second International Congress of Mathematicians in Paris, and later in 1936 was solved by Alan Turing to show that such algorithm deciding on all possible pairs $ \langle M, w \rangle$ cannot exist.

This Wikipedia article provides a formal definition of the problem and sketch of proof.

fade2black
  • 9,905
  • 2
  • 26
  • 36
1

You should be familiar with the concept of coding of a program if we want to explain Halting Problem informally without using formal definition of Turing machine.

Coding of a program contains all instructions that the program follows to process its input. Let's call coding of program $P$ as $<p>$.

Suppose someone gives a $<p>$. Can you understand will $P$ outputs anything and halt if it runs input $w$? You can not unless you run $w$ on $<p>$ and wait to see its result.

The point of this experiment is that if $P$ halts you will understand at a time in future, but you'll never understand if stuck in a loop. Note that you don't know how long you should wait to see its result and this makes the halting problem hard.

Halting problem says there is no program $\mathcal{P}$ that given $<p>, w$ as its input and can determine whether $P$ will halt running $w$ or not.

To better intuition, let's define two languages.

$$L_{halt}=\{(<p>,w)| \text{P halts on w}\}\\ L_{\overline{halt}}=\{(<p>,w)| \text{P doesn't halts on w} \}. $$

As I explained above you can enumerate $L_{halt}$ but you can't do it for $L_{\overline{halt}}$. Halting problem says you can't write any program that given $(<p>,w)$ and decides whether $(<p>,w) \in L_{halt}$ or $(<p>,w) \in L_{\overline{halt}}$.

Edit: I changed check membership of $L_{halt}$ to enumerate with the subtle point Yuval mentioned.

Doralisa
  • 511
  • 2
  • 15