Question

Let Σ\Sigma be the set of all bijections from {1,…,5}\{1, \dots, 5\} to {1,…,5}\{1, \dots, 5\}, where idid denotes the identity function, i.e. id(j)=j,  ∀jid(j) = j, \; \forall j. Let ∘\circ denote composition on functions. For a string x=x1x2…xn∈Σn,  n≥0x = x_1 x_2 \dots x_n \in \Sigma^n, \; n \ge 0, let π(x)=x1∘x2∘⋯∘xn\pi(x) = x_1 \circ x_2 \circ \dots \circ x_n.

Consider the language L={x∈Σ∗∣π(x)=id}L = \{x \in \Sigma^* \mid \pi(x) = id\}. The minimum number of states in any DFA accepting LL is ________.

Official answer and solution
Official answer
120
From
Official GATE 2019 answer key

Solution

Use the Myhill-Nerode theorem to determine the number of equivalence classes of the right congruence relation defined by language LL.

Let S={1,2,3,4,5}S = \{1, 2, 3, 4, 5\}. The alphabet Σ\Sigma is the set of all bijections (permutations) from SS to SS. Under function composition ∘\circ, this set forms the symmetric group S5S_5, which contains ∣S5∣=5!=120|S_5| = 5! = 120 elements.

For any string x=x1x2…xn∈Σ∗x = x_1 x_2 \dots x_n \in \Sigma^*, the accumulated composition π(x)=x1∘x2∘⋯∘xn\pi(x) = x_1 \circ x_2 \circ \dots \circ x_n is a specific permutation in S5S_5. The empty string ϵ\epsilon evaluates to the identity permutation π(ϵ)=id\pi(\epsilon) = id.

The language is defined as L={x∈Σ∗∣π(x)=id}L = \{x \in \Sigma^* \mid \pi(x) = id\}.

According to the Myhill-Nerode theorem, the minimum number of states in any deterministic finite automaton (DFA) accepting LL equals the number of equivalence classes of the right congruence relation ∼L\sim_L, where:

u∼Lv  ⟺  ∀w∈Σ∗,  uw∈L  ⟺  vw∈Lu \sim_L v \iff \forall w \in \Sigma^*, \; uw \in L \iff vw \in L

Notice that uw∈Luw \in L means π(u)∘π(w)=id\pi(u) \circ \pi(w) = id, which is equivalent to π(w)=(π(u))−1\pi(w) = (\pi(u))^{-1}.
Similarly, vw∈Lvw \in L means π(w)=(π(v))−1\pi(w) = (\pi(v))^{-1}.
Therefore:

  • If π(u)=π(v)\pi(u) = \pi(v), then (π(u))−1=(π(v))−1(\pi(u))^{-1} = (\pi(v))^{-1}, so for any ww, uw∈L  ⟺  vw∈Luw \in L \iff vw \in L. Thus u∼Lvu \sim_L v.
  • If π(u)≠π(v)\pi(u) \ne \pi(v), their inverses are distinct. Choosing ww as the single symbol representing the bijection (π(u))−1∈Σ(\pi(u))^{-1} \in \Sigma, we have π(uw)=id\pi(uw) = id (so uw∈Luw \in L), but π(vw)=π(v)∘(π(u))−1≠id\pi(vw) = \pi(v) \circ (\pi(u))^{-1} \ne id (so vw∉Lvw \notin L). Thus u̸∼Lvu \not\sim_L v.

Consequently, two strings are equivalent under ∼L\sim_L if and only if their compositions yield the exact same permutation in S5S_5.

Since all 120 permutations in S5S_5 are reachable (each permutation is a single symbol in Σ\Sigma), there are exactly 120 distinct equivalence classes. Hence, the minimum number of states in any DFA accepting LL is 120.

Final answer

120

Common trap

Thinking that because the language checks equality with a single element (the identity), only 2 states are needed, ignoring that a DFA must maintain memory of the current state of the permutation.

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

Source

Paper
GATE 2019 Computer Science and Information Technology (CS)
Question
58 of 65, printed as CS Q.48
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.