東京大学 情報理工学系研究科 コンピュータ科学専攻 2016年8月実施 専門科目I 問題1
Author
kainoj, 祭音Myyura
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)
We construct a finite automaton accepting L. One construction is an ϵ-NFA with n branches, the i-th branch spelling exactly wi; every ϵ-NFA has an equivalent DFA.
The DFA can also be constructed explicitly. Start with the path recognizing w1: it has ∣w1∣+1 states, its transitions are labeled by the successive letters of w1, and its last state is accepting. For each wi with i≥2, follow the already constructed transitions along its longest existing prefix, then attach a new path labeled by the remaining suffix. Mark the state reached after every complete wi as accepting.
Finally, send each missing transition to one nonaccepting dead state, which has a self-loop for every letter of Σ. The resulting finite prefix-trie DFA accepts exactly L. If n=0, the one-state nonaccepting DFA recognizes ∅.
(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)
View A as a directed transition graph. Its language is infinite iff some state q satisfies all three conditions:
- q is reachable from an initial state;
- q lies on a directed cycle;
- an accepting state is reachable from q.
Indeed, such a cycle can be repeated arbitrarily often. Conversely, any accepting run of length at least the number of states repeats a state and contains such a cycle. Reachability and strongly connected components can be computed by graph search.