Context-Free Languages  

 

Part I: Regular Languages

For all questions in Part 1, Σ = {0, 1}.

  1. Given the formal description of NFA M1 = ({q1, q2, q3, q4}, Σ, δ, q1, {q2, q4}) where δ is defined below:

δ(q1, 0) = {q2}

δ(q1, ε) = {q3}

δ(q2, 1) = {q1, q4}

δ(q3, 0) = {q2}

δ(q3, 1) = {q1}

δ(q4, 1) = {q2}

Convert NFA M1 into a DFA.

  1. Consider the description of language L1.

L1 = { w | dec(w) ≠ 0 and dec(w) is divisible by 5 }

where dec(w) is an equivalent decimal value (base 10) of the given binary encoded  string. For instance, 0, 101, 1010, 1111, and 10100 ∈ L1.

Show that L1 is regular.

  1. Let L2 = {0m1n | m, n ≥ 0 and m n}. Use pumping lemma for regular languages to show that L2 is not regular.

Part II: Context-Free Languages  

  1. Let the grammar G1 = ({A, B, C}, {0, 1}, R, A) where R is defined below.

A → 1B1 | C

B → 0B0 | 1B1 | C

C → 0 | 1 | ε

  1. Show that G1 is ambiguous.
  2. (4 Describe the language the G1 generates in English sentences i.e., what kinds/patterns of strings that it generates.
  3. Let the grammar G2 = ({S, A, B}, {0, 1}, R, S) where R is defined below.

S → 01S | 0A

A → 1A | B | ε

B → 00 | ε

Give a corresponding grammar in Chomsky Normal Form.

  1. Let L3 = { ambnc2m-n | m > 0 and n ≥ 0 }. Show that L3 is context-free.

 

 

Part III: Turing Machines  

  1. Let L4 = { w | w is a palindrome whose length is odd and its middle symbol is 1 }. Show that L4 is Turing-decidable. Recall that a palindrome is a string  that reads the same way in both forward and backward directions i.e., w = wR.

Part IV: True/False  

Determine whether each of the following statements is true or false based on Sipser’s book.  Justify your answers; otherwise, you will not receive any credits. You can refer to any  theorems to support your answers.

  1. There must be at least one accepting state in a DFA.
  2. Every regular language is context-free.
  3. The class of regular language is closed under difference operation (–). Note that – is the binary operation on sets such that A–B yields the set of all strings that are in A but not in B.
  4. Every context-free language is Turing-recognizable.
  5. There can only be one accepting state in a Turing Machine.