# A Turing machine recognizing languages of Turing machines

How can a Turing machine be constructed to recognize languages consisting of Turing machines that accept a certain set of strings?

An example: the language $L = \{\langle M\rangle\mid M \text{ accepts a string }0^n1^n2^n \text{ for some }n\geq 0\}$.

Does a TM recognizing such language exist or are these kinds of languages never recognizable?

If a recognizer exists for such languages, do they base on testing every possible string in input? For example would a valid recognizer for $L$ be:

M = "On input $\langle M\rangle$,

1. Repeat for $i = 0, 1, 2, 3,\dots$:
2. Construct string $s=0^i1^i2^i$ and simulate $M$ on $s$. Reject if $M$ rejects $s$, otherwise continue."?

Is there a better way to construct a recognizer for such languages?

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. – David Richerby Oct 18 '17 at 17:39
• Hint: you should consider what your recognizer does if $M$ loops forever on $\epsilon=0^01^02^0$ but accepts the string $012$. Then, look up "dovetailing". – David Richerby Oct 18 '17 at 17:42
• Are you familiar with Rice's theorem? – jmite Oct 19 '17 at 1:12