Question

Consider the language LL over the alphabet {0,1}\{0, 1\}, given below:

L={w∈{0,1}∗∣w does not contain three or more consecutive 1’s}.L = \{w \in \{0, 1\}^* \mid w \text{ does not contain three or more consecutive 1's}\}.

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

Official answer and solution
Official answer
4
From
Official GATE 2023 answer key

Solution

Construct the minimal DFA that rejects any string containing the substring 111.

The language LL consists of all binary strings that do not contain the substring 111111. A minimal DFA tracks the number of consecutive 11's read immediately preceding the current position:

  1. State q0q_0: 0 consecutive 11's seen (Start state, Accepting).
    • On 0→q00 \to q_0
    • On 1→q11 \to q_1
  2. State q1q_1: 1 consecutive 11 seen (Accepting).
    • On 0→q00 \to q_0
    • On 1→q21 \to q_2
  3. State q2q_2: 2 consecutive 11's seen (Accepting).
    • On 0→q00 \to q_0
    • On 1→q31 \to q_3
  4. State q3q_3: 3 consecutive 11's seen (Dead/Trap state, Non-accepting).
    • On 0→q30 \to q_3
    • On 1→q31 \to q_3

These 4 states are pairwise distinguishable by suffix distinguishing extensions (e.g., 1111 distinguishes q1q_1 from q0q_0). By the Myhill-Nerode theorem, this DFA is minimal, having 4 states.

Final answer

4

Common trap

Omitting the dead/trap state q3q_3, which is mandatory in a complete Deterministic Finite-State Automaton.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2023 Computer Science and Information Technology (CS)
Question
63 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.