I have these 2 languages
A = {<M> | M is a TM and L(M) contains exactly n strings }
B = {<N> | N is a TM and L(N) contains more than n strings }
I believe that these 2 are undecidable, but I am not sure whether they are Turing recognizable or co-Turing recognizable.
Bis Turing recognizable since we can interleave executions ofMon all possible input tapes. If more thannof the running instances ofMever halt-accept, then halt-accept.We know that
Acannot be Turing-recognizable because, if it were, the languageB' = {<N> | N is a TM and L(N) contains no more than n strings }would be Turing-recognizable (we could interleave the execution of recognizers for 1, 2, ..., n and halt-accept if any of those did). That would imply bothBandB'were decidable sinceB'must be co-Turing recognizable.If
Awere co-Turing recognizable, we could recognize machines that accept a number of strings different thann. In particular, letn = 1. We can run the recognizer for machines whose languages contain other thannstrings on a TM constructed to acceptL(M) \ {w}for every possible stringw. At each stage, we run one step of all existing machines, then construct a new machine, and repeat, thus interleaving executions and ensuring all TMs eventually get to run arbitrarily many steps.Assuming
|L(M)| = 1, exactly one of these TMs will halt-accept (the one that removes the only string inL(M)) and the rest will either halt-reject or run forever. Therefore, a recognizer for|L(M)| != 1can be used to construct a recognizer for|L(M)| = 1. This generalizes to|L(M)| != kand|L(M)| = kby subtracting all possible sets ofkinput strings.Therefore, if A were co-Turing recognizable, it would also be Turing recognizable, thus decidable. We already know that's wrong, so we must conclude that A is not co-Turing recognizable; nor is it Turing recognizable.