東京大学 情報理工学系研究科 コンピュータ科学専攻 2016年8月実施 専門科目I 問題1
Author
kainoj
Description
A language L⊆Σ∗ over a finite alphabet Σ is said to be regular if there exists a finite automaton A such that L=L(A). Here
L(A)={w∈Σ∗∣w is accepted by A}.
Answer the following questions:
(1) We fix an alphabet Σ by Σ={a,b}. For the language L1 below, present a nondeterministic finite automaton (NFA) A1 such that: L(A1)=L1, and the number of states of A1 is not greater than 4.
L1={w∈Σ∗∣there is a character l∈Σ that occurs more than once in w}.
(2) Assume that Σ is a finite alphabet. Prove the following: any finite language L={w1,…,wn}⊆Σ∗ is regular. Here n is a nonnegative integer.
(3) We fix an alphabet Σ by Σ={a,b}. For the language L1 in Question (1), present a deterministic finite automaton (DFA) A2 such that: L(A2)=Σ∗∖L1, and the number of states of A2 is not greater than 5. Here Σ∗∖L1 denotes the complement of L1⊆Σ∗.
(4) Give a decision procedure for the following problem, and explain it briefly.
- Input: Nondeterministic finite automaton A.
- Output: Whether the language L(A) is an infinite set or not.
题目描述
对有限字母表 Σ 上的语言 L⊆Σ∗,若存在有限自动机
A 使 L=L(A),则称 L 为正则语言,其中
L(A)={w∈Σ∗∣w 被 A 接受}.
回答下列问题。
(1)固定 Σ={a,b}。对语言
L1={w∈Σ∗∣w 中存在某个字符出现至少两次},
构造一个状态数不超过 4 的 NFA A1,满足
L(A1)=L1。
(2)设 Σ 为有限字母表。证明任意有限语言
L={w1,…,wn}⊆Σ∗ 都是正则语言,其中 n 可以为非负整数。
(3)仍令 Σ={a,b}。针对第(1)问的 L1,构造一个状态数不超过
5 的 DFA A2,使
L(A2)=Σ∗∖L1.
(4)给出并简要说明一个判定过程:输入一个 NFA A,输出其语言
L(A) 是否为无限集。
Kai
(1)
Σ={a,b}.
Give NFA A1 with no more than 4 states recognizing L1={w∈Σ∣∃l∈Σ∣w∣l>1}.
s∗q0q1q2q3aq0,q1q3q2q3bq0,q2q1q3q3
(2)
Prove: if Σ is finite alphabet, then any finite language L={w1,⋯,wn}⊆Σ∗ is regular, n∈N.
That is we should construct a finite automaton accepting L.
We can construct a ϵ-NFA containing n "branches", each recognizing wi.
Now, for every ϵ-NFA, there must exist equivalent DFA recognizing the same language.
We can also construct the DFA explicitly.
Start with automaton (NFA) recognizing w1: there are ∣w1∣+1 states, the last one is accepting and transitions are labeled with next letters of w1.
For wi (i=2,⋯,n) try to traverse the automaton as far as you can, i.e. until transition for symbol wij exist.
If we can go no further, that is we read the longest common prefix of wi and some wk, k<i, then we make a new branch from a current state.
This branch consist of states and transitions labeled wi,j+1⋯wi,∣wi∣.
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 Σ.
(3)
Give DFA recognizing complement of L1 from (Q1), i.e L2=Σ∗∖L1.
Obviously L2={w∈Σ∣∀l∈Σ∣w∣l≤1}={ϵ,a,b,ab,ba}.
s,∗∗∗∗q1q2q3q4q5aq2q5q4q5q5bq3q4q5q5q5
(4)
Given NFA A, decide whether L(A) is empty or not.
% For every NFA A, there exist equivalent DFA D, that is, L(A)=L(D) (subset construction).
% Let's examine such DFA D.
Since language of A is regular, then from pumping lemma we can "pump" words longer than some N – pumping lemma constant.
That is, if L(A) has some word longer than N, then L(A) is infinite.
We just need to check every possible word w: N<w≤2N.
If any such word is accepted by A, then L(A) is infinite.
We don't need to check words longer of 2N: if a word is longer than 2N, then from PL, we can iterative reduce its length, so w has length shorter than 2N.
How to choose N? We know that for every NFA A, there exist equivalent DFA D, that is, L(A)=L(D) (subset construction).
We don't need to construct such DFA.
All we know is that, D might have exponentially more states than A.
Take N=∣Σ∣∣QD∣+42, where QD is set of D's states.