证明正则语言集合是上下文无关语言集合的真子集

发布于 2024-10-11 01:27:55 字数 167 浏览 8 评论 0原文

我正在温习(不是家庭作业)一些计算理论,并遇到了这个问题:

如何证明常规语言集是上下文无关语言集的真子集。

现在我知道一种语言是正规的,当且仅当它被有限自动机接受。

我知道一种语言是上下文无关的,当且仅当它被下推接受 自动机。

但我不确定解决方案是什么。

I was brushing up (not homework)on some computation-theory and came accross this problem:

How can you prove that the set of regular languages is a proper subset of the set of the context-free languages.

Now I know a language is regular iff it is accepted by a finite automaton.

And I know a language is context-free iff it is accepted by a pushdown
automaton.

But I'm not sure of what solution is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕头说它不想醒 2024-10-18 01:27:55

任何 DFA 都相当于 PDA,它永远不会将任何内容推送到其堆栈上,因此所有常规语言也是上下文无关的。更正式地说:

DFA 被定义为 5 元组 (Σ,S,s0,δ,F),由输入字母表、状态集、
开始状态、转换表和最终(接受)状态集。

PDA 被定义为 7 元组,包括 DFA 的所有元素,加上两个附加参数: Γ(堆栈字母表)和 Z(初始堆栈符号)。 PDA 转换表与 DFA 转换表有些不同:每个转换可以依赖于
输入符号和当前堆栈符号,并且转换可以压入或弹出
从堆栈中。

因此,通过引入由单个符号组成的虚拟堆栈字母表,映射 DFA 转换表是微不足道的(尽管写起来有点烦人且冗长!)
(状态,输入)->状态到等效的PDA转换表(状态,输入,堆栈)-> (状态,堆栈)

完成真子集关系的证明:存在上下文无关语言,但不是正则语言,因此正则语言构成上下文无关语言的真子集。示例:由平衡括号组成的字符串语言。

Any DFA is equivalent to a PDA which happens to never push anything onto its stack, therefore all regular languages are also context-free. More formally:

A DFA is defined as a 5-tuple (Σ,S,s0,δ,F) consisting of the input alphabet, set of states,
start state, transition table, and set of final (accepting) states.

A PDA is defined as a 7-tuple, including all the elements of a DFA, plus two additional parameters: Γ (the stack alphabet), and Z (the initial stack symbol). A PDA transition table is somewhat different from a DFA transition table: each transition can depend on
both the input symbol and current stack symbol, and the transitions may push or pop
from the stack.

So by introducing a dummy stack alphabet consisting of a single symbol, it's trivial (though somewhat annoying and long-winded to write out!) to map the DFA transition table
(state, input) -> state to an equivalent PDA transition table (state, input, stack) -> (state, stack).

To complete the proof of a proper subset relationship: there exist languages which are context-free, but not regular, so the regular languages form a proper subset of the context-free languages. Example: the language of strings consisting of balanced parentheses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文