跳到主要内容

東京大学 情報理工学系研究科 コンピュータ科学専攻 2018年2月実施 問題2

Author

kainoj

Description

For each n1n \geq 1, let Σn\Sigma_n be {a1,,an}\{a_1, \dots, a_n\}, where a1,,ana_1, \dots, a_n are different from each other. For a word wΣnw \in \Sigma_n^*, we write wai|w|_{a_i} for the number of occurrences of aia_i in ww. We define the languages L,nL_{\forall, n} and L,nL_{\exists, n} over Σn\Sigma_n by:

L,n={wΣnwai is even for every i{1,,n}},L_{\forall, n} = \{w \in \Sigma_n^* \mid |w|_{a_i} \text{ is even for every } i \in \{1, \dots, n\}\},

and

L,n={wΣnwai is even for some i{1,,n}}.L_{\exists, n} = \{w \in \Sigma_n^* \mid |w|_{a_i} \text{ is even for some } i \in \{1, \dots, n\}\}.

Answer the following questions.

(1) Give a deterministic finite state automaton with 44 states that accepts L,2L_{\forall, 2}.

(2) Give a non-deterministic finite state automaton with 77 states (without ϵ\epsilon-transitions) that accepts L,3L_{\exists, 3}.

(3) Prove that, for every n1n \geq 1, every deterministic finite state automaton that accepts L,nL_{\exists, n} has at least 2n2^n states.

(4) Prove that, for every n1n \geq 1, every non-deterministic finite state automaton (without ϵ\epsilon-transitions) that accepts L,nL_{\forall, n} has at least 2n2^n states.

Kai

(1)

This one was also solved in Automata Theory, Languages and computation 3rd ed, 2.2.4, Example 2.4

Explanation:

  • A: "number of aa's is even, number of bb's is even"
  • B: "number of aa's is odd, number of bb's is even"
  • C: "number of aa's is even, number of bb's is odd"
  • D: "number of aa's is odd, number of bb's is odd"

(2)

Begin with an ϵ\epsilon-NFA as depiced in Fig. (2-a). It "guesses" which letter appears even number of times. To make it ϵ\epsilon-free, we either follow him: https://youtu.be/sq-dLKAd6bo?t=1714 or consider the followig: starting from start state, how far, i.e. which states can we reach on letter aa? There are 33 such states. We simply draw an edge to those states. Do the same for b,cb,c. The final answer is on Fig. (2-b)

Fig. (2-a)
Fig. (2-b)

(3)

Prove that, for every n1n\geq 1, every deterministic finite state automaton that accepts L,nL_{\exists ,n} has at least 2n2^n states.

First, I'll show that there is a DFA with 2n2^n states. We can encode states of DFA L,nL_{\exists ,n} as a binary string B=(bn,bn1,,b2,b1)B = (b_n, b_{n-1}, \cdots, b_2, b_1) of length nn, where bi=1b_i = 1 iff numbers of aia_i's is odd in so-far read sequence, else 00. A state is accepting if its binary representation has at least one zero. There are 2n2^n such strings.

Now, I'll show that there is no DFA with less than 2n2^n states. If the DFA had fewer than 2n2^n states, then there would be some state qq such that the DFA can be in state qq after reading two different sequences of length nn, say a=a1a2ana = a_1a_2\cdots a_n and b=b1b2bnb = b_1b_2\cdots b_n. If the sequences were of different parity, i.e. one of the sequences had a letter which appears even number of times, and the other sequence hadn't, then qq would be both accepting and nonaccepting state. If the sequences were of the same parity, then we could append some sequence c1cmΣc_1\cdots c_m \in \Sigma^* to aa and bb such that a1a2anc1cma_1a_2\cdots a_n c_1\cdots c_m and b1b2bnc1cmb_1b_2\cdots b_n c_1\cdots c_m have different parity. Consider state pp that the DFA enters after reading c1cmc_1\cdots c_m. Then pp must be both accepting and nonaccepting, since either of a1a2anc1cma_1a_2\cdots a_n c_1\cdots c_m and b1b2bnc1cmb_1b_2\cdots b_n c_1\cdots c_m is accepted and the other isn't.

This problem could be also one-lined using Myhill-Nerode theorem. The only one difficulty here is to define 2n2^n equivalent classes. Try fiddling with binary strings.

(4) - send help

Prove that, for every n1n\geq 1, every non-deterministic finite state automaton (without ϵ\epsilon-transitions) that accepts L,nL_{\forall ,n} has at least 2n2^n states.

Begin with constructing DFA AA accepting L,nL_{\forall ,n} the same way as in Q3 – except that AA has only one accepting state, a string of all 00's. Obviously this DFA is also a~NFA. The equivalent NFA simply cannot guess parity of some letters: it has to remember information of parity of each letter. As shown in Q3, every letter requires 22 bits, so minimum of 2n2^n states are required.