東京大学 情報理工学系研究科 コンピュータ科学専攻 2019年8月実施 専門科目I 問題1
Author
祭音Myyura (co-authored with GPT 5.6 SOL)
Description
Let Σ be a finite alphabet (i.e., a finite set of letters), and ϵ be the empty sequence. We define the shuffle w1⊗w2⊆Σ∗ of two words w1,w2∈Σ∗ as follows.
- For every w∈Σ∗,
ϵ⊗w=w⊗ϵ={w}.
- For every a,b∈Σ and w1,w2∈Σ∗,
(aw1)⊗(bw2)={aw∣w∈w1⊗(bw2)}∪{bw∣w∈(aw1)⊗w2}.
Furthermore, for two languages L1,L2⊆Σ∗, their shuffle L1⊗L2⊆Σ∗ is defined by:
L1⊗L2=w1∈L1,w2∈L2⋃w1⊗w2.
For example, we have:
{ab,ba}⊗{ϵ,c}=(ab⊗ϵ)∪(ab⊗c)∪(ba⊗ϵ)∪(ba⊗c)={ab,cab,acb,abc,ba,cba,bca,bac}.
Answer the following questions.
(1) Compute {a,bb}⊗{ab,cc}.
(2) Suppose that deterministic finite automata A1=(Q1,Σ,δ1,q1,0,F1) and A2=(Q2,Σ,δ2,q2,0,F2) accept languages L1 and L2, respectively. Here, Qi,δi,qi,0, and Fi are respectively the set of states, the transition function, the initial state, and the set of final states of Ai (i∈{1,2}). You may assume that the transition functions δi∈Qi×Σ→Qi (i∈{1,2}) are total functions. Give a non-deterministic automaton that accepts L1⊗L2.
(3) Prove the correctness of your answer for question (2) above.
(4) Let L3={anbn∣n≥0} and L4={cmdm∣m≥0}. Prove that L3⊗L4 is not a context-free language. Here, you may use the pumping lemma for context-free languages.
题目描述
设 Σ 为有限字母表,ε 为空串。对
w1,w2∈Σ∗,递归定义它们的洗牌(shuffle)
w1⊗w2⊆Σ∗:
ε⊗w=w⊗ε={w},
且对 a,b∈Σ、w1,w2∈Σ∗,
(aw1)⊗(bw2)={aw∣w∈w1⊗(bw2)}∪{bw∣w∈(aw1)⊗w2}.
对语言 L1,L2⊆Σ∗,定义
L1⊗L2=w1∈L1, w2∈L2⋃w1⊗w2.
例如
{ab,ba}⊗{ε,c}={ab,cab,acb,abc,ba,cba,bca,bac}.
回答下列问题。
(1)计算 {a,bb}⊗{ab,cc}。
(2)设 DFA
Ai=(Qi,Σ,δi,qi,0,Fi) 分别识别语言
Li (i=1,2),并假定两个转移函数均为全函数。构造一个识别
L1⊗L2 的 NFA。
(3)证明第(2)问构造的正确性。
(4)令
L3={anbn∣n≥0}、
L4={cmdm∣m≥0}。证明
L3⊗L4 不是上下文无关语言。可以使用上下文无关语言泵引理。
Kai
(1)
分别计算四组洗牌并去重,得
{a,bb}⊗{ab,cc}={aab,aba,acc,cac,cca,abbb,babb,bbab,bbcc,bcbc,bccb,cbbc,cbcb,ccbb}.
(2)
取 NFA A=(Q1×Q2,Σ,Δ,(q1,0,q2,0),F1×F2),其中
Δ((q1,q2),a)={(δ1(q1,a),q2),(q1,δ2(q2,a))}.
即每读一个字符,非确定地选择交给其中一台 DFA,另一台保持原状态。
(3)
若 w 被接受,将运行中交给第一、第二台 DFA 的字符分别按原序组成 w1,w2。最终两台都在接受状态,故 w1∈L1,w2∈L2,且 w∈w1⊗w2。
反之,若 w∈w1⊗w2,其中 wi∈Li,则按该交错方式选择转移,运行结束于 F1×F2,故接受 w。
(4)
若 L=L3⊗L4 是上下文无关语言,则与正则语言 a∗c∗b∗d∗ 的交
K=L∩a∗c∗b∗d∗={ancmbndm∣n,m≥0}
也是上下文无关语言。设其泵长度为 p,取 w=apcpbpdp。任意满足 w=uvxyz、∣vxy∣≤p、∣vy∣>0 的分解中,vxy 至多涉及两个相邻字符块,因而不能同时涉及 a,b 两块,也不能同时涉及 c,d 两块。
令泵次数为 0。删除 v,y 后至少一种字符减少,而与它要求等量的另一种字符没有减少。因此所得串不在 K,与泵引理矛盾。故 L3⊗L4 不是上下文无关语言。