跳到主要内容

東京大学 情報理工学系研究科 コンピュータ科学専攻 2016年8月実施 専門科目I 問題1

Author

kainoj

Description

A language LΣL \subseteq \Sigma^* over a finite alphabet Σ\Sigma is said to be regular if there exists a finite automaton A\mathcal{A} such that L=L(A)L = \mathcal{L}(\mathcal{A}). Here

L(A)={wΣw is accepted by A}.\mathcal{L}(\mathcal{A}) = \{ w \in \Sigma^* \mid w \text{ is accepted by } \mathcal{A} \}.

Answer the following questions:

(1) We fix an alphabet Σ\Sigma by Σ={a,b}\Sigma = \{a, b\}. For the language L1L_1 below, present a nondeterministic finite automaton (NFA) A1\mathcal{A}_1 such that: L(A1)=L1\mathcal{L}(\mathcal{A}_1) = L_1, and the number of states of A1\mathcal{A}_1 is not greater than 44.

L1={wΣthere is a character lΣ that occurs more than once in w}.L_1 = \{ w \in \Sigma^* \mid \text{there is a character } l \in \Sigma \text{ that occurs more than once in } w \}.

(2) Assume that Σ\Sigma is a finite alphabet. Prove the following: any finite language L={w1,,wn}ΣL = \{w_1, \ldots, w_n\} \subseteq \Sigma^* is regular. Here nn is a nonnegative integer.

(3) We fix an alphabet Σ\Sigma by Σ={a,b}\Sigma = \{a, b\}. For the language L1L_1 in Question (1), present a deterministic finite automaton (DFA) A2\mathcal{A}_2 such that: L(A2)=ΣL1\mathcal{L}(\mathcal{A}_2) = \Sigma^* \setminus L_1, and the number of states of A2\mathcal{A}_2 is not greater than 55. Here ΣL1\Sigma^* \setminus L_1 denotes the complement of L1ΣL_1 \subseteq \Sigma^*.

(4) Give a decision procedure for the following problem, and explain it briefly.

  • Input: Nondeterministic finite automaton A\mathcal{A}.
  • Output: Whether the language L(A)\mathcal{L}(\mathcal{A}) is an infinite set or not.

Kai

(1)

Σ={a,b}\Sigma = \{a,b\}. Give NFA A1\mathcal{A}_1 with no more than 44 states recognizing L1={wΣlΣwl>1}L_1 = \{w\in \Sigma \:|\: \exists l\in \Sigma \: |w|_l > 1\}.

absq0q0,q1q0,q2q1q3q1q2q2q3q3q3q3\begin{array}{ll||l|l} & & a & b \\ \hline s & q_0 & q_0,q_1 & q_0,q_2 \\ & q_1 & q_3 & q_1 \\ & q_2 & q_2 & q_3 \\ * & q_3 & q_3 & q_3 \end{array}

(2)

Prove: if Σ\Sigma is finite alphabet, then any finite language L={w1,,wn}ΣL = \{w_1,\cdots,w_n\} \subseteq \Sigma^* is regular, nNn\in \mathbb{N}.

That is we should construct a finite automaton accepting LL. We can construct a ϵ\epsilon-NFA containing nn "branches", each recognizing wiw_i. Now, for every ϵ\epsilon-NFA, there must exist equivalent DFA recognizing the same language.

We can also construct the DFA explicitly. Start with automaton (NFA) recognizing w1w_1: there are w1+1|w_1|+1 states, the last one is accepting and transitions are labeled with next letters of w1w_1. For wiw_i (i=2,,ni=2,\cdots,n) try to traverse the automaton as far as you can, i.e. until transition for symbol wijw_{ij} exist. If we can go no further, that is we read the longest common prefix of wiw_i and some wkw_k, k<ik<i, then we make a new branch from a current state. This branch consist of states and transitions labeled wi,j+1wi,wiw_{i,j+1}\cdots w_{i, |w_i|}.

Now we need to assure that we constructed a DFA. For every state missing some transitions on some letters, add those transition leading to a "dead state", i.e. nonaccepting state with a self-loop labeled Σ\Sigma.

(3)

Give DFA recognizing complement of L1L_1 from (Q1), i.e L2=ΣL1L_2 = \Sigma^* \setminus L_1.

Obviously L2={wΣlΣwl1}={ϵ,a,b,ab,ba}L_2 = \{w\in \Sigma \:|\: \forall l\in \Sigma \: |w|_l \leq 1\} = \{\epsilon, a, b, ab, ba\}.

abs,q1q2q3q2q5q4q3q4q5q4q5q5q5q5q5\begin{array}{ll||l|l} & & a & b \\ \hline s,* & q_1 & q_2 & q_3 \\ * & q_2 & q_5 & q_4 \\ * & q_3 & q_4 & q_5 \\ * & q_4 & q_5 & q_5 \\ & q_5 & q_5 & q_5 \end{array}

(4)

Given NFA A\mathcal{A}, decide whether L(A)\mathcal{L(A)} is empty or not. % For every NFA A\mathcal{A}, there exist equivalent DFA D\mathcal{D}, that is, L(A)=L(D)\mathcal{L(A)} = \mathcal{L(D)} (subset construction). % Let's examine such DFA D\mathcal{D}. Since language of A\mathcal{A} is regular, then from pumping lemma we can "pump" words longer than some NN – pumping lemma constant. That is, if L(A)\mathcal{L(A)} has some word longer than NN, then L(A)\mathcal{L(A)} is infinite. We just need to check every possible word ww: N<w2NN < w \leq 2N. If any such word is accepted by A\mathcal{A}, then L(A)\mathcal{L(A)} is infinite. We don't need to check words longer of 2N2N: if a word is longer than 2N2N, then from PL, we can iterative reduce its length, so ww has length shorter than 2N2N.

How to choose NN? We know that for every NFA A\mathcal{A}, there exist equivalent DFA D\mathcal{D}, that is, L(A)=L(D)\mathcal{L(A)} = \mathcal{L(D)} (subset construction). We don't need to construct such DFA. All we know is that, D\mathcal{D} might have exponentially more states than A\mathcal{A}. Take N=ΣQD+42N = |\Sigma|^{|Q_D|} + 42, where QDQ_D is set of D\mathcal{D}'s states.