[英]Minimum pumping length for the following regular languages
What are the minimum pumping length for the following languages ? 以下语言的最小抽水长度是多少?
(01)*
10(11*0)*0
1011
011
U 0*1*
011
U 0*1*
Here are my solutions. 这是我的解决方案。 Please correct me if I'm wrong. 如果我错了,请纠正我。
01
is the shortest string that can be pumped p = 2,因为01
是可以泵送的最短字符串 10100
is the shortest string that can be pumped p = 5,因为10100
是可以泵送的最短字符串 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. 我们可以根据需要多次使用这个循环,这可以抽出字符串。
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, 根据这个定义,
(01)*
has two states, and you can only make one transition without ending up at the initial, accepting state. p = 1. (01)*
最小化DFA有两种状态,你只能进行一次转换而不会在最初的接受状态结束。 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)*
成为推导的一部分。 1011
has exactly 4 edges and no recursion. p = 4.对于1011
最小化的DFA恰好有4个边,没有递归。 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. 并且由于0
或1
都不能被泵浦,因此只能跟随一个非递归边缘。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.