Docsity

Decidability of Equivalence of Context-Free Grammars (CS 6505 HW2), Assignments of Computer Science

Toggle sidebar
bg1
CS 6505 :HW2.
Uday Mantripragada
I worked with Gagan and Pranay for this HW
1 a) Lets assume that NEQCFG is decidable.
This means that the language NEQCFG and its complement are both recognizable. But, complement of
NEQCFG is EQCFG. This means that both NEQCFG and EQCFG are recognizable.
Now, EQCFG is recognizable and its complement NEQCFG is also recognizable. This implies that the
language EQCFG is decidable.
But given in the problem statement that EQCFG is not decidable, which makes our assumption is wrong.
=> NEQCFG is not decidable.
1b) We design a turing machine M as shown below:
1. Convert both G & H (which are both CFGs) to CNF.
2. Repeat the following steps for i = 0, 1, 2, 3, …
3. Generate all possible strings of length i using the derivations of G (using CNF of G).
4. Generate all possible strings of length i using the derivations of H (using CNF of H).
5. If a string w such that: w CNF(G) and w CNF(H) OR w CNF(H)CNF(H) and w CNF(H)CNF(G) then
accept and halt, else repeat 2.”
If there exists any string that belongs to one language and does not belong to another, it means that
L(G) L(H). So, the above mentioned machine accepts and halts for any two languages that differ in
atleast one string.
=>This machine M recognizes NEQCFG and so NEQCFG is recognizable.
1c) Lets assume that EQCFG is recognizable. We proved in part (b) that NEQCFG (which is the complement f
EQCFG ) is recognizable. This means that the language EQCFG is decidable. But , problem statement says
that EQCFG is un-decidable.
So, EQCFG is not recognizable.
pf3

Partial preview of the text

Download Decidability of Equivalence of Context-Free Grammars (CS 6505 HW2) and more Assignments Computer Science in PDF only on Docsity!

CS 6505 :HW2.

Uday Mantripragada I worked with Gagan and Pranay for this HW 1 a) Lets assume that NEQCFG is decidable. This means that the language NEQCFG and its complement are both recognizable. But, complement of NEQCFG is EQCFG. This means that both NEQCFG and EQCFG are recognizable. Now, EQCFG is recognizable and its complement NEQCFG is also recognizable. This implies that the language EQCFG is decidable. But given in the problem statement that EQCFG is not decidable, which makes our assumption is wrong. => NEQCFG is not decidable. 1b) We design a turing machine M as shown below:

  1. Convert both G & H (which are both CFGs) to CNF.
  2. Repeat the following steps for i = 0, 1, 2, 3, …
  3. Generate all possible strings of length i using the derivations of G (using CNF of G).
  4. Generate all possible strings of length i using the derivations of H (using CNF of H).
  5. If  a string w such that: w  CNF(G) and w  CNF(H) OR w  CNF(H) and w  CNF(G) then accept and halt, else repeat 2.” If there exists any string that belongs to one language and does not belong to another, it means that L(G)  L(H). So, the above mentioned machine accepts and halts for any two languages that differ in atleast one string. =>This machine M recognizes NEQCFG and so NEQCFG is recognizable. 1c) Lets assume that EQCFG is recognizable. We proved in part (b) that NEQCFG (which is the complement f EQCFG ) is recognizable. This means that the language EQCFG is decidable. But , problem statement says that EQCFG is un-decidable. So, EQCFG is not recognizable.

We construct a decider D for PALDFA as follows:

  1. We have the encoding of DFA M that identifies a palindrome.
  2. We can construct a PDA P that identifies whether a given string is a palindrome or not.
  3. Construct a PDA M’ such that L(M’) = L(M)  L(P)
  4. Convert M’ into its equivalent CFG G.
  5. We can design machine Z such that it decides the language ECFG.
  6. Use Z to determine if L(G) is empty.
  7. If L(G) is empty, reject; else accept. Constructing M’ takes finite time. Step 4 also takes finite time. Step 6 also takes finite time, as we can design a decider for ECFG that takes finite time. => D runs in finite steps and so PALDFA is decidable.