## Determining whether the following language is decidable - turing-machines

{⟨M,N⟩ | All strings in L(M)∩L(N) begin with 110.}
I think that this language is decidable. We can make a Turing Machine TM, which takes as input . For every string that is in L(M)∩L(N), if the string starts with 110, after the first 3 digits, we halt and accept. If the first three digits are not 110, we halt and reject. I am unsure what we do if the string is not in L(M)∩L(N).
Also overall I am unsure if my Turing Machine is actually working or not. Could I get some feedback on this?

If M and N are Turing machines, then this language is not decidable. If it were, we could make N a TM that accepts all strings, and then we'd have a decider for {M | all strings in M begin with 110}. We can recognize this is not decidable since the condition is true for some TMs, false for others, and it's semantic in that it deals with the strings in the language; so Rice's theorem applies.

## Related

### Is a primarily prime TM decidable?

A language L over alphabet Σ is primarily prime if and only if for every length l, the majority of strings of length l do belong to L if l is a prime number, but do not belong to L if l is a composite number. Let PriPriTM = {〈M〉 : L(M) is primarily prime and M is a TM}. Is PriPriTM Turing decidable?

This is a very complicated decision problem, but the answer is that no, it cannot possibly be decidable whether a TM accepts a primarily prime language. Why? Some TMs accept primarily prime languages (consider a TM that accepts exactly the strings of prime length) and some do not (consider the TM accepting the complement of the former's language). The property is semantic in that it deals with what strings are in the language - rather than syntactic, dealing with the form of the TM itself. In other words, two TMs accepting the same language would always be treated identically by a decider for our problem. By Rice's theorem, then, the problem of deciding whether a TM decides such a language is not computable.

### Turing machine decidability ambiguous cases

1) Is a Turing machine M that accepts the language L = {ε}, accepting no entry? In one hand, I think it can be false because the empty word could be an entry, but in another i think this could possibly be an indecidable problem. 2) Is every Turing machine whose language is decidable stops on any input ? Same idea, intuitively I would have say yes, due to the definition of decidable, but I don't know, something trouble me. 3) Is the language of the palindromes decidable whatever the aphabet ? For this one, I have almost no doubt that it's False, because with Rice's Theorem we can prove that, this probleme is indecidable.

1) I am not sure how to parse this but if a TM accepts the language consisting only of the empty set, it will eventually halt-accept on a blank tape. Whether that counts as an entry or not depends on your definition of "entry". I would count it as an entry, so I would answer "no". 2) The language consisting of only the empty string is decidable. However, we can write a TM that halt-accepts the empty string only and goes into an infinite loop for all other inputs. What is meant by "whose language" is debatable but for TMs that encode partial functions I would call the language of that TM the set of strings which it halt-accepts on, so I would answer "no". 3) It seems to me that, given an alphabet with n symbols, you can always construct a single-tape deterministic TM with O(n) states which halt-accepts on palindromes over that alphabet and halt-rejects other strings, thus deciding the language of palindromes over the alphabet. I would answer "yes", as long as the terms have their usual meanings. Note that Rice's theorem does not apply; it would apply to the problem of deciding whether a TM accepts the language of palindromes over an alphabet, but actually deciding whether something is a palindrome is of course possible (PDAs do it).

### Proving a language is in RE/R/coRE

Lets say we have a function for a Turing Machine like this one: 𝑓(𝑀) = { 1, for any 𝑤 where 𝑀(𝑤) halts only if w is a palindrome of even length 0, otherwise How can one prove that it belongs (or not) to RE, R, coRE. I mean, I know we can use a turing reduction using the f-halt to prove that it is not belonging to R. But what about RE/coRE?

A language is RE if we can halt-accept for any string in the language. A language is coRE if we can halt-reject for any string not in the language. R is the intersection of RE and coRE; a language is R if we can halt-accept on strings in the language and halt-reject on strings not in the language. You already know that the language isn't R. This can also be seen by Rice's theorem: halting only on palindromes of even length is a semantic property of the accepted language (subset of EPAL), so the inclusion problem isn't decidable. This tells you that the language cannot be both RE and coRE, though it might be neither. Given a machine M, can we determine that it does only accept strings which are even-length palindromes? This seems unlikely. We would need a way to be sure that all strings - maybe infinitely many - are even-length palindromes. We can't just find a counterexample and be done. Given a machine M, can we determine that it doesn't only accept strings which are even-length palindromes? We sure can! We can interleave executions of copies of this machine such that arbitrarily many possible input strings get arbitrarily much computing time; if M accepts any particular string, we can eventually find out, and if it accepts one that isn't an even-length palindrome, we can eventually tell. So, this language: is coRE is not RE is not R

### Check whether 2 languages are Turing recognizable or co-Turing recognizable

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.

B is Turing recognizable since we can interleave executions of M on all possible input tapes. If more than n of the running instances of M ever halt-accept, then halt-accept. We know that A cannot be Turing-recognizable because, if it were, the language B' = {<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 both B and B' were decidable since B' must be co-Turing recognizable. If A were co-Turing recognizable, we could recognize machines that accept a number of strings different than n. In particular, let n = 1. We can run the recognizer for machines whose languages contain other than n strings on a TM constructed to accept L(M) \ {w} for every possible string w. 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 in L(M)) and the rest will either halt-reject or run forever. Therefore, a recognizer for |L(M)| != 1 can be used to construct a recognizer for |L(M)| = 1. This generalizes to |L(M)| != k and |L(M)| = k by subtracting all possible sets of k input 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.

### A detail on the Pumping Lemma for regular languages

I have one small question about the pumping lemma for regular languages - is it good enough to show that if a specific string belonging to a language L can't be pumped, then the language is irregular? For example - if I choose language L1 being of the form a^nb^n (ab, aabb, aaabbb ...) and I show that the string aabb can't be pumped and still be a part of L1, then is it valid for me to immediately conclude that L1 is irregular? Cheers.

It's not quite sufficient to demonstrate that a single, finite-length string does not pump. For a rigorous argument, you'd also have to prove that length of your example string is greater than the pumping length of the language. Usually you assume that some pumping length p exists, then construct a string longer than p that cannot be pumped.

Yes, that's how the pumping lemma works. It's only useful for proving languages to not be regular. Satisfying the pumping lemma is only a necessary but not a sufficient condition for a language being regular. (Nota bene: Likewise for context-free languages and the respective pumping lemma there)

Yes, this is how it works, but be careful in showing how a string "cannot be pumped" To do that you have to break a string w in L, into substrings xyz and show that some versions of xy^1z, for int i i>=0 lead to strings not in L, but are still accepted by DFA M (for M built to accept L), arriving at a contradiction. Note that you cannot pick the location of y and therefore must consider 3 possible positions of it. That's the key, in my opinion.

The pumping lemma says: If a language A is regular => there is a number p (pumping length) where, if s is any string in L such that |s| >= p, then s may be divided into three pieces s=xyz, satisfying the following condition: xyiz is in L for each i>=0 |y|>=0 p>=|xy| The right way to show that a certain language L is not regular is to suppose L regular and try to reach a contradiction. Lets try to demonstrate that L = {0n1n}|n>=0} is not regular. We start assuming to the contrary that L is regular. You can think about this kind of demonstration as a game: Challenger: He choose the pumping length p. You cannot do any presumption on it. You: Now it is your turn: choose the "kind" of string that represents the irregularity of the language. Lets say that the string is in the form 0p1p. A good tip in this step is to try to limit the adversary next move. Challenger: He presents to you a string s in the form 0p1p. You: It's time to pump! If you chose correctly the form of the string in your previous move, you can do some assumption. In our case, for example, we know that the substring y consists only of 0s (at least one 0 because |y|>0), because |xy|<=p and first p-elements are 0s. Now we show that it exists i>=0 such that xyiz is not in L. For example, for i=2 the string xyyz has more 0s than 1s and so is not a member of L. This case is a contradiction. => L is not regular. Never forget to demonstrate why the pumped string cannot be a member of L. Probably it is late to help you, but someone else may need this kind of explanation...maybe ^^ Cheers.