[英]Minimum pumping length for a regular language
How to calculate minimum pumping length of a regular language. 如何计算常规语言的最小抽水长度。 For example if i have 0001* then minimum pumping length for this should be 4 ,that is 000 could not be pumped .
例如,如果我有0001 *那么最小泵送长度应该是4,那就是000不能泵送。 Why it is so?
为什么会这样?
It will be less than or equal to the number of states in a minimal DFA for the language, minus one. 它将小于或等于语言的最小DFA中的状态数减去1。 So convert the regular expression into a DFA, minimize it, and count the states.
因此,将正则表达式转换为DFA,最小化它,并计算状态。 For your example:
对于你的例子:
0001*
SOURCE SYMBOL DESTINATION
q1 0 q2
q1 1 q5
q2 0 q3
q2 1 q5
q3 0 q4
q3 1 q5
q4 0 q5
q4 1 q4
q5 0 q5
q5 1 q5
Why is it equal to this? 为什么它等于这个? Because that's the maximum number of transitions you can take in the DFA without visiting some state twice.
因为这是您可以在DFA中进行的最大转换次数,而无需访问某个状态两次。 Once you visit a state twice, you have looped.
一旦你两次访问一个州,你就已经循环了。
Of course, it's possible for a language's minimal DFA to lack a path of that length. 当然,语言的最小DFA可能缺少该长度的路径。 In that case, you can find the longest path (from the start state) that doesn't visit a state twice by using something like depth-first search of the automaton's graph and seeing how long a path you can trace.
在这种情况下,您可以通过使用深度优先搜索自动机图形以及查看可以跟踪的路径长度等内容,找到两次不访问状态的最长路径(从起始状态)。 That would be your real answer.
这将是你真正的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.