S1 -> aS1b | ε
Language L2 is defined by the grammar:
S2 -> abS2 | ε
Consider the following statements:
P: L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
Correct : R
Given:
Language L1 grammar: S1 → aS1b | ε
Language L2 grammar: S2 → abS2 | ε
Statements:
P: L1 is regular
Q: L2 is regular
To find:
Which statement is TRUE among the given options.
Solution:
First, let me look at the language L1.
Starting from S1, applying S1 → aS1b repeatedly gives strings like ε, ab, aabb, aaabbb, and so on.
So, L1 = {anbn | n ≥ 0}.
A finite automaton cannot keep track of an arbitrary number of a's to match with b's because it has finite memory.
By the pumping lemma, this is a standard non-regular language.
So L1 is not regular, which means statement P is false.
Now let me analyze language L2.
Starting from S2, the production S2 → abS2 generates repeated copies of "ab".
When it terminates with ε, the strings generated are ε, ab, abab, ababab, and so on.
So, L2 = {(ab)n | n ≥ 0}.
I can write the regular expression for this directly as (ab)*.
Since it has a valid regular expression and can easily be recognized by a simple DFA with two states, L2 is regular.
This means statement Q is true.
Hence, P is false and Q is true.
Answer: (C) P is false and Q is true
Similar Questions
Total Unique Visitors