# Are there algorithms for which we cannot determine if they ever halt? [duplicate]

My understanding of the halting problem in layman's terms is that there is no algorithm which will accept an arbitrary program as input and return true if it halts and false if it does not.

For a Turing machine does the question, "Does this Turing machine halt for all inputs?" always have an answer in the first place?

E.g. the algorithm "If this machine halts, then loop. Otherwise halt." seems to suggest that the answer is no. Is there something wrong with this example? Is there a canonical example?

## 1 Answer

As you point out, the general problem of deciding if a TM stops on any given initial tape content is undecidable. In this answer I'll assume you are talking about the concrete existence (to the point of being possible to indicate, not just demonstrate) of one such machine.

As it happens, the (hypothetical) problem of deciding if a particular TM always halts gets arbitrarily complex as the machines themselves get more complex. It is quite impressive how problems involving even very small machines exist that defy our current understanding. It is possible to conjecture that, for any given limited set of resources, there will be some relatively small machine that is "out of reach", whose behaviour is impossible for us to determine.

Your formula does not add significantly to this idealized scenario.