Consider the following two languages : \(L_1 = \{ x \mid \text{ for some y…

2018

Consider the following two languages :

\(L_1 = \{ x \mid \text{ for some y with } \mid y \mid = 2^{\mid x \mid} , xy \in \text{ L and L is regular language} \}\)

\(L_2=\{ x \mid \text{ for some y such that } \mid x \mid = \mid y \mid , xy \in \text{ L and L is regular language}\}\)

Which one of the following is correct ?

  1. A.

    Only \(𝐿_1\) is regular language

  2. B.

    Only \(𝐿_2\) is regular language

  3. C.

    Both \(𝐿_1\) and \(𝐿_2\) are regular languages

  4. D.

    Both \(𝐿_1\) and \(𝐿_2\) are not regular languages

Attempted by 31 students.

Show answer & explanation

Correct answer: C

Answer: Both L1 and L2 are regular languages.

Key idea: Work with a deterministic finite automaton (DFA) for the regular language L.

  • Reason for L2: After reading x the DFA is in a specific state p determined by x. For that state p the set of suffix lengths l that lead from p to an accepting state is ultimately periodic, so membership of |x| in that set depends only on |x| modulo some period m. A finite automaton can track |x| modulo m while reading x and accept exactly those x for which |x| falls into an accepting residue class, so L2 is regular.

  • Reason for L1: Using the same DFA and the state p reached after x, we must check whether 2^{|x|} belongs to the periodic set of good suffix lengths from p. Fix the period m for which membership depends only on n mod m. The value 2^{|x|} mod m can be computed on the fly while reading x by initializing a residue r = 1 and, for each input symbol of x, replacing r by (2·r) mod m. Build a product automaton whose state records (current DFA state p, current residue r). At the end, accept exactly when r is one of the residues that correspond to a suffix length leading to acceptance from p. This construction is finite, so L1 is regular.

Conclusion: Both languages are decidable by finite automata constructed from the DFA for L plus simple modular bookkeeping, so both L1 and L2 are regular.

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

Explore the full course: Mppsc Assistant Professor