Regular expression for the complement of language L = {an bm | n ≥ 4, m ≤ 3} is

2014

Regular expression for the complement of language L = {an bm | n ≥ 4, m ≤ 3} is

  1. A.

    (a + b)* ba(a + b)*

  2. B.

    a* bbbbb*

  3. C.

    (λ + a + aa + aaa)b* + (a + b)* ba(a + b)*

  4. D.

    None of the above

Attempted by 126 students.

Show answer & explanation

Correct answer: D

We want the complement of L = { a^n b^m | n ≥ 4, m ≤ 3 } over the alphabet {a,b}.

Strings not in L fall into three mutually covering categories:

  • Strings that are not of the form a* b* (i.e., there is at least one occurrence of the substring "ba"). Regex: (a+b)* b a (a+b)*

  • Strings of the form a^n b^m with too few a's (n ≤ 3). Regex: (λ + a + aa + aaa) b*

  • Strings of the form a^n b^m with too many b's (m ≥ 4). Regex: a* bbbb b*

Combine these by union to get a full regular expression for the complement:

(λ + a + aa + aaa) b* + a* bbbb b* + (a + b)* b a (a + b)*

Remarks: overlaps between the three parts are allowed (the union handles duplicates). This expression accepts exactly those strings that are not of the form a^n b^m with n ≥ 4 and m ≤ 3.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor