Is this language decidable, make a proof: L = { M : machine M halts for every input of length not exceeding 100 }
Update: This is translated from an exam paper some years ago, and I’m quite sure it means that machine M should halt for every input with length from 0 to 100, and that it is no constraints on the tape size. Update2: The solution given below, and hence the origin of this post, is for an variant of this question with fixed number of steps and input. Sorry for the confusion. I came to the conclusion that this is an undecidable language. My logic is as follows: Lets say for the sake of contradiction that it is possible to construct a machine $M_R$, that takes as input an arbitrary input $(M,x)$, and reduces this to $M’$. $M’$ has the property so that $(M,x) in M_{HALT}$ iff $M’ in L$, this means that $M$ halts on all $x$ of input with maximum length of 100. Then run $M$ on $x$, if it halts then accept. And shows that $M_R$ decides the halting problem, and in hence a contradiction and proves that his is not decidable. But in the solution it is written that this question is decidable:
You can simulate $M$ on all inputs of length 100 or less (you can generate such input in a loop and use the universal Turing machine to simulate M on x), it is only $|Sigma|^{100}$ possible inputs of length 100, that is finite.
Asked By : Michael
Answered By : Andrej Bauer
- @jmite: you missed the fact that we may halt the simulation after a finite number of steps because there are only finitely many possible configurations of the machine, the tape and the state.
- @Patrick87: it is true that the number 100 can be replaced with any other number. So, for any machine $M$ and any number $n$ we can decided whether $M$ will halt on a tape of length $n$. This however does not allow us to deduce anything about $M$ halting on an infinite tape because $M$ could run forever by using up unbounded amounts of tape. There will be no $n$ such that $M$ uses only $n$ cells, so knowing what it does on $n$ cells won’t be helpful.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/18959