東京大学 情報理工学系研究科 コンピュータ科学専攻 2023年8月実施 専門科目 問題1
Author
zephyr, 祭音Myyura
Description
Given an integer , we define a language over an alphabet by:
Here, is the set of integers and . That is, is the language that consists of words whose -th symbol from the last is .
Answer the following questions.
(1) Give a non-deterministic finite automaton that accepts .
(2) Describe using a regular expression. You may write the -time concatenation of a regular expression as .
(3) Is a regular language? If so, give a finite automaton that accepts . If not, prove that is not regular. You may use the pumping lemma for regular languages.
(4) Prove that any deterministic finite automaton that accepts has at least states.
给定一个整数 ,我们通过以下方式定义了一个字母表 上的语言 :
这里, 是整数集,并且 。也就是说, 是由那些倒数第 个符号是 的单词组成的语言。
回答以下问题。
(1) 给出一个接受 的非确定性有限自动机。
(2) 使用正则表达式描述 。你可以将正则表达式 的 次连接写为 。
(3) 是正则语言吗?如果是,给出一个接受 的有限自动机。如果不是,证明 不是正则的。你可以使用正则语言的抽水引理。
(4) 证明任何接受 的确定性有限自动机至少有 个状态。
题目描述
给定整数 ,在字母表 上定义
也就是说, 由倒数第 个字符为 的字符串构成。回答下列问题。
(1)构造识别 的 NFA。
(2)用正则表达式表示 ;正则表达式 的 次连接可记作 。
(3)判断
是否为正则语言。若是,给出识别它的有限自动机;若不是,证明其非正则性。可以使用正则语言泵引理。
(4)证明任何识别 的 DFA 都至少具有 个状态。
Kai
(1)
To construct an NFA accepting , let it guess the a that is three symbols from the end.
- States: .
- Initial state: .
- Accepting state: .
- Transitions: from , loop on both , and on input also move nondeterministically to :
From and , consume exactly two further symbols:
There are no outgoing transitions from . Thus a run accepts exactly when the guessed a has two symbols after it.
(2)
To describe using a regular expression:
Here is an arbitrary prefix, the displayed is the selected symbol, and is a suffix of exactly symbols. Thus the -th symbol from the end is .
(3)
The language is not regular. If it were, then
would be regular. Let be its pumping length and take . Write with and .
If contains , then . Otherwise for some , and
Since , this word is not in the language. Both cases contradict the pumping lemma.
(4)
Claim: Any DFA that accepts must have at least states.
Proof:
The automaton must retain enough information about the last input symbols to decide which symbol will be -th from the end when the input stops. Formally, all length- words must reach different states.
Consider two distinct words . Let be a position at which they differ. Appending makes their -th symbols the -th symbols from the end, so exactly one of and lies in . Thus all words in are pairwise Myhill--Nerode distinguishable, and every DFA for has at least states.
Knowledge
NFA DFA 正则语言 泵引理
语言的取并操作
重点词汇
- NFA: 非确定性有限自动机
- DFA: 确定性有限自动机
- Pumping Lemma: 抽象引理
- Regular Expression: 正则表达式
参考资料
- "Introduction to the Theory of Computation" by Michael Sipser, Chap. 1, 2
- "Automata Theory, Languages, and Computation" by Hopcroft, Motwani, and Ullman, Chap. 2