 .We have already proved that the halting problem is undecidable. Now, we will discuss some more problems which are undecidable and we will give some important results which can be used to prove that some problems related to languages expressed by Turing machines are undecidable. Just consider the following problem given a Turing machine m whether or not the language expressed by m is empty whether or not the language expressed by m is finite or recursive or is context free or is regular and so on. The corresponding language for these problems can be written as say ETM is a set of all Turing machines such as LM equal to Phi. So, FTM a set of all Turing machines and coding of all the Turing machines m such that LM is finite or say LM is recursive and so on. Now, we want to know whether these problems are decidable or undecidable. What you can do is that for each of the cases we can reduce halting problem to this problem. And you can show that all these problems are undecidable. But the interesting result that shows that or which can be used to show that all the problems related to languages expressed by a given Turing machine is are undecidable and that is stated by the theorem called Reiss's theorem. So, once you have the Reiss's theorem you can show that so many problems related to language except by the by Turing machines that means recursively enumerable languages are undecidable. So, to state the Reiss's theorem we consider property. So, a property that describes a proper non-empty subset of recursively enumerable languages is undecidable. That means suppose that P is a property that describes a proper subset of recursively enumerable language and that is a non-empty subset of course. For example, say if S is a non-empty subset the set of all recursively enumerable languages L that means some languages expressed by Turing machine such that this L satisfies P. So, L is recursively enumerable and that is that satisfies the property P that we have just considered. So, that means S is a proper subset of all recursively enumerable languages without loss of generative what we assume that phi is not in S suppose phi is in S that means this empty set say if any of the L is phi that we just consider the complement of that problem. Suppose phi is in S then just consider the complement of this set S and we prove the result. That means we consider for property which are negation of P because essentially considering complement it will be a corresponding set corresponding to a property which is the negation of P. That means the set of all recursively enumerable languages which do not satisfy the property P. So, once you can show that the complement of S that means S C is undecidable. Then we also know that S is also undecidable that means if we solve the problem the soluble problem for the complement we know the answer for this set also. Therefore, without loss of generality what we assume is that phi is not in S because if phi in S we just consider the complement of the set and solve the problem. Now, the corresponding language for S can be written as denoted as L S a set of all Turing machines M and Corium Turing machines M such that L M the language of the machine satisfies the property P. So, that is how we describe the corresponding language for the problem. Now, our claim is that this L S is undecidable you know want to prove that L S is undecidable and we prove this claim by reducing the halting problem that means the language MTM to L S we just reduce halting problem to this problem that means the language MTM will be reduced to L S. So, therefore to do that what we need to do is that given a Turing machine M and an input string X we construct a Turing machine M dash such that X belongs to L M if and only if L M the satisfies P. So, that is the reduction given M an input string X we need to construct Turing machine M dash satisfying this X belongs to L M if and only if L M the satisfies the property in such a case we are true. Now, we have said that S is a proper nonempty subset of all recursively and invariable languages that means proper nonempty subset of the class of recursively and invariable languages. So, therefore just consider any language L not that belongs to S since it is a nonempty subset such a language L 0 must exist in S since S does not contain a phi. So, such a language L 0 must exist also L 0 is not not phi because we say that if S contains phi then we consider the complement of the problem. So, L 0 is not phi just consider that M L 0 be a Turing machine that accepts L 0. So, there is a Turing machine accepting L 0 and that is that is the Turing machine M L 0 from this we construct that Turing machine M dash as follows Turing machine M dash for such that satisfies phi. So, given any string as input w to M dash M dash is initially does not do anything it first simulates M simulates X on in simulates in the Turing machine M on input string X. Now, if M says S on the input string X then we start the simulation of M L 0 on the given input string W we start simulation and if M L 0 accepts whenever it says S if it accepts then M dash also accepts it says S if it says no it also says no or if it does not say S or it also does not say S. So, clearly M dash is a Turing machine and we see that if X belongs to L M X belongs to L M then M says S and then only we start M L 0 on input string W. So, therefore, if X belongs to L M then M dash accepts all those strings accepted by M L 0 because if M L 0 accepts it says S then M dash says S. So, if X belongs to L M then M dash accepts all those strings except by M L 0. So, this is quite clear that is if X belongs to L M then L M dash is nothing but L 0 and which is which belongs to S. Similarly, if X does not belong to L M then in case when X does not belong to M then it does not say S since it does not say S M L 0 is not started at all. So, therefore, M dash will not accept anything therefore, if X does not belong to L of M then L M dash must be empty because M dash does not accept and which is not in S because you know that in S we do not have phi thus X belongs to L M if and only if L M dash belongs to S therefore, this is a reduction. So, M T M here is used to L S so that L S is undecidable. Now, therefore, setting different properties P we now say that say the property P may be where are these language given recursive language is recursive or where are the language except by the Turing machine is regular, where are language except by the Turing machine is context free, where are language except by the Turing machine is empty or finite and so on we just set different properties. And for the language except by Turing machine thus considering any property the defines a set which is non-empty and a proper subset according to Rice's theorem we can say that all these are undecidable. So, therefore, we can use this Rice's theorem to prove that so any property which is non-empty of course and proper subset of all recursive languages that describes the non-empty and proper subset of recursive languages are is undecidable. Now, you just consider a problem and take it as an exercise. Suppose M is a Turing machine and W be an input string. Now, given W as input to M will M eventually halt with empty tap and its head on the left cell. So, there is a question there is a problem. So, is this problem decidable or undecidable that means the correctional language is that L of H 0 is set of all strings M W such that M is a Turing machine M is a Turing machine like this with the elements q sigma q naught and delta and W is an input string. And if you start in a initial state initial configuration initial state is q 0 input is W and head is placed at the cell just after right blank input string W. So, is a initial configuration of the Turing machine M. So, in 0 or more steps where it will halt placing its head and the input tap is empty and placing its heads on the left most cell that is the language. So, set of all strings M W such that M is a Turing machine and Turing machine eventually halt starting with the initial configuration taking W as input eventually halt with head on the left most cell. So, what can be done is that we can reduce the halting problem to this problem call this problem say H naught. So, accordingly the language is L of H naught we can reduce halting problem to this variant of halting problem. The only thing is that you just remember that whenever the Turing machine halt in case of halting problem. So, this machine should erase its tap eventually. So, all the content of the tap must be erased. Now, we will use this result to show that some other problems to be undecidable. So, we will first introduce a problem which is called word problem for tube system and eventually show that this word problem is also undecidable. So, first we define what a tube system is and then we define the word problem for tube systems. A tube system T is an unordered pair of strings over some alphabet sigma that means this T is a excuse me. So, T is a set of unordered pairs say x 1 y 1 x 2 y 2 and so on up to say x and y n. So, all the strings x i y i are strings over sigma. So, this belongs to sigma star. Now, we define a binary relation say this tilde. So, this binary relation tilde is defined on sigma star. We say that two strings even v are related by this relation binary relation tilde if and only if there exist some pair x i y i in the tube system such that u can be written as z x i z this and v can be written as z y i z this for some z z this sigma star or u can be written as z y i z this and v can be written as z x i z this for some z z this. So, this is a simple binary relation that we have defined on sigma star. Now, we use this notation to denote the reflexive transitive closure of tilde. So, that this is an equivalent relation on sigma star that is two strings even v are related by this relation that means u is equivalent to v u is equivalent to v if and only if one can be transformed into the order by successive replacement of one strings in a pair in the tube system t by the order it does not matter the order in any order you can apply it. So, eventually one can be transferred to the other string by some successive replacement of one string in a pair in a tube system by the order. So, in such a case we say that u is equivalent to v. Now, we define the problem the word problem for tube systems the problem is that given a tube system t and two strings even v for any tube system t and any two strings even v whether or not even v are equivalent so that is the problem and we can show that this problem is called word problem for tube systems is undecidable that means we cannot decide this word problem for tube system. We can prove this result by reducing that variant of holding problem that we have just introduced that a 0 to the word problem for the tube system that means we will consider this problem a 0 which is a modified version or a variant of the original holding problem we can use this that means we can reduce this problem a 0 to the word problem to show that word problem is also undecidable we use a 0 reducing a 0 to word problem we can show that the word problem for tube system is undecidable that means given an instance m w of a 0 we construct an instance of the word problem which is t m corresponding to the machine m we construct t m u v such that m w belongs to l of h 0 if and only if u and v are equivalent. So, that is what we want to from a given instance of h 0 we construct an instance of the word problem that means a tube system and two strings u and v such that for any m w if m w belongs to l h 0 m w belongs to l h 0 if and only if u and v are related u and v are equivalent sorry. So, given turing machine we construct a tube system with the help of a grammar that is equivalent to the turing machine now we know that already it has been given or proved that for every turing machine there is an equivalent grammar and it has been shown how to construct the grammar rules for a given turing machine. So, that the grammar and the turing machines are equivalent. So, we will use that construction to construct the turing tube system from the given turing machine t m now recall the result in which we have demonstrated already the equivalence between turing machines and grammars that means given turing machine m say the turing machine. So, there exists a grammar g such that for any input w we have if we start in the initial configuration if the turing machine in 0 or more steps eventually goes to this configuration that means the halt step. So, if and only if so this string corresponding to this initial configuration derives this string corresponding to the halting configuration. So, you need to recall the result that we have already proved corresponding to in the context of proving that turing machine and grammars are equivalent. Now, once we have that given a turing machine m we simply construct the turing machine tube system by collecting all those pairs say x y such that x y is a rule in the grammar g. So, for the machine m turing machine m we can construct a grammar g in the grammar g we have rules like x goes to y. So, collect all those rules from those rules you collect all the pairs x y and those are the pairs that we have in the corresponding turing machine t m. So, corresponding to turing machine m we have the corresponding tube system t m. So, that is how we construct the tube system for a given turing machine. Now, for any input w of m we consider two strings say u is considered to be left square bracket has w q 0 has right square bracket and v is left square bracket h or h is the halting state has right square bracket. Now, you want to show that the string m w belong to l of h 0 if and only if even we are equivalent in the corresponding tube system t m that we have constructed from m. So, that the problem h 0 is reduced to the word problem showing that the word problem for tube system is also decidable. Now, you just know that m w belongs to h 0. So, this should have been l of h 0 l of h 0 if and only if the turing machine starts in the initial state taking w as input it process the input string eventually it enters in a whole state that means from this configuration q 0 has w has in 0 or more steps in m it arrives in a configuration over h is the state and head is pointing to the blank cell. So, m w belongs to l of h 0 if and only if this is the situation if this is the case according to our equivalence of turing machine and grammar we know that this string corresponding to this initial configuration will derive in 0 or more steps this string corresponding to the halting configuration that means since we have said that this string is not denoted by say u already we have said that this is a string u and this is a string v. So, therefore, this says that u the string u derives in 0 or more steps in g the string v. So, m w belongs to l of h 0 if and only if u derives the string v where u is this string and v is this string. Thus it is sufficient to prove that u derives v in g if and only if u and v are equivalent in that system. So, we have just simplified the problem or restated it. Now, in this case we just observed that the only if part is very straightforward that means u derives v in g in 0 or more steps suppose that is the case in such a case what will have is that there is a sequence of derivation sequence steps in derivation where u 0 derives u 1 in 1 step u 1 derives u 2 in 1 step and so on up to say u k minus 1 derives u k in 1 step where u 0 is u and u k is v. Therefore, u derives v in 0 or more steps in grammar g. So, in such cases so therefore, since grammar rules and the pairs in the system are parallel. So, what we can say is that u 0 is related to u 1 by the binary relation tilde u 1 is related to u 2 by the same binary relation and so on. So, therefore, according to our definition of your equivalence relation we know that u is equivalent to v. So, this part only if part is quite straightforward the only difficult part is that the if part that means assume that u is equivalent to v. So, in such a case if u is equivalent to v then you need to show that u derives v in 0 or more steps that is what you want to show suppose u is equivalent to v then there must exist a finite sequence v 0 v 1 up to say v n such that v 0 is u v 0 and v 1 are related v 1 and v 2 are related by the binary relation tilde and so on v n minus 1 and v n is related by the binary relation tilde where v n is v. So, there must exist such a sequence according to definition of this since even v are equivalent. Now, let us assume this sequence is a shortest such sequence because there are many such sequences assume that out of all those this is this sequence is a shortest that means there is no such n dash such that there is a sequence v 0 v 1 up to say v n dash where v 0 is related to v 1 v 1 related to v 2 and so on up to v n dash minus 1 related to v n dash where v not is u and v n dash is say v v and n dash is less than n. So, this cannot happen because we say that this is a shortest sequence. So, n is always less than any such n dash if such a sequence exist. So, this is our assumption. So, if that is the case we claim that v i derives v i plus 1 for all i in this sequence. That means what it says that all rules in the derivation are applied in the forward direction that means v i derives v i plus 1 is not the case that v i plus 1 derives v i. So, firstly show that all the rules in the derivation are always applied at every step it is applied in the forward direction. Now, the first thing to note is that v n has h as a state component because we have defined v n to be since v n equal to v and we have say that v is. So, we have say that v is a string left square bracket h has right square bracket. So, this h is a halting state is there in v which is nothing but the halting state h is there in v which is v n which is nothing but v. So, therefore, v n minus 1 must derive v n that means at this step when v n minus 1 derives v n in grammar g the rule must be applied in the forward direction because from halting state we do not go to any other state from other state only you can go to the halting state. So, therefore, in the last step in the derivation the rule must be applied in the forward direction. So, that is our claim now suppose that. So, since we claim that v i derives v i plus 1 for all i there is our we have to prove that if there is not a true there must be some step where this is violated. Suppose that i 0 is the largest number where i 0 is basically may be greater or equal to 0 or less than n minus 1 because for n minus 1 we have already assumed that the rule is applied in the forward direction. So, suppose that i 0 is the largest number. So, where this is violated that means v i 0 does not derive v i 0 plus 1 in g then we must have that v i 0 plus 1 derives v i 0 in g that means rule is applied in the backward direction, but already we know that v i 0 plus 1 derives v i 0 plus 2 in one step because i 0 is the point i 0 is the number largest number where the rule is violated beyond that the rule is not violated. So, therefore, v i 0 plus 1 must derive v i 0 plus 2 in g that must be the case and we have said that the rule is violated at this point. So, therefore, v i 0 plus 1 derives v i 0 now while considering Turing machine if we assume that Turing machine is deterministic then what we have is that the grammar rule must be unique. So, therefore, v since v i 0 plus 1 derives v i 0 also v i 0 plus 1 derives v i 0 plus 2 in one step. So, v i 0 and v i 0 plus 2 must be the same string because the Turing machine M can be assumed to be deterministic and hence the rule shall be unique. So, therefore, now we have the sequence say u is v 0 v 0 is led to v 1 and so on. So, v i 0 is led to now instead of say v i 0 plus 1 since v i 0 plus 1 is led to v since v i 0 plus 1 derives v i 0 plus 2 and v i 0 plus 1 derives v i 0 these two are identical. So, therefore, we have the sequence now where from v i 0 where v i 0 and v i 0 plus 3 are related by tilde and so on up to v n where v n is v. Now, in this case since from v i 0 we get v i 0 plus 3 these two related or original assumption that the sequence v 0 v 1 up to v n v 0 v 1 v 2 up to v n these are shorter sequence that was our original assumption that must be false because in that sequence so what we have v 0 v 1 say v i 0 then v i 0 plus 1 then v i 0 plus 2 then only v i 0 plus 3. So, this must be longer sequence corresponding to the sequence that we have just introduced. So, that must be the longer sequence corresponding this. So, this is a shorter sequence. So, this contradicts our original assumption that such a shorter sequence exists. So, therefore, v i must derive v i plus 1 for all i. So, therefore, even v must be related you must derive v in 0 or more steps in g applying the forward rule at every step. So, that is what we want to prove that means u derives v in g in 0 more steps if and only if u and v are equivalent. So, we have shown the both sides if what and only if what. So, therefore, by reducing this variant of the whole thing problem to this what problem for the system we have shown that what problem for the what problem for the system is also undecidable. Similarly, we can show many other problems to be undecidable by using this kind of reduction. We will now introduce another problem which is called is similar to what problem in the system is called post correspondence problem and we will show that post correspondence problem is also undecidable. Let us first this define an instance of PCP a post correspondence problem. An instance of PCP is a finite set of ordered pairs. So, in this case this pairs are all ordered finite set of ordered pairs of non-empty strings. Say it is a post instance of post correspondence problem say P is x 1 y 1 x 2 y 2 x 3 y 3 and so on x n y n. So, it is a finite set of pairs of strings over sigma and this pairs are ordered. Now, a solution to P is a sequence solution to this instance of P instance of PCP is a sequence i 1 i 2 up to i k such that if we take the corresponding strings from the ordered pairs the first element and the second element and concatenate they will be identical. That means x i 1 x i 2 x i k concatenate x i 1 x i 2 up to say x i k and concatenate x y i 1 y i 2 up to y i k. They are same x i 1 x i 2 up to x i k is equal to y i 1 y i 2 y i k. So, if such a sequence exists satisfying this condition we say that this is a solution to the instance of the PCP. Now, the problem is given an instance of PCP whether or not it is a solution that is our problem. So, can we decide it the result is that post correspondence problem is undecidable. So, we can show that the post correspondence problem is also undecidable. To show this first what we do we consider a modified version of the post correspondence problem because given an instance of PCP you need to find out the sequence i 1 i 2 up to say i k satisfying that condition that means x i 1 x i 2 up to x i k must be equal to y i 1 y i 2 up to y i k. The problem is where to start what is this index i 1 that is difficult to find out may be if we consider suppose that we need to start at say index 1 and then you find out this remaining sequence that means either case that x 1 x i 1 x i 2 up to say x i k equal to y 1 start with the index 1 y i 1 y i 2 up to say y i k. So, this is solution to the m PCP. So, this modified version is said to be modified PCP simply m PCP. You can show that m PCP is decidable if PCP is decidable. So, you can reduce this problem by reduction you can show this result. Now, this halting problem again can be reduce to this m PCP to show that m PCP is undecidable. So, you leave it as an exercise you can give a try to prove the result. So, once again you can reduce the halting problem to PCP in fact to m PCP to show that PCP is undecidable. Now, this result that PCP is undecidable can be used to show that some problems related to CFG are also undecidable. For example, just consider problem of ambiguity of CFG that means given a context with grammar G whether or not G is ambiguous can be still given any arbitrary CFG can you decide whether G is ambiguous. The result is that it is undecidable to determine a given CFG is ambiguous. So, we cannot decide whether any given arbitrary CFG is ambiguous. Now, you can use this PCP to show that ambiguity problem of CFG is undecidable. That means we reduce PCP to this problem. Now, in the reduction what we need to do is that given an instance P of PCP we construct a CFG GP from this instance P of PCP we construct an instance CFG GP such that this PCP has a solution if and only if the corresponding GP is ambiguous. So, this is a reduction if you can show this we know that ambiguity problem of CFG is also undecidable. Now, let us see the reduction how can we reduce it. Consider that P is an instance of the PCP where all the strings X, I, Y, I are strings over sigma some alphabet sigma. We just consider an alphabet say sigma dash where it contains all the symbols from sigma then sigma union and some additional symbols a 1, a 2 up to a n where the numbers of such symbols is equal to the numbers of pairs in this PCP instance. So, X 1, Y 1 up to we have X n, Y n. So, we have n numbers of additional symbols in sigma dash will contain all the symbols of sigma as well as some additional symbols. That means, a i does not belong to sigma for all i and there n numbers of such symbols where n is a number of pairs in the PCP. Now, we construct a grammar say g 1, g 1 contains a single non-terminal s 1 this alphabet is sigma dash start symbol is obviously it must be s 1 and we have a set of production rules P 1. So, P 1 contains two types of productions s 1 goes to a i s 1 x i for all i i equal to 1 through n and s 1 goes to a i x i. So, there are only two rules that we have for all a i and x i for all i. Obviously, you see that the language of the grammar g 1 will be of the form a i 1, a i 2, a i m then x i m, x i 2, x i 1 for some m greater than or equal to 1. Because, since we have to start a start symbol it has to be some a from the alphabet and the corresponding x i will be here in the other side and in between we have this s 1. This s 1 again we have to replace s 1 by the same rule may be then we have another a i for some i and a corresponding x i eventually we have to terminate it by this rule. This s 1 has to be terminated by this rule where it is again a i x i. So, therefore, every string must be of this form. So, it is a i 1 the last symbol last string has to be x i 1, a i 2 corresponding to this we have x i 2 and so on up to a i m whenever we terminate. So, it will be x i. So, that is how we get the strings of the language generated by g 1. Similarly, g 2 and a grammar g 2 can be constructed with s 2 as a start symbol and sigma s is the alphabet s 2 has to be the start symbol here and p 2 is the same similar kind of productions. P 2 the set of all problems like this s 2 goes to a i s 2 y i and s 2 goes to a i y i for all i. So, therefore, the language generated by this contain the strings of this kind a i 1 a i 2 up to a i m y i m y i m minus 1 up to y n y i 1 for m greater than equal to 1. Now, from this g 1 and g 2 we construct another grammar g which is called g p corresponding to the instantial p c p is g p as follows. It contains b side s 1 and s 2 one additional start symbol, additional symbol s which is start symbol of the grammar over the same alphabet sigma s and p contains all the rules of g 1 all the rules of g 2 that is p 1 union p 2 and then from the start symbol of s you may either go to start symbol of g 1 or the start symbol of g 2. That means, clearly the language of g p is nothing but l of g 1 union l of g 2 because from start symbol of s you go to either s 1 or to s 2 and then you use the corresponding rules from g 1 or from g 2. So, that l of g p is union of l of g 1 union union of l of g 1 and l of g 2. Now, observe that p has a solution if and only if c f g g p is ambiguous. So, this will prove our claim. Now, assume that i 1 i 2 up to i k be a solution to p if it is the case x i 1 x i 2 x i k must be equal to x i 1 y y i 1 y i 2 up to y i k. Now, observe that the string a i k a i k minus 1 up to a i 1 then x i 1 x i 2 up to x i k has two left most revisions in g p as shown below. We start with s in one step we go to s 1 in one step you apply the rule s 1 goes to a i 1 s 1 x i k. The next step you apply the rule s 2 a i k minus 1 s 1 x i k minus 1 and so on. Eventually we apply the terminated by s goes to a i 1 x i 1 and hence this is nothing but w. Now, similarly you can show that in one step from s we go to s 2 then apply the rules first step a i k s 2 y i k next step a i k s 2 y i k minus 1 eventually terminate with a i 1 y i 1. But, this one this string and this string both are identical because already have said that i 1 i 2 up to i k is a solution to p c p hence this part x 1 i 1 x i 1 x i 2 x i k and y i 1 y i 2 y i k these two are same and the first part is always same a i k up to a i 1 a i k up to a i 1 therefore, both are w. But, distinctly these two are this one and this one are two different left most derivation for the same string w and hence the grammar is ambiguous. Similarly, if we assume that conversely if we assume that g p is ambiguous then there must exist a string u that belongs to g p which has two left most derivations must have because we have said that g p is ambiguous. Now, since every string in l of g 1 has a unique left most derivation in g 1 also it is same thing for g 2 every string in l of g 2 has unique left most derivation in g 2 and since l of g p is union of l of g 1 and l of g 2 we have for u belong to l of g 1 and u belongs to must belong to l of g 2. Therefore, u must be some a j 1 a j 2 up to a j r for some r then x j r x j r minus 1 up to x j 1 similarly, u must be a l 1 a l 2 up to a l s then y l s y l s minus 1 up to y l 1 and therefore, r and s must be same and j 1 must be equal to l 1. So, that these two are identical similarly, j 2 and l 2 must be identical. So, the next two are identical up to a j r must be equal to a l s that means, j r equal to l s hence x j r x j r minus 1 up to x j i j 1 must be equal to y j r y j r minus 1 up to y j 1. So, that j r j r minus 1 up to j 1 is a solution to p c p. So, this shows that the p c p instant the instant of the instant of p a instant of p c p p has a solution if and only if the grammar g grammar g p that we have constructed from the instant of p c p p is ambiguous. So, therefore, ambiguity of C f g determining the ambiguity of C f g of any arbitrary C f g is undesirable. Since, we have given a reduction from the p c p to this ambiguity problem of C f g.