GATE / CS ARCHIVE

SIMILAR QUESTIONS / THEORY OF COMPUTATION

Accumulate finite-group products and distinguish with inverses

2 questions solved the same way, newest first. Back to Theory of Computation

How these are solved

Both map a word to an accumulated finite-group element, accept one target element, and ask minimum DFA size. Construct one state per reachable group element and use a completing inverse suffix to distinguish two accumulated products.

2 marks · NAT
Report issue

Finite Automata

Question 60, GATE 2025: Let Σ={1,2,3,4}. For a string x, prod(x) is the product of its symbols modulo 7, with prod(ε)=1. Define L={x:prod(x)=2}. How many states does a minimum DFA for L have?
Tap to enlarge
Answer & solution

Official answer: 6

Step through it (2 parts)

No input symbol is divisible by 7, so a product can never have residue 0. A DFA can keep one of the six nonzero residues 1,…,6 as its state. Start in state 1, use transition δ(r,a)=ra mod 7 for a∈{1,2,3,4}, and accept only state 2. This proves that six states suffice.

To prove minimality, first show all six residues are reachable. Repeated input 3 gives the cycle 1→3→2→6→4→5→1, so every state is reached by some power of the string symbol 3.

Next distinguish two different residues r and s. Nonzero residues modulo the prime 7 have multiplicative inverses. Choose a suffix whose product is t=2r−1 mod 7. Such a suffix exists because powers of 3 realize every nonzero residue. Appending it to a prefix with product r yields rt=2 and is accepted. Appending it to a prefix with product s cannot yield 2: st=rt would imply s=r after cancellation. Thus every pair of reachable states has different residual languages.

By the DFA distinguishability criterion, none of these states can be merged. Exactly six are necessary and sufficient; no seventh zero-residue state is reachable or needed for this alphabet. Answer: 6.

Original paper, page 45 · Answer key

2 marks · NAT
Report issue

Minimal DFA for identity permutations

Finite Automata

Question 48, GATE 2019: The alphabet Σ consists of all bijections of {1,...,5} to itself. A word x=x1...xn denotes the composition π(x)=x1∘...∘xn; the empty composition is identity. L contains words whose composition is identity. Find the number of states in a smallest DFA recognizing L.
Tap to enlarge
Answer & solution

Official answer: 120

1. Each alphabet symbol is a permutation of five objects, so there are 5!=120 possible permutations. A prefix matters only through its accumulated composition, suggesting a state for each permutation.
2. Construct that DFA: start in the identity state; if the current state is g and the next symbol is σ, transition to g∘σ. Make identity the sole accepting state. Associativity ensures the stored state after x is exactly π(x), so this 120-state DFA recognizes L.
3. All 120 states are reachable: reading the single alphabet symbol g takes the identity start to g. Hence there are no unreachable states to discard.
4. To prove no states can be merged, take distinct permutations g and h. Append the one-letter suffix g^−1, which is available because inverses are also permutations in Σ. From g this produces g∘g^−1=id and accepts.
5. From h the same suffix produces h∘g^−1. It cannot equal id, since that would imply h=g after composing with g. Thus it rejects, so the two states are distinguishable.
6. Every pair is distinguishable, proving a lower bound of 120 states. Combined with the construction, the minimum is exactly 120. Merely counting symbols would not prove minimality without the reachability and distinguishing-suffix arguments.

Original paper, page 14 · Answer key