IAE Academy

GATE 2023 CS Q.63: solution and answer

GATE 2023 · CSQ.63 · 2 marks · NAT

Consider the language over the alphabet , given below:

The minimum number of states in a Deterministic Finite-State Automaton (DFA) for is ______.

See the question in the paper

Answer and solution

ANSWER

The minimum DFA for has 4 states: three accepting states that count a run of 0, 1 or 2 consecutive 1's, and one non-accepting dead state.

Official answer: 4Source: Official answer key, GATE 2023 CS (IIT Kanpur)

  1. A DFA for only has to remember how many 1's have been read in a row (0, 1 or 2), and whether a run of three 1's has already occurred.

  2. Let mean the current run of 1's has length 0 (the last symbol was 0, or nothing has been read yet). Let mean the run has length exactly 1, and mean it has length exactly 2. Let mean three consecutive 1's have been seen. Once that happens, no later symbols can fix it, so is a dead state.

  3. Transitions: , ; , ; , ; . The start state is .

  4. Accepting states are , because every string that reaches them has no run of three 1's. The dead state is non-accepting.

  5. Distinguishability check with suffixes. The empty string separates from the other three states, since rejects and the others accept. The suffix separates from and from : from it leads to and is rejected, while from it leads to and from to , both accepted. The suffix separates from : from it leads to and is rejected, while from it leads to and is accepted.

  6. All four states are pairwise distinguishable, so no two can be merged and this DFA is minimal. A complete DFA needs the dead state, so the minimum number of states is .

KEY IDEA

The language needs only a counter of the current run of 1's (0, 1, 2) plus one dead state for "three in a row seen". Minimality follows from showing every pair of states is distinguishable by a suffix.

WATCH OUT FOR

Leaving out the dead state and answering 3. A complete DFA must define a transition from every state on every symbol, so the trap state for "three consecutive 1's seen" counts as a fourth state.

From the GATE 2023 CS paper. Every question of this paper · Download the full paper · All 18 Finite automata questions, with notes

More Finite automata questions