\usetikzlibrary{automata, positioning, arrows}\tikzset{ ->, % makes the edges directed >=stealth, % makes the arrow heads bold node distance=2.5cm, % specifies the minimum distance between two nodes. Change if necessary. every state/.style={thick}, % sets the properties for each ’state’ node initial text=$Start$, % sets the text that appears on the start arrow}\begin{document} \begin{tikzpicture} \node [state, initial] (q0) {$q_0$}; \node [state, right of = q0] (q1) {$q_1$}; \node [state, accepting, right of = q1] (q2) {$q_2$}; \draw (q0) edge[loop above, above] node{1} (q0) (q0) edge[above] node{0} (q1) (q1) edge[above] node{1} (q2) (q1) edge[above, loop above] node{0} (q1) (q2) edge[above, loop above] node{0,1} (q2); \end{tikzpicture}\end{document}
考查三个字符串:
w=101,q0 重复出现,将 w 拆分成 x=ϵ,y=1,z=01,则 1k01∈L
w=001,q1 重复出现,x=0,y=0,z=1,00k1∈L
w=010,q2 重复出现,x=01,y=0,z=ϵ,010k∈L
正规语言的泵引理
设 L 是正规语言,则存在常数 n≥1,使得任一 w∈L,∣w∣≥n 都可以写成 w=xyz,且:
y=ϵ
∣xy∣≤n
∀k≥0,xykz∈L
可用于证明某个语言不是正规语言:
考虑任意的 n≥1
找到 w∈L∧∣w∣≥n
任选满足 w=xyz,y=ϵ,∣xy∣≤n 的 x,y,z
找到一个 k≥0,xykz∈L
Example
证明 L={0m1m∣m≥0} 不是正规语言。
若是,则存在 n 满足泵引理。
取 w=0n1n,令 w=xyz,由于 y=ϵ∧∣xy∣≤n,x,y 均由 0 组成,且 x 中 0 的个数小于 n,取 k=0,应有 xz∈L,但 z 中 1 的个数显然大于 x 中 0 的个数,因此 xz∈L,矛盾。