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 . Why it is so?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It will be less than or equal to the number of states in a minimal DFA for the language, minus one. So convert the regular expression into a DFA, minimize it, and count the states. 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. 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. 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.