Can we develop a turing machine which on given a language L as input gives as output whether this language is regular or not?
2 Answers
As quicksort notes in his comment, languages are infinite objects and it is not possible to feed them to Turing Machines.
So we must be content to consider classes of languages for which there eists a finite description. We can for instance consider the context-free languages and give as input the grammar for the language.
Unfortunately, even for context-free grammars it is undecidable whether their language is regular.
Bar-Hillel, Perles, Shamir. On formal properties of simple phrase structure grammars. (1961) doi 10.1524/stuf.1961.14.14.143
- 31,459
- 1
- 54
- 109
Contrary to the claims by Hendrik Jan and quicksort, the question makes perfect sense as asked. A Turing machine uses infinite tapes, so can we can indeed process an arbitrary language as input, written out on the input tape.
However, any finite prefix of the language tells us nothing about whether or not the language is regular. Thus, the problem is not decidable, and moreover, not even semi-decidable either way.
The best thing we can do is going through all regular languages (which we can effectively generate) and compare them to the input. This yields an algorithm that will say not regular infinitely often if and only if the language is indeed not regular. This is just a way of saying that being regular is a $\Pi^0_2$-complete property of languages.
- 3,559
- 14
- 25