東京大学 情報理工学系研究科 コンピュータ科学専攻 2019年2月実施 問題3
Author
kainoj, 祭音Myyura
Description
Let Σ be a finite alphabet (i.e., a finite set of letters).
We say that a word v∈Σ∗ is a subsequence of a word w=a1⋯an∈Σ∗ if v=ai1⋯ai2 for some k≥0 and 1≤ii<⋯<ik≤n.
For example, aab is a subsequence of acbabc (let k=3,i1=1,i2=4 and i3=5).
We write v⪯w if v is a subsequence of w.
Answer the following questions.
(1) Give a non-deterministic finite automaton with at most 4 states that accepts the language:
{w∈{a,b,c}∗∣aab⪯w}
(2) Suppost that L⊆Σ∗ is the language accepted by a deterministic finite automaton A=(Q,Σ,δ,q0,F) (where Q is a finite set of states, δ∈Q×Σ→Q is the transition function, q0∈Q is the initial state, and F⊆Q is the set of final states).
Give a non-deterministic finite automaton that accepts the language:
{w∈Σ∗∣v⪯w for some v∈L}
(3) Supposet that L⊆Σ∗ is the language accepted by a deterministic finite automaton A=(Q,Σ,δ,q0,F).
Assume that the transition function δ∈Q×Σ→Q is a total function.
Give a deterministic finite automaton that accepts the language:
{w∈Σ∗∣v∈L for every v∈Σ∗ such that v⪯w}
(4) Prove the correctness of your answer for question (3) above.
题目描述
设 Σ 为有限字母表。若从字符串
w=a1⋯an∈Σ∗ 中按原顺序选取若干字符可以得到
v,即存在 k≥0 及
1≤i1<⋯<ik≤n,使
v=ai1⋯aik,则称 v 是 w 的子序列,记作
v⪯w。例如 aab⪯acbabc。回答下列问题。
(1)构造一个状态数不超过 4 的 NFA,识别语言
{w∈{a,b,c}∗∣aab⪯w}.
(2)设 DFA
A=(Q,Σ,δ,q0,F) 识别语言
L⊆Σ∗。构造一个 NFA,识别语言
{w∈Σ∗∣存在 v∈L 使 v⪯w}.
(3)设 DFA A=(Q,Σ,δ,q0,F) 识别
L⊆Σ∗,并假定 δ:Q×Σ→Q 为全函数。
构造一个 DFA,识别语言
{w∈Σ∗∣对每个满足 v⪯w 的 v∈Σ∗, v∈L}.
(4)证明第(3)问构造的正确性。
Kai
(1)
--> o --a--> o --a--> o --b--> (o)
/ \ / \ / \ / \
\ / \ / \ / \ /
E E E E
Here each loop labeled E denotes one loop for every symbol in {a,b,c}.
(2)
Use the NFA N=(Q,Σ,Δ,q0,F), where
Δ(q,a)={q,δ(q,a)}.
The transition to q skips the current input symbol; the other transition selects it for the simulated subsequence. Hence N accepts w iff some v⪯w is accepted by A.
(3)
Define the DFA D by
QDδD(X,a)=P(Q),=X∪{δ(q,a):q∈X},qDFD={q0},={X⊆Q:X⊆F}.
(4)
For every w, induction on ∣w∣ gives the invariant
δD∗({q0},w)={δ∗(q0,v):v⪯w}.
Indeed, on reading the next symbol a, a subsequence either omits a or appends it. Therefore the reached subset is accepting exactly when every state in it lies in F, which is equivalent to v∈L for every v⪯w.