edited by
6,007 views
35 votes
35 votes

Consider the following languages.

  • $L_1 = \{a^i b^j c^k \mid i = j, k \geq 1\}$
  • $L_2 = \{a^i b^j \mid j = 2i, i \geq 0\}$

Which of the following is true?

  1. $L_1$ is not a CFL but $L_2$ is
  2. $L_1 \cap L_2 = \varnothing $ and $L_1$ is non-regular
  3. $L_1 \cup L_2$ is not a CFL but $L_2$ is
  4. There is a $4$-state PDA that accepts $L_1$, but there is no DPDA that accepts $L_2$.
edited by

2 Answers

Best answer
46 votes
46 votes

Both the languages can be accepted by a DPDA:

$L_1 =$ start pushing element $X$ into the stack on input '$a$' ... start to pop  $X$ on input '$b$' ... move to final state when stack empty and input  = '$c$'

$L_2 =$ start pushing elements $XX$ into the stack on input '$a$' ... start to pop  $X$ on input '$b$' ... move to final state when stack empty and input  = 'epsilon'

So, (A) and (D) are False.

$L_1 \cup L_2$ is a CFL ... we can build it by having $L_1, L_2$ and an extra state ... and an 'epsilon' transition to both $L_1$ and $L_2$ from that extra state.

So, (C) is false.

$L_1 \cap L_2 =$ Phi because we have no string $a^ib^j$ where $i=j$ and $i=2j$ for $i,j \geq1$

and clearly $L_1$ is not a regular language

So, (B) is true.

edited by
0 votes
0 votes
the grammar for L2 will be  S → aSbb | ϵ

the grammar for L1 will be  S → S1C , S1 → aS1b | ϵ , C → cC | c

so both are CFL. and L1 is not regular as we cannot have finite automata which gives same no of b’s as a’s.
Answer:

Related questions

56 votes
56 votes
6 answers
1
Ishrat Jahan asked Oct 28, 2014
12,542 views
Consider the following two finite automata. $M_1$ accepts $L_1$ and $M_2$ accepts $L_2$.$M_1$$M_2$ Which one of the following is TRUE?$L_1 = L_2$$L_1 \subset L_2$$L_1 \ca...
44 votes
44 votes
7 answers
3
Ishrat Jahan asked Oct 28, 2014
14,961 views
Consider a CFG with the following productions.$S \to AA \mid B$$A \to 0A \mid A0 \mid 1$$B \to 0B00 \mid 1$$S$ is the start symbol, $A$ and $B$ are non-terminals and 0 an...