跳到主要内容

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

Author

zephyr, 祭音Myyura

Description

Given an integer k>0k > 0, we define a language LkL_k over an alphabet Σ={a,b}\Sigma = \{a, b\} by:

Lk={x1xnΣnZnkxnk+1=a}L_k = \{x_1 \ldots x_n \in \Sigma^* \mid n \in \mathbb{Z} \land n \geq k \land x_{n-k+1} = a\}

Here, Z\mathbb{Z} is the set of integers and xiΣx_i \in \Sigma. That is, LkL_k is the language that consists of words whose kk-th symbol from the last is aa.

Answer the following questions.

(1) Give a non-deterministic finite automaton that accepts L3L_3.

(2) Describe LkL_k using a regular expression. You may write the ii-time concatenation of a regular expression rr as rir^i.

(3) Is L=k=1Lk2L' = \bigcup_{k=1}^{\infty} L_{k^2} a regular language? If so, give a finite automaton that accepts LL'. If not, prove that LL' is not regular. You may use the pumping lemma for regular languages.

(4) Prove that any deterministic finite automaton that accepts LkL_k has at least 2k2^k states.


给定一个整数 k>0k > 0,我们通过以下方式定义了一个字母表 Σ={a,b}\Sigma = \{a, b\} 上的语言 LkL_k

Lk={x1xnΣnZnkxnk+1=a}L_k = \{x_1 \ldots x_n \in \Sigma^* \mid n \in \mathbb{Z} \land n \geq k \land x_{n-k+1} = a\}

这里,Z\mathbb{Z} 是整数集,并且 xiΣx_i \in \Sigma。也就是说,LkL_k 是由那些倒数第 kk 个符号是 aa 的单词组成的语言。

回答以下问题。

(1) 给出一个接受 L3L_3 的非确定性有限自动机。

(2) 使用正则表达式描述 LkL_k。你可以将正则表达式 rrii 次连接写为 rir^i

(3) L=k=1Lk2L' = \bigcup_{k=1}^{\infty} L_{k^2} 是正则语言吗?如果是,给出一个接受 LL' 的有限自动机。如果不是,证明 LL' 不是正则的。你可以使用正则语言的抽水引理。

(4) 证明任何接受 LkL_k 的确定性有限自动机至少有 2k2^k 个状态。

题目描述

给定整数 k>0k>0,在字母表 Σ={a,b}\Sigma=\{a,b\} 上定义

Lk={x1xnΣnk, xnk+1=a}.L_k =\{x_1\cdots x_n\in\Sigma^* \mid n\ge k,\ x_{n-k+1}=a\}.

也就是说,LkL_k 由倒数第 kk 个字符为 aa 的字符串构成。回答下列问题。

(1)构造识别 L3L_3 的 NFA。

(2)用正则表达式表示 LkL_k;正则表达式 rrii 次连接可记作 rir^i

(3)判断

L=k=1Lk2L'=\bigcup_{k=1}^{\infty}L_{k^2}

是否为正则语言。若是,给出识别它的有限自动机;若不是,证明其非正则性。可以使用正则语言泵引理。

(4)证明任何识别 LkL_k 的 DFA 都至少具有 2k2^k 个状态。

Kai

(1)

To construct an NFA accepting L3L_3, let it guess the a that is three symbols from the end.

  • States: q0,q1,q2,q3q_0,q_1,q_2,q_3.
  • Initial state: q0q_0.
  • Accepting state: q3q_3.
  • Transitions: from q0q_0, loop on both a,ba,b, and on input aa also move nondeterministically to q1q_1:
δ(q0,a)={q0,q1},δ(q0,b)={q0},\delta(q_0,a)=\{q_0,q_1\},\qquad \delta(q_0,b)=\{q_0\},

From q1q_1 and q2q_2, consume exactly two further symbols:

δ(q1,c)={q2},δ(q2,c)={q3}(c{a,b}).\delta(q_1,c)=\{q_2\},\qquad \delta(q_2,c)=\{q_3\}\qquad(c\in\{a,b\}).

There are no outgoing transitions from q3q_3. Thus a run accepts exactly when the guessed a has two symbols after it.

(2)

To describe LkL_k using a regular expression:

Lk=ΣaΣk1L_k = \Sigma^*a\Sigma^{k-1}

Here Σ\Sigma^* is an arbitrary prefix, the displayed aa is the selected symbol, and Σk1\Sigma^{k-1} is a suffix of exactly k1k-1 symbols. Thus the kk-th symbol from the end is aa.

(3)

The language is not regular. If it were, then

Lab={abk21k1}L'\cap ab^*=\{ab^{k^2-1}\mid k\ge1\}

would be regular. Let pp be its pumping length and take s=abp21s=ab^{p^2-1}. Write s=xyzs=xyz with xyp|xy|\le p and 0<yp0<|y|\le p.

If yy contains aa, then xzabxz\notin ab^*. Otherwise y=bry=b^r for some 1rp1\le r\le p, and

xy2z=abp2+r1.xy^2z=ab^{p^2+r-1}.

Since p2<p2+r<(p+1)2p^2<p^2+r<(p+1)^2, this word is not in the language. Both cases contradict the pumping lemma.

(4)

Claim: Any DFA that accepts LkL_k must have at least 2k2^k states.

Proof:

The automaton must retain enough information about the last kk input symbols to decide which symbol will be kk-th from the end when the input stops. Formally, all length-kk words must reach different states.

Consider two distinct words u,vΣku,v\in\Sigma^k. Let ii be a position at which they differ. Appending bi1b^{i-1} makes their ii-th symbols the kk-th symbols from the end, so exactly one of ubi1ub^{i-1} and vbi1vb^{i-1} lies in LkL_k. Thus all 2k2^k words in Σk\Sigma^k are pairwise Myhill--Nerode distinguishable, and every DFA for LkL_k has at least 2k2^k states.

Knowledge

NFA DFA 正则语言 泵引理

语言的取并操作

重点词汇

  • NFA: 非确定性有限自动机
  • DFA: 确定性有限自动机
  • Pumping Lemma: 抽象引理
  • Regular Expression: 正则表达式

参考资料

  1. "Introduction to the Theory of Computation" by Michael Sipser, Chap. 1, 2
  2. "Automata Theory, Languages, and Computation" by Hopcroft, Motwani, and Ullman, Chap. 2