我试图证明语言{w∈{a,b,c} * | n_a(w)< n_b(w)和n_a(w)< n_c(w)}不是使用Pumping Lemma的CFL。符号“n_a”表示“a”的数量。
对于泵浦引理,z = u(v ^ i)x(w ^ i)y,| vxw | < = m,| vw | > = 1。
我选择使用字符串z =(a ^ m)b ^(m + 1)c ^(m + 1)来表明这不是CFL。
但是,我坚持以下情况。
假设'uvx'代表'z'的(a ^ m)部分,'w'代表'z'的(b ^ m)部分的开头,'y'代表'z'的其余部分。
现在为i = 2抽水,我们得到z'= u(v ^ 2)x(w ^ 2)y = a ^(m + | v |)b ^(m + 1 + | w |)c ^(m + 1)。
每当| v | ≠0,我们看到这不在语言中,因为n_a(z')不小于n_c(z')。但是,对于| v |的情况= 0,我们得到z'= a ^(m)b ^(m + 1 + | w |)c ^(m + 1),这是语言中的IS。因此,i = 2的泵送不起作用。这是对的吗?
我试过了'i'的其他值,但我仍然无法证明这种语言不是CFL。我究竟做错了什么?这种语言实际上是无背景的吗?我应该使用完全不同的'z'字符串吗?
答案 0 :(得分:0)
让R
成为表示以下内容的非终端:
最终产品中不再有
a
b
或c
另有说明:
适用于
w ϵ G(R)
,n_a(w) <= n_b(b)
和n_a(w) <= n_c(w)
所以这个人的规则是(让ϵ
为空字符串):
R => ϵ
R => bR
R => Rb
R => cR
R => Rc
R => abcR
R => abRc
R => aRbc
R => Rabc
R => acbR
R => acRb
R => aRcb
R => Racb
R => bacR
R => baRc
R => bRac
R => Rbac
R => bcaR
R => bcRa
R => bRca
R => Rbca
R => cbaR
R => cbRa
R => cRba
R => Rcba
R => cabR
R => caRb
R => cRab
R => Rcab
这29个是所有可能的转换,保证从R
派生的任何单词不会比a
更多b
s,而a
s不会c
{1}}秒。
但问题不在于G(R)
,明确指出n_a(w) <= n_b(b)
和n_a(w) <= n_c(w)
。所以,我还有3个非终端:
S
,起点B
,直接或间接来自S
并保证至少再有b
而不是a
(考虑它是如何&#34;天生&#34;) C
,直接或间接来自S
并保证至少再有c
而不是a
(考虑它是如何&#34;天生&#34;) 我的策略如下:
那些非终端将与
R
类似,但他们不会有任何空转换;此外,来自S
我将进行转换,生成bB
,Bb
,cC
或Cc
;来自B
,保证至少有b
个a
,然后它会转换为cR
或Rc
;对于C
,转换为bR
或Rb
所以,这将是我的完整语法,从S
开始:
S => bB
S => Bb
S => cC
S => Cc
S => bS
S => Sb
S => cS
S => Sc
S => abcS
S => abSc
S => aSbc
S => Sabc
S => acbS
S => acSb
S => aScb
S => Sacb
S => bacS
S => baSc
S => bSac
S => Sbac
S => bcaS
S => bcSa
S => bSca
S => Sbca
S => cbaS
S => cbSa
S => cSba
S => Scba
S => cabS
S => caSb
S => cSab
S => Scab
B => cS
B => Sc
B => bB
B => Bb
B => cB
B => Bc
B => abcB
B => abBc
B => aBbc
B => Babc
B => acbB
B => acBb
B => aBcb
B => Bacb
B => bacB
B => baBc
B => bBac
B => Bbac
B => bcaB
B => bcBa
B => bBca
B => Bbca
B => cbaB
B => cbBa
B => cBba
B => Bcba
B => cabB
B => caBb
B => cBab
B => Bcab
C => bR
C => Rb
C => bC
C => Cb
C => cC
C => Cc
C => abcC
C => abCc
C => aCbc
C => Cabc
C => acbC
C => acCb
C => aCcb
C => Cacb
C => bacC
C => baCc
C => bCac
C => Cbac
C => bcaC
C => bcCa
C => bCca
C => Cbca
C => cbaC
C => cbCa
C => cCba
C => Ccba
C => cabC
C => caCb
C => cCab
C => Ccab
R => ϵ
R => bR
R => Rb
R => cR
R => Rc
R => abcR
R => abRc
R => aRbc
R => Rabc
R => acbR
R => acRb
R => aRcb
R => Racb
R => bacR
R => baRc
R => bRac
R => Rbac
R => bcaR
R => bcRa
R => bRca
R => Rbca
R => cbaR
R => cbRa
R => cRba
R => Rcba
R => cabR
R => caRb
R => cRab
R => Rcab