Decidability-and-Undecidability
Question 1 |
L1=〈M〉|M takes more than 2021 steps on all inputs
L2=〈M〉|M takes more than 2021 steps on some input
Which one of the following options is correct?
Both L1and L2 are undecidable. | |
L1is undecidable and L2is decidable. | |
L1is decidable and L2is undecidable. | |
Both L1and L2 are decidable. |
L1 is decidable.
We can take all strings of length zero to length 2021.
If TM takes more than 2021 steps on above inputs then definitely it will take more than 2021 steps on all input greater than length 2021.
If TM takes less than 2021 steps:
In such a case suppose TM takes less than 2021 steps (let's say 2020 steps ) for string length 2021, 2022, 2023, then definitely TM will take 2020 steps for all input greater than 2023. Hence in both cases it is decidable.
Similarly L2 is also decidable. If we can decide for all inputs then we can decide for some inputs also.
Question 2 |
Which of the following languages are undecidable? Note that
- L1 =
L2 = {
L3 = {
L4 = {
L2 and L3 only
| |
L1 and L3 only
| |
L2, L3 and L4 only | |
L1, L3 and L4 only |
Only L3 is decidable. We can check whether a given TM reach state q in exactly 100 steps or not. Here we have to check only upto 100 steps, so here is not any case of going to infinite loop.
Question 3 |
Which of the following problems are decidable?
1) Does a given program ever produce an output?
2) If L is a context-free language, then, is also context-free?
3) If L is a regular language, then, is also regular?
4) If L is a recursive language, then, is also recursive?
1, 2, 3, 4 | |
1, 2 | |
2, 3, 4 | |
3, 4 |
Context free languages are not closed under complement operation, so compliment of CFL may or may not be CFL. Hence statement 2 is also undecidable.
Complement of Regular languages is also regular. Since a DFA that accepts the complement of L, i.e. ∑* – L, can be obtained by swapping its final states with its non-final states and vice-versa. Hence it is decidable and if L is a regular language, then, L must also be regular.
Recursive languages are closed under complement, so if L is a recursive language then L must also be recursive, hence it is decidable.
Question 4 |
Which of the following statements is false?
The Halting problem of Turing machines is undecidable. | |
Determining whether a context-free grammar is ambiguous is undecidbale. | |
Given two arbitrary context-free grammars G1 and G2 it is undecidable whether L(G1) = L(G2). | |
Given two regular grammars G1 and G2 it is undecidable whether L(G1) = L(G2). |
1) Membership
2) Emtiness
3) Finiteness
4) Equivalence
5) Ambiguity
6) Regularity
7) Everything
8) Disjointness
All are decidable for Regular languages.
→ First 3 for CFL.
→ Only 1st for CSL and REC.
→ None for RE.
Question 5 |
Which one of the following is not decidable?
Given a Turing machine M, a stings s and an integer k, M accepts s within k steps | |
Equivalence of two given Turing machines | |
Language accepted by a given finite state machine is not empty | |
Language generated by a context free grammar is non empty |
In (A) the number of steps is restricted to a finite number 'k' and simulating a TM for 'k' steps is trivially decidable because we just go to step k and output the answer.
(B) Equivalence of two TM's is undecidable.
For options (C) and (D) we do have well defined algorithms making them decidable.
Question 6 |
Consider the following decision problems:
- (P1) Does a given finite state machine accept a given string
(P2) Does a given context free grammar generate an infinite number of stings
Which of the following statements is true?
Both (P1) and (P2) are decidable | |
Neither (P1) nor (P2) are decidable | |
Only (P1) is decidable | |
Only (P2) is decidable |
For P2, check if the CFG generates any string of length between n and 2n−1, where n is the pumping lemma constant. If So, L (CFG) is infinite, else finite. Finding the pumping lemma constant is not trivial. So both P1, P2 are decidable.
Question 7 |
Consider two languages L1 and L2 each on the alphabet ∑. Let f: ∑ → ∑ be a polynomial time computable bijection such that (∀ x)[x ∈ L1 iff f(x) ∈ L2]. Further, let f-1 be also polynomial time computable.
Which of the following CANNOT be true?
L1 ∈ P and L2 is finite | |
L1 ∈ NP and L2 ∈ P
| |
L1 is undecidable and L2 is decidable | |
L1 is recursively enumerable and L2 is recursive |
Now if L2 is decidable then L1 should also be decidable. Hence, option (c) is wrong.