简体   繁体   English

在陈述语言 L = {0^(n)1^(n) | 的证明中发现错误 n>0} 是一个正则表达式

[英]Finding error in proof stating the language L = {0^(n)1^(n) | n>0} is a regular expression

Proof: Let M be the following NFA:证明:令 M 为以下 NFA:

Automata for L Now, if x is in L, then x = 0^(n)1^(n). L 的自动机现在,如果 x 在 L 中,则 x = 0^(n)1^(n)。 Thus while processing x, M will start in state q0, loop in state q0 n times, then transition to state q1 on the rst 1, and follow the loop in state q1 a total of n 􀀀 1 times.因此,在处理 x 时,M 将从状态 q0 开始,在状态 q0 中循环 n 次,然后在第 1 次转换到状态 q1,并在状态 q1 中跟随循环共 n 次 1 次。 Since it ends in state q1, x will be accepted.由于它以状态 q1 结束,因此 x 将被接受。 Thus M recognizes every string in L, so L is NFA-recognizable (and by Kleene's theorem, is thus regular).因此 M 识别 L 中的每个字符串,所以 L 是 NFA 可识别的(并且根据 Kleene 定理,因此是正则的)。

You've shown that M accepts every string of L. But that doesn't mean that M recognizes L: for that to be true, you have to also show that M accepts exactly the strings of L and no others (or equivalently: it doesn't accept any string not in L).您已经证明 M 接受 L 的每个字符串。但这并不意味着 M 识别 L:要做到这一点,您还必须证明 M 完全接受 L 的字符串而不接受其他字符串(或等效地:它不接受任何不在 L 中的字符串)。 Unfortunately in your case, M does accept some non-L strings: for example, "011" .不幸的是,在您的情况下, M确实接受一些非 L 字符串:例如, "011"

Your proof is indeed wrong.你的证明确实是错误的。 To prove that the language L is regular you need to prove that there exists a finite state automaton M that recognizes the language L. Hence, there are three things that you need to prove about the automaton M:为了证明语言 L 是正则的,你需要证明存在一个识别语言 L 的有限状态自动机 M。 因此,你需要证明关于自动机 M 的三件事:

  1. The automaton M exists.自动机 M 存在。
  2. The automaton M recognizes the language L (nothing more, nothing less).自动机 M 识别语言 L(不多也不少)。
  3. The automaton M has a finite number of states.自动机 M 具有有限数量的状态。

The problem with your proof is that the automaton you posted does not recognize the language L:您证明的问题在于您发布的自动机无法识别语言 L:

O*1+

This automaton recognizes the language 0*1+ which is not the same as the language L ( 0^n1^n ).该自动机识别语言0*1+ ,这与语言 L ( 0^n1^n ) 不同。 Yes, every string in L is recognized by this automaton.是的,这个自动机可以识别 L 中的每个字符串。 However, this automaton also recognizes strings like 1 which is clearly not in L. Hence, using this automaton in your proof is wrong.然而,这个自动机也能识别像1这样的字符串,而这显然不在 L 中。因此,在你的证明中使用这个自动机是错误的。

So, how do you prove that the automaton M exists?那么,你如何证明自动机 M 存在呢? Well, the only way to prove that the automaton M exists is by showing that M exists.嗯,证明自动机 M 存在的唯一方法是证明 M 存在。 The only problem is that L is not a regular language.唯一的问题是 L 不是常规语言。 Hence, there is no finite state automaton M that recognizes L.因此,不存在识别 L 的有限状态自动机 M。

The opposite way is to prove that L is not a regular language.相反的方法是证明L不是正则语言。 To prove that L is not a regular language you need to prove that there is no finite state automaton M that recognizes L. This is an easier proof because you don't have to find the automaton M. You can just assume that it exists.要证明 L 不是常规语言,您需要证明不存在识别 L 的有限状态自动机 M。这是一个更简单的证明,因为您不必找到自动机 M。您可以假设它存在。

Here's what you need to do to prove that L is not a regular language:以下是您需要做的事情来证明 L 不是常规语言:

  1. Assume that an automaton M exists that recognizes the language L.假设存在识别语言 L 的自动机 M。
  2. Show that M must necessarily have an infinite number of states.证明 M 必然有无限多个状态。

The standard way of proving that an automaton M cannot have a finite number of states is by using the Pumping Lemma .证明自动机 M 不能具有有限状态数的标准方法是使用泵引理 I'll leave it as an exercise for you to figure that out because it's not in the scope of your question.我将把它作为练习让你弄清楚,因为它不在你的问题范围内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM