東京大学 情報理工学系研究科 コンピュータ科学専攻 2021年2月実施 問題3
Author
Description
Let
For example, if
For a finite automaton
Answer the following questions.
(1) Let
(2) Let
(3) Let
(4) Answer whether the following statement is true:
- "For every context-free language
and regular language , is a regular language."
Also, give a proof sketch if the answer is yes, and give a counterexample if the answer is no.
设
例如,如果
对于一个有限自动机
(1) 设
(2) 设
(3) 设
(4) 回答以下陈述是否正确:
- “对于每个上下文无关语言
和正则语言 , 是正则语言。”
如果答案是肯定的,请给出证明草图;如果答案是否定的,请给出反例。
Kai
(1)
Let
We check each element
- For
: - Possible
are
- For
: - Possible
are
- For
: - Possible
are
Collecting all possible
(2)
Let
Let's analyze this step by step:
- Words in
are of the form where and for all . - Words in
are repetitions of . - The possible prefixes from
that could start a word in are:
(empty string)
Now, let's consider what
- If
, then can be any word in , i.e., - If
, then must start with and then continue with , i.e., - If
, then must start with and then continue with , i.e.,
Therefore,
This can be written more compactly as:
or
This regular expression captures all possible suffixes that, when concatenated with a word from
(3)
To construct a non-deterministic finite automaton (NFA) that accepts
a) Start with the structure of
b) Add
c) Make all final states of
d) Keep the final states of
Formally, we can define the NFA
is the same as before for for for is the initial state of
This NFA simulates
(4)
The statement "For every context-free language
Counterexample:
Let
Let
Then
This counterexample shows that the statement is false in general.
Knowledge
正则语言 上下文无关语言 NFA 正则表达式
难点思路
问题 3 和 4 可能对考生来说比较困难。
对于问题 3,关键是理解如何通过 NFA 的非确定性来模拟
对于问题 4,难点在于构造合适的反例。需要选择一个非正则的上下文无关语言,并找到一个合适的正则语言,使得它们的
解题技巧和信息
- 对于涉及新定义操作的题目,先仔细理解定义,然后尝试用具体的例子来理解操作的含义。
- 在处理正则表达式时,考虑语言中单词的结构和可能的前缀。
- 构造 NFA 时,利用非确定性和
-转移来模拟复杂的操作。 - 在证明语言类别相关的陈述时,寻找反例通常比证明正确性更容易。尝试使用经典的非正则上下文无关语言作为起点。
重点词汇
- finite automaton 有限自动机
- non-deterministic finite automaton (NFA) 非确定性有限自动机
- regular expression 正则表达式
- context-free language 上下文无关语言
-transition -转移 - counterexample 反例
参考资料
- Introduction to Automata Theory, Languages, and Computation by John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman. Chapter 2 (Finite Automata) and Chapter 4 (Context-Free Grammars).
- Sipser, M. (2012). Introduction to the Theory of Computation. Cengage Learning. Chapter 1 (Regular Languages) and Chapter 2 (Context-Free Languages).