0

It is my understanding that for a sufficiently simple function, let's say

function(boolean input){
    while(input){
    }
}

it is possible to tell if it will halt for any possible input.

It is easy to see that the above function will terminate for false and not terminate for true. It's only impossible to solve the halting problem for an arbitrary functionf, as of course you can evaluatehaltingFinder(haltingFinder)` and essentially create a paradox.

Am I correct in my understanding?

Jongware
  • 22,200
  • 8
  • 54
  • 100
Mr. Negi
  • 154
  • 1
  • 15
  • 1
    I case anyone is wondering about the 0 in the word problem, I was defeating the system designed to prevent homework questions. – Mr. Negi Sep 14 '16 at 05:48
  • This is a good question, but maybe for cstheory.SE. They should probably accept the word "problem" in the title – mike3996 Sep 14 '16 at 06:10
  • 2
    I'm voting to close this question as off-topic because it would be better off in http://cstheory.stackexchange.com/ – mike3996 Sep 14 '16 at 06:12
  • 1
    @Mr.Negi You might be interested in [this question](http://math.stackexchange.com/questions/1991323/hitting-a-point-on-an-expanding-grid) (Sorry for an irrelevant comment, I will delete it after some time) – Dahn Oct 30 '16 at 10:37
  • I know saying thanks is against the rules and irrelevant to this problem, but I feel it is strictly necessary. – Mr. Negi Nov 03 '16 at 06:44

1 Answers1

2

Yes, of course you are right. Take a funtion that does not even have a loop: it will always halt. For entire classes like the regular and context-free languages the halting problem is trivial: the corresponding machines (finite automata, pushdown-automata without epsilon moves) can only make a number of steps equal to the input word's length and thus will always halt. Though, of course, you can design non-halting computations for simple funtions, e.g. a Turing Machine with useless loops for a regular language.

Peter Leupold
  • 1,162
  • 1
  • 9
  • 16