Let L be the language generated by regular expression 0*10* and accepted by…
2016
Let L be the language generated by regular expression 0*10* and accepted by the deterministic finite automata M. Consider the relation RM defined by M. As all states are reachable from the start state, RM has _____ equivalence classes.
- A.
3
- B.
4
- C.
5
- D.
6
Attempted by 43 students.
Show answer & explanation
Correct answer: A
Answer: There are 3 equivalence classes.
Reasoning: The language described by 0*1 0* is the set of all strings over {0,1} that contain exactly one '1'. Prefixes of input strings fall into three distinct behaviour classes with respect to which continuations will lead to acceptance.
Prefixes with no '1' seen yet (e.g., ε, 0, 00). From here, appending a single '1' followed by zeros can produce an accepting string.
Prefixes with exactly one '1' seen (e.g., 1, 01, 0010). These are already in the accepting condition provided only zeros follow.
Prefixes with two or more '1's (e.g., 11, 101). Once two '1's appear, no continuation can make the string belong to the language (dead class).
Distinguishing the classes:
No '1' vs exactly one '1': use the empty suffix ε. A prefix with no '1' plus ε is not accepted, whereas a prefix that already is '1' plus ε is accepted.
Exactly one '1' vs two or more '1's: use the empty suffix ε. A prefix with exactly one '1' is accepted, while a prefix with two '1's is not.
No '1' vs two or more '1's: use the suffix '1'. Appending '1' to a prefix with no '1' can create an accepted string, while appending '1' to a prefix that already has two '1's cannot.
Conclusion: These three mutually distinguishable classes correspond to three reachable states in the minimal DFA (start/no '1', accepting/exactly one '1', dead/two or more '1's). Therefore R_M has 3 equivalence classes.