简体   繁体   English

以下常规语言的最小抽水长度

[英]Minimum pumping length for the following regular languages

What are the minimum pumping length for the following languages ? 以下语言的最小抽水长度是多少?

  1. The empty language 空语
  2. (01)*
  3. 10(11*0)*0
  4. 1011
  5. 011 U 0*1* 011 U 0*1*

Here are my solutions. 这是我的解决方案。 Please correct me if I'm wrong. 如果我错了,请纠正我。

  1. p = 0 because the language has no pumpable strings p = 0,因为该语言没有可泵送的字符串
  2. p = 2 because 01 is the shortest string that can be pumped p = 2,因为01是可以泵送的最短字符串
  3. p = 5 because 10100 is the shortest string that can be pumped p = 5,因为10100是可以泵送的最短字符串
  4. p = 0 because string cant be pumped p = 0,因为不能抽出字符串
  5. p = 1 because the string 0 can be pumped p = 1,因为可以抽出字符串0

I am not sure about my answers, so any help is appreciated. 我不确定我的答案,所以任何帮助都表示赞赏。 Thanks a lot! 非常感谢!

I think Simon's answer may be a little off. 我认为西蒙的回答可能有些偏差。 You do, in fact, need to take a cycle somewhere. 事实上,你需要在某个地方采取循环。 The pumping lemma requires that the path taken to recognize the string include a cycle (this is the 'y' of the pumping lemma's 'xyz'). 泵浦引理要求识别弦的路径包括一个循环(这是泵浦引理'xyz'的'y')。 We can take this cycle as many times as we want, which pumps the string. 我们可以根据需要多次使用这个循环,这可以抽出字符串。

  1. This should be 1. The minimum pumping length must always be greater than 0, even if there are no strings in the language. 这应该是1.即使语言中没有字符串,最小抽吸长度也必须始终大于0。
  2. This should be 2. If p = 1, we can't pump 01 (because y must equal 0, and 001 is not in the language). 这应该是2.如果p = 1,我们不能泵01(因为y必须等于0,而001不在语言中)。
  3. This should be 5. 这应该是5。
  4. This should also be 5. If we set p=4, then we claim "1011" is pumpable (which it is not, as it is the only string in the language). 这也应该是5.如果我们设置p = 4,那么我们声称“1011”是可泵送的(它不是,因为它是该语言中唯一的字符串)。
  5. p = 1. p = 1。

According to Patrick87 , the minimum pumping length is defined as the maximum number of transitions you can make in a minimized DFA without visiting some state twice. 根据Patrick87的说法 ,最小抽吸长度定义为在没有访问某个状态两次的情况下,您可以在最小化DFA中进行的最大过渡数。 The process then becomes to convert your regular expression to an NFA, convert the NFA to a DFA, minimize the DFA and count the longest path along the directed edges without visiting the same state twice. 然后,该过程将您的正则表达式转换为NFA,将NFA转换为DFA,最小化DFA并计算沿有向边的最长路径,而不会两次访问相同的状态。 For an introduction to this conversion and minimization, see for example Torben Mogensen's free book, Basics of Compiler Design chapters 2.6, 2.8. 有关此转换和最小化的介绍,请参阅Torben Mogensen的免费书籍“编译器设计基础”第2.6章,2.8。

According to this definition, 根据这个定义,

  1. p = 0, since there are no transitions in the minimized DFA for the empty language. p = 0,因为空语言的最小化DFA中没有转换。
  2. p = 1. A minimized DFA for (01)* has two states, and you can only make one transition without ending up at the initial, accepting state. p = 1. (01)*最小化DFA有两种状态,你只能进行一次转换而不会在最初的接受状态结束。
  3. p = 3. A minimized DFA for 10(11*0)*0 will have a state that has to be visited twice for the sub-expression (11*0)* to be a part of the derivation. p = 3.对于10(11*0)*0最小化的DFA将具有必须被访问两次的状态,以使子表达式(11*0)*成为推导的一部分。
  4. p = 4. A minimized DFA for 1011 has exactly 4 edges and no recursion. p = 4.对于1011最小化的DFA恰好有4个边,没有递归。
  5. p = 1. The language 011 is a subset of the language 0*1* , so 011 U 0*1* = 0*1* . p = 1.语言011是语言0*1*的子集,因此011 U 0*1* = 0*1* And since neither 0 or 1 can be pumped, one can only follow one non-recursive edge. 并且由于01都不能被泵浦,因此只能跟随一个非递归边缘。

最小化的DFA为2,3,4和5。

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

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