So it is my understanding that Recursively Decidable languages are the languages that we can build a Turing Machine such that given an input w from that language, Turing Machine will always either accept and halt or reject and halt. What I am confused about is languages that can grow up to infinity. Let's say for example we have a language L = {0^p | p is a prime number}. So we can write an algorithm that decides if a number is prime or not in linear space. So my understanding is that since this algorithm either tells us that number is prime or it's not prime, then L must be recursively decidable right? But since p is not bound by any fixed number, it can go to infinity correct? So is it correct to assume that my algorithm can technically run forever, without accepting or rejecting the input, in which case our L will not be recursively decidable and will be recursively enumerable?
Asked
Active
Viewed 577 times
-1
-
1Well if you operate with finite numbers, the algorithm execution time cannot be infinity for any specific number. There is a difference between "the algorithm may not terminate for a specific input" and "the runtime of the algorithm is not bounded by a constant, so it can be arbitrarily large as long as an arbitrarily large input can be selected". – kfx Aug 17 '17 at 12:35
1 Answers
1
- Yes, the language of unary words of prime length is decidable. As you have stated, this can even be done in space linear in the size of the input.
- Yes, the language contains words of arbitrary length. But saying that p goes to infinity is misleading. It takes all the possible integer values, but without any order. Infinity is not an integer and since there is no order in the set defintion there is not any tendency to go toward infinity.
- No, you cannot assume that the algorithm runs forever. It does not take all the strings as input but only one. And every single string is of finite length, so the algorithm will terminate for every single one of them. The fact that there are infinitely many different possible inputs is not relevant here.

Peter Leupold
- 1,162
- 1
- 9
- 16