跳到主要内容

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

Author

zephyr

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 that accepts L3L_3, we need to ensure that the third symbol from the end is 'a'. Here is the NFA:

  • States: q0,q1,q2,q3q_0, q_1, q_2, q_3
  • Alphabet: Σ={a,b}\Sigma = \{a, b\}
  • Transitions:
    • From q0q_0 (start state):
      • On reading any symbol aa or bb, move to q0q_0 (this loop represents reading any number of symbols at the start).
      • On reading any symbol, move to q1q_1 (non-deterministically guess that we might be three symbols away from the end).
    • From q1q_1:
      • On reading any symbol aa or bb, move to q2q_2.
    • From q2q_2:
      • On reading any symbol aa or bb, move to q3q_3 (final state).
  • Final State: q3q_3

This NFA accepts a string if it non-deterministically guesses that it is three symbols away from the end, and then checks if the third-to-last symbol is 'a'.

(2)

To describe LkL_k using a regular expression:

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

Here, Σk1\Sigma^{k-1} represents any string of length k1k-1, followed by the symbol 'a', and then followed by any string of arbitrary length. This ensures that the kk-th symbol from the end is 'a'.

(3)

Claim: The language L=k=1Lk2L' = \bigcup_{k=1}^{\infty} L_{k^2} is not a regular language.

Proof:

To prove that LL' is not a regular language, we will use the pumping lemma. The pumping lemma states that if a language is regular, then any sufficiently long string in the language can be "pumped" — that is, a portion of the string can be repeated multiple times, and the resulting strings will still belong to the language.

String Selection

Let's consider a string ww carefully crafted to belong to Lk2L_{k^2} for some integer kk. For example, consider the string:

w=bk21abk21w = b^{k^2-1}a b^{k^2-1}

This string belongs to Lk2L_{k^2} because the k2k^2-th symbol from the end is 'a', and all other characters are 'b'.

Pumping Lemma Application

Assume that LL' is a regular language. Then by the pumping lemma, there exists a pumping length pp such that any string ww with length at least pp can be decomposed as w=xyzw = xyz, where:

  • xyp|xy| \leq p,
  • y>0|y| > 0, and
  • xyizLxy^iz \in L' for all i0i \geq 0.

Given that xyp|xy| \leq p, the substring xyxy is confined to the first k2k^2 characters, which consist entirely of 'b's followed by a single 'a' and another some 'b's. Thus, the substring yy consists of only 'b's (say y=bmy = b^m for some m>0m > 0).

Pumped String

Consider the string w=xy2zw' = xy^2z. After pumping, the string becomes:

w=bk21abk21+mw' = b^{k^2-1}ab^{k^2 - 1 + m}

Here, the block of 'b's after the 'a' has increased by mm, shifting the position of the 'a' forward by mm positions. The length of ww' is now greater than ww by mm.

Why ww' May not Belong to Any Li2L_{i^2}

  • Original Position: In the original string ww, the 'a' was exactly at the k2k^2-th position from the end.
  • New Position: After pumping, in ww', the 'a' is now at the (k2+m)(k^2 + m)-th position from the end.

For ww' to belong to any Li2L_{i^2}, the position of 'a' from the end should be exactly i2i^2 for some integer ii. However:

  • For m(0,2k+1)\forall m \in (0, 2k+1), k2<k2+m<(k+1)2k^2 < k^2 + m < (k+1)^2, meaning that k2+mk^2 + m may not be a perfect square number, so ww' does not always belong to any Li2L_{i^2}.
  • Therefore, the string wLi2w' \notin L_{i^2} for any ii.

(4)

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

Proof:

Consider the DFA accepting LkL_k. This DFA must remember the last kk symbols it has seen in order to determine whether the kk-th symbol from the end is 'a'.

There are 2k2^k possible sequences of kk symbols over the alphabet Σ={a,b}\Sigma = \{a, b\}, and the DFA must distinguish between each of these sequences because each sequence can determine whether the current string belongs to LkL_k. Thus, the DFA must have a unique state for each possible sequence of kk symbols.

Therefore, the DFA must have at least 2k2^k states to correctly accept all strings in LkL_k.

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