计算理论笔记(二)CFL PDA

本文深入探讨了上下文无关语言(CFL),包括其生成器CFG、识别器PDA以及帕斯图等概念。通过实例展示了CFL的泵浦引理和语言的构造,并证明了每个正规语言都是上下文无关的。同时,讨论了PDA到CFG的转换,证明了简单PDA和CFG之间的等价性。最后,阐述了PDA接受语言的条件,以及如何设计PDA来接受特定的语言。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Context-Free Language(CFL)
  • Generator: Context-Free Generator(CFG)
  • Recoganizer: PushDown Automata(PDA)
  • Pumping Theorem for CFL
  • Example:
    • S→aSb,S→A,A→cS\to aSb,S\to A,A\to cSaSb,SA,Ac
    • a,ba,ba,b: terminal
    • S,AS,AS,A: non-terminal
    • SSS: start symbol
A CFL is a 4-tuple G=(V,Σ,R,S)G=(V,\Sigma,R,S)G=(V,Σ,R,S)
  • VVV is a set of symbols
  • Σ⊆V\Sigma\subseteq VΣV is the set of terminals, V−ΣV-\SigmaVΣ is the set of non-terminals
  • RRR is the set of rules, a finite subset of (V−Σ)×V∗(V-\Sigma)\times V^*(VΣ)×V
  • S∈V−ΣS\in V-\SigmaSVΣ is the start symbol
Derives in one step: xAy⇒GxuyxAy\xRightarrow[G]{} xuyxAyGxuy if (A,u)∈R(A,u)\in R(A,u)R, for x,y,u∈V∗x,y,u\in V^*x,y,uV and A∈V−ΣA\in V-\SigmaAVΣ
  • x⇒G∗yx\xRightarrow[G]{}^* yxGy if x=yx=yx=y or ∃w0,w1,…,wn\exists w_0,w_1,\dots,w_nw0,w1,,wn satisfying:
    • x=w0x=w_0x=w0
    • wi−1⇒Gwi,i∈[1,n]w_{i-1}\xRightarrow[G]{} w_i, i\in[1,n]wi1Gwi,i[1,n]
    • y=wny=w_ny=wn
  • Called derivation from w0w_0w0 to wnw_nwn of length nnn
GGG generates a string w∈Σ∗w\in\Sigma^*wΣ if S⇒G∗wS\xRightarrow[G]{}^*wSGw
  • L(G)={w∈Σ∗:GL(G)=\{w\in\Sigma^*:GL(G)={wΣ:G generates w}w\}w}, GGG generates L(G)L(G)L(G)
  • A language is context-free if some CFG generates it
Exercise: Show that {w∈{a,b}∗:w=wR}\{w\in\{a,b\}^*:w=w^R\}{w{a,b}:w=wR} is a CFL
  • ∣w∣=0,w=e=wR|w|=0,w=e=w^Rw=0,w=e=wR, i.e. S→eS\to eSe
  • ∣w∣=1,w=a=b|w|=1,w=a=bw=1,w=a=b, i.e. S→aS\to aSa and S→bS\to bSb
  • ∣w∣≥2,w=aua=bub,u=uR|w|\ge 2,w=aua=bub,u=u^Rw2,w=aua=bub,u=uR(by induction), i.e. S→aSaS\to aSaSaSa and S→bSbS\to bSbSbSb
  • Conclusively, S→e∣a∣b∣aSa∣bSbS\to e|a|b|aSa|bSbSeabaSabSb
  • w∈L(G)→w=wRw\in L(G)\to w=w^RwL(G)w=wR: by induction on # steps of derivation of www
  • w=wR→w∈L(G)w=w^R\to w\in L(G)w=wRwL(G): by induction on length of www
Exercise: Show that {w∈{(,)}∗:w\{w\in\{(,)\}^*:w{w{(,)}:w is a string of balanced parentheses }\}} is a CFL
  • Derivation is not unique: leftmost or rightmost
Parse Tree
  • Internal nodes: non-terminals
  • Leaves: terminals or eee, and eee must be the only child of its parent
  • Edges: spatial and temporal order
  • Yields: reconstruct a string from its parse tree
  • A CFG GGG is ambiguous if ∃w∈L(G)\exists w\in L(G)wL(G), there exists two or more parse trees with the same root SSS yielding www
  • Fact: Some CFL is inherently ambiguous. That is, every CFG that generates this language is ambiguous
    • For {aibjck:i=j∨j=k}\{a^ib^jc^k:i=j\lor j=k\}{aibjck:i=jj=k}, ambiguity occurs on a4b4c4a^4b^4c^4a4b4c4
Theorem: Every regular language is context-free
  • Idea: DFA M=(K,Σ,δ,s,F)→M=(K,\Sigma,\delta,s,F)\toM=(K,Σ,δ,s,F) CFG G=(V,Σ,R,S)G=(V,\Sigma,R,S)G=(V,Σ,R,S), s.t. L(G)=L(M)L(G)=L(M)L(G)=L(M)
  • V=K∪ΣV=K\cup\SigmaV=KΣ
  • R={q→ap:δ(q,a)=p}∪{q→e:q∈F}R=\{q\to ap:\delta(q,a)=p\}\cup\{q\to e:q\in F\}R={qap:δ(q,a)=p}{qe:qF}
  • S=sS=sS=s
  • ∀w∈Σ∗,(s,w)⊢M∗(q,e)\forall w\in \Sigma^*,(s,w)\vdash_M^*(q,e)wΣ,(s,w)M(q,e) for some q∈F  ⟺  s⇒G∗wq\in F\iff s\xRightarrow[G]{}^*wqFsGw
    • Claim: ∀w∈Σ∗,∀p,q∈K,(p,w)⊢M∗(q,e)  ⟺  p⇒G∗wq\forall w\in \Sigma^*,\forall p,q\in K, (p,w)\vdash_M^*(q,e)\iff p\xRightarrow[G]{}^*wqwΣ,p,qK,(p,w)M(q,e)pGwq
    • Therefore s⇒G∗wq⇒Gws\xRightarrow[G]{}^*wq\xRightarrow[G]{}wsGwqGw
  • Proof:
    • sufficiency by induction on # steps of computations
    • Base case: # steps =0=0=0, w=e,p=q,p⇒G∗wqw=e,p=q,p\xRightarrow[G]{}^*wqw=e,p=q,pGwq (trivial)
    • Inductive case: holds for # steps =k=k=k, then for # steps =k+1=k+1=k+1
      • w=au,a∈Σ,u∈Σ∗,(p,w)⊢M(p′,u)⊢M∗(q,e)w=au,a\in\Sigma,u\in\Sigma^*,(p,w)\vdash_M(p',u)\vdash_M^*(q,e)w=au,aΣ,uΣ,(p,w)M(p,u)M(q,e) if δ(p,a)=p′\delta(p,a)=p'δ(p,a)=p
      • Let $ p\to ap’\in R$,therefore p⇒Gap′⇒G∗auqp \xRightarrow[G]{}ap'\xRightarrow[G]{}^*auqpGapGauq, with hypothesis p′⇒G∗uqp'\xRightarrow[G]{}^*uqpGuq
    • necessity by # steps of derivation(omitted)
PushDown Automata(PDA)
PDA(NFA+Stack) is a 6-tuple P=(K,Σ,Γ,Δ,s,F)P=(K,\Sigma,\Gamma,\Delta,s,F)P=(K,Σ,Γ,Δ,s,F)
  • KKK is a set of states
  • Σ\SigmaΣ is a set of input symbols
  • Γ\GammaΓ is a set of stack symbols
  • s∈Ks\in KsK is the initial state
  • F⊆KF\subseteq KFK is the set of final states
  • Δ\DeltaΔ, transition relation, is a finite subset of (K×(Σ∪{e})×Γ∗)×(K×Γ∗)(K\times(\Sigma\cup\{e\})\times \Gamma^*)\times(K\times\Gamma^*)(K×(Σ{e})×Γ)×(K×Γ)
A configuration for PPP is a member of K×Σ∗×Γ∗K\times\Sigma^*\times\Gamma^*K×Σ×Γ
Yields in one step: (p,x,α)⊢P(q,y,β)(p,x,\alpha)\vdash_P(q,y,\beta)(p,x,α)P(q,y,β), if ∃((p,x,γ),(q,η))∈Δ\exists((p,x,\gamma),(q,\eta))\in\Delta((p,x,γ),(q,η))Δ where x=ay,α=γτ,β=ητx=ay,\alpha=\gamma\tau,\beta=\eta\taux=ay,α=γτ,β=ητ, for some τ∈Γ∗\tau\in\Gamma^*τΓ
  • (p,x,α)⊢P∗(q,y,β)(p,x,\alpha)\vdash_P^*(q,y,\beta)(p,x,α)P(q,y,β) if (p,x,α)=(q,y,β)(p,x,\alpha)=(q,y,\beta)(p,x,α)=(q,y,β) or ∃(p0,x0,α0),…,(pn,xn,αn)\exists(p_0,x_0,\alpha_0),\dots,(p_n,x_n,\alpha_n)(p0,x0,α0),,(pn,xn,αn) satisfying:
    • (p,x,α)=(p0,x0,α0)(p,x,\alpha)=(p_0,x_0,\alpha_0)(p,x,α)=(p0,x0,α0)
    • (pi−1xi−1αi−1)⊢P(pi,xi,αi),∀i∈[1,n](p_{i-1}x_{i-1}\alpha_{i-1})\vdash_P(p_i,x_i,\alpha_i),\forall i\in[1,n](pi1xi1αi1)P(pi,xi,αi),i[1,n]
    • (q,y,β)=(pn,xn,αn)(q,y,\beta)=(p_n,x_n,\alpha_n)(q,y,β)=(pn,xn,αn)
PPP accepts w∈Σ∗w\in\Sigma^*wΣ if (s,w,e)⊢P∗(q,e,e)(s,w,e)\vdash_P^*(q,e,e)(s,w,e)P(q,e,e), for some q∈Fq\in FqF
L(P)L(P)L(P): a set of all w∈Σ∗w\in\Sigma^*wΣ accepted by PPP, uniquely
Exercise: Design a PDA to accept L={wwR:w∈{a,b}∗}L=\{ww^ R:w\in\{a,b\}^*\}L={wwR:w{a,b}}
  • K={l,r}K=\{l,r\}K={l,r}
  • Σ={a,b}\Sigma=\{a,b\}Σ={a,b}
  • Γ={a,b}\Gamma=\{a,b\}Γ={a,b}
  • s=ls=ls=l
  • F={r}F=\{r\}F={r}
  • Δ={((l,a,e),(l,a)),((l,b,e),(l,b)),((l,a,a),(l,e)),((l,b,b),(l,e)),((l,e,e),(l,e))}\Delta=\begin{aligned}\{&((l,a,e),(l,a)),((l,b,e),(l,b)),\\ &((l,a,a),(l,e)),((l,b,b),(l,e)),\\&((l,e,e),(l,e))\}\end{aligned}Δ={((l,a,e),(l,a)),((l,b,e),(l,b)),((l,a,a),(l,e)),((l,b,b),(l,e)),((l,e,e),(l,e))}
Exercise: Design a PDA to accept {w∈{0,1}∗:\{w\in\{0,1\}^*:{w{0,1}: # of 000’s equals to # of 111’s in w}w\}w}
  • K={s,q,f}K=\{s,q,f\}K={s,q,f}
  • Σ={0,1}\Sigma=\{0,1\}Σ={0,1}
  • Γ={0,1,@}\Gamma=\{0,1,@\}Γ={0,1,@}
  • s=ls=ls=l
  • F={f}F=\{f\}F={f}
  • Δ={((s,e,e),(q,@)),((q,e,@),(f,e)),((q,0,@),(q,0@)),((q,1,@),(q,1,@)),((q,0,0),(q,00)),((q,0,1),(q,e)),((q,1,1),(q,11)),((q,1,0),(q,e))}\Delta=\begin{aligned}\{&((s,e,e),(q,@)),((q,e,@),(f,e)),\\ &((q,0,@),(q,0@)),((q,1,@),(q,1,@)),\\ &((q,0,0),(q,00)),((q,0,1),(q,e)),\\ &((q,1,1),(q,11)),((q,1,0),(q,e))\}\end{aligned}Δ={((s,e,e),(q,@)),((q,e,@),(f,e)),((q,0,@),(q,0@)),((q,1,@),(q,1,@)),((q,0,0),(q,00)),((q,0,1),(q,e)),((q,1,1),(q,11)),((q,1,0),(q,e))}
Theorem
  • For each CFG GGG, there exists a PDA PPP s.t. L(P)=L(G)L(P)=L(G)L(P)=L(G)
  • For each PDA PPP, there exists a CFG GGG s.t. L(G)=L(P)L(G)=L(P)L(G)=L(P)
  • G→PG\to PGP, idea:
    • non-deterministic generates a string in stack using GGG
    • compare it to input
    • accept input if they match
  • Construction:
    • G=(V,Σ,R,S)→P=(K,Σ,Γ,Δ,s,F)G=(V,\Sigma,R,S)\to P=(K,\Sigma,\Gamma,\Delta,s,F)G=(V,Σ,R,S)P=(K,Σ,Γ,Δ,s,F)
    • K={p,q}K=\{p,q\}K={p,q}
    • Γ=V\Gamma=VΓ=V
    • s=ps=ps=p
    • F={q}F=\{q\}F={q}
    • Δ={((p,e,e),(q,s)),((q,e,A),(q,u)),∀(A,u)∈R((q,a,a),(q,e)),∀a∈Σ}\Delta=\begin{aligned}\{&((p,e,e),(q,s)),\\ &((q,e,A),(q,u)),\forall(A,u)\in R\\ &((q,a,a),(q,e)),\forall a\in\Sigma\}\end{aligned}Δ={((p,e,e),(q,s)),((q,e,A),(q,u)),(A,u)R((q,a,a),(q,e)),aΣ}
  • Prove L(G)=L(P)L(G)=L(P)L(G)=L(P):
    • ∀w∈Σ∗\forall w\in\Sigma^*wΣ, s⇒∗ws\xRightarrow{}^*wsw if (p,w,e)⊢P(q,w,s)⊢P∗(q,e,e)(p,w,e)\vdash_P(q,w,s)\vdash_P^*(q,e,e)(p,w,e)P(q,w,s)P(q,e,e)
  • Claim: ∀w∈Σ∗\forall w\in\Sigma^*wΣ and ∀α∈((V−Σ)V∗)∪{e},S⇒L∗αw\forall\alpha\in((V-\Sigma)V^*)\cup\{e\},S\xRightarrow{L}^*\alpha wα((VΣ)V){e},SLαw iff (q,w,S)⊢P∗(q,e,α)(q,w,S)\vdash_P^*(q,e,\alpha)(q,w,S)P(q,e,α)
  • Prove sufficiency by induction
    • Base case: # steps =0=0=0, S⇒L∗wαS\xRightarrow{L}^*w\alphaSLwα
      • ⇒S=wα\Rightarrow S=w\alphaS=wα
      • ⇒w=e,α=S\Rightarrow w=e,\alpha=Sw=e,α=S
      • ⇒(q,w,S)⊢P∗(q,e,α)\Rightarrow(q,w,S)\vdash_P^*(q,e,\alpha)(q,w,S)P(q,e,α)
    • Inductive case: holds for # steps =k=k=k, then for # steps =k+1=k+1=k+1
      • s⇒Lu1⇒Lu2⇒L⋯⇒L∗uk⇒Lαs\xRightarrow{L}u_1\xRightarrow{L}u_2\xRightarrow{L}\cdots\xRightarrow{L}^*u_k\xRightarrow{L}\alphasLu1Lu2LLukLα
      • Let AAA be the leftmost non-terminal in uku_kuk
      • uk=xAβu_k=xA\betauk=xAβ where x∈Σ∗x\in\Sigma^*xΣ and β∈V∗\beta\in V^*βV,
      • wα=xγβw\alpha=x\gamma\betawα=xγβ for some (A,γ)∈R(A,\gamma)\in R(A,γ)R
      • ∃y∈Σ∗\exist y\in\Sigma^*yΣ s.t. w=xyw=xyw=xy, therefore yα=γβy\alpha=\gamma\betayα=γβ
      • S⇒L∗ukS\xRightarrow{L}^*u_kSLuk
        • ⇒(q,x,S)⊢P∗(q,e,Aβ)⊢P(q,e,γβ)\Rightarrow(q,x,S)\vdash_P^*(q,e,A\beta)\vdash_P(q,e,\gamma\beta)(q,x,S)P(q,e,Aβ)P(q,e,γβ)
        • ⇒(q,xy,S)⊢P∗(q,y,γβ)\Rightarrow (q,xy,S)\vdash_P^*(q,y,\gamma\beta)(q,xy,S)P(q,y,γβ)
        • ⇒(q,w,S)⊢P∗(q,y,yα)⊢P∗(q,e,α)\Rightarrow (q,w,S)\vdash_P^*(q,y,y\alpha)\vdash_P^*(q,e,\alpha)(q,w,S)P(q,y,yα)P(q,e,α)
  • Prove necessity by induction on # type-2 transition
    • Base case: # steps of type-2 =0=0=0, (q,w,S)⊢P∗(q,e,α)(q,w,S)\vdash_P^*(q,e,\alpha)(q,w,S)P(q,e,α)
      • ⇒w=e,α=S\Rightarrow w=e,\alpha=Sw=e,α=S
      • ⇒S⇒L∗wα\Rightarrow S\xRightarrow{L}^*w\alphaSLwα
    • Inductive case: holds for # steps of type-2 =k=k=k, then for # steps =k+1=k+1=k+1
      • Let ((q,e,A),(q,γ))((q,e,A),(q,\gamma))((q,e,A),(q,γ)) be the last type-2 transition
      • ∃y∈Σ∗,∃β∈V∗,(q,w,S)⊢P∗(q,y,Aβ)⊢P(q,y,γβ)⊢P∗(q,e,α)\exists y\in\Sigma^*,\exists\beta\in V^*,(q,w,S)\vdash_P^*(q,y,A\beta)\vdash_P(q,y,\gamma\beta)\vdash_P^*(q,e,\alpha)yΣ,βV,(q,w,S)P(q,y,Aβ)P(q,y,γβ)P(q,e,α)
      • (q,w,S)⊢P∗(q,y,Aβ)(q,w,S)\vdash_P^*(q,y,A\beta)(q,w,S)P(q,y,Aβ)
        • ⇒∃x∈Σ∗,w=xy,(q,xy,S)⊢P∗(q,y,Aβ)\Rightarrow\exists x\in\Sigma^*,w=xy,(q,xy,S)\vdash_P^*(q,y,A\beta)xΣ,w=xy,(q,xy,S)P(q,y,Aβ)
        • ⇒(q,x,S)⊢P∗(q,e,Aβ)\Rightarrow(q,x,S)\vdash_P^*(q,e,A\beta)(q,x,S)P(q,e,Aβ)
        • ⇒S⇒L∗xAβ\Rightarrow S\xRightarrow{L}^*xA\betaSLxAβ
      • (q,y,Aβ)⊢P(q,y,γβ)(q,y,A\beta)\vdash_P(q,y,\gamma\beta)(q,y,Aβ)P(q,y,γβ)
        • ⇒(A,γ)∈R\Rightarrow(A,\gamma)\in R(A,γ)R
      • (q,y,γβ)⊢P∗(q,e,α)(q,y,\gamma\beta)\vdash_P^*(q,e,\alpha)(q,y,γβ)P(q,e,α)
        • ⇒∃α,yα=γβ\Rightarrow\exists\alpha,y\alpha=\gamma\betaα,yα=γβ
      • Therefore, S⇒L∗xAβ⇒Lxγβ⇒L∗xyα(=wα)S\xRightarrow{L}^*xA\beta\xRightarrow{L}x\gamma\beta\xRightarrow{L}^*xy\alpha(=w\alpha)SLxAβLxγβLxyα(=wα)
  • P→GP\to GPG, via simple PDA
  • A PDA P=(K,Σ,Γ,Δ,s,F)P=(K,\Sigma,\Gamma,\Delta,s,F)P=(K,Σ,Γ,Δ,s,F) is simple if:
    • ∣F∣=1|F|=1F=1
    • ∀((q,a,α),(q,β))∈Δ\forall((q,a,\alpha),(q,\beta))\in\Delta((q,a,α),(q,β))Δ:
      • either α=e,∣β∣=1\alpha=e,|\beta|=1α=e,β=1 (push)
      • or ∣α∣=1,β=e|\alpha|=1,\beta=eα=1,β=e (pop)
  • Lemma: Every PDA has a equivalent simple PDA
  • Proof:
    • Let P=(K,Σ,Γ,Δ,s,F)P=(K,\Sigma,\Gamma,\Delta,s,F)P=(K,Σ,Γ,Δ,s,F) be a PDA
    • If ∣F∣>1|F|>1F>1:
      • create a new state fff
      • for ∀q∈F\forall q\in FqF, create a new transition ((q,e,e),(f,e))((q,e,e),(f,e))((q,e,e),(f,e))
      • replace FFF with {f}\{f\}{f}
    • Violations:
    • For each ((q,a,α),(q,β))((q,a,\alpha),(q,\beta))((q,a,α),(q,β)) with ∣α∣≥1|\alpha|\ge1α1 and ∣β∣≥1|\beta|\ge1β1:
      • create a new state rrr
      • replace with ((p,a,α),(r,e))((p,a,\alpha),(r,e))((p,a,α),(r,e)) and ((r,e,e),(q,β))((r,e,e),(q,\beta))((r,e,e),(q,β)), respectively
    • For each ((q,a,α),(q,e))((q,a,\alpha),(q,e))((q,a,α),(q,e)) with α=c1c2…ck\alpha=c_1c_2\dots c_kα=c1c2ck for some k≥2k\ge2k2:
      • create k−1k-1k1 new states r1,r2,…,rk−1r_1,r_2,\dots,r_{k-1}r1,r2,,rk1
      • replace with ((p,a,c1),(r1,e))((p,a,c_1),(r_1,e))((p,a,c1),(r1,e)) and ((ri,e,c2),(ri+1,e)),i∈[1,k−1)((r_i,e,c_2),(r_{i+1},e)),i\in[1,k-1)((ri,e,c2),(ri+1,e)),i[1,k1) and ((rk−1,e,ck),(q,e))((r_{k-1},e,c_k),(q,e))((rk1,e,ck),(q,e)), respectively
    • For each ((q,a,e),(q,β))((q,a,e),(q,\beta))((q,a,e),(q,β)) with β=c1c2…ck\beta=c_1c_2\dots c_kβ=c1c2ck for some k≥2k\ge2k2:
      • create k−1k-1k1 new states r1,r2,…,rk−1r_1,r_2,\dots,r_{k-1}r1,r2,,rk1
      • replace with ((p,a,e),(r1,ck))((p,a,e),(r_1,c_k))((p,a,e),(r1,ck)) and ((ri,e,e),(ri+1,ck−i)),i∈[1,k−1)((r_i,e,e),(r_{i+1},c_{k-i})),i\in[1,k-1)((ri,e,e),(ri+1,cki)),i[1,k1) and ((rk−1,e,e),(q,c1))((r_{k-1},e,e),(q,c_1))((rk1,e,e),(q,c1)), respectively
    • For each ((p,a,e),(q,e))∈Δ((p,a,e),(q,e))\in\Delta((p,a,e),(q,e))Δ
      • create a new symbol @@@
      • replace with ((p,a,e),(r,@))((p,a,e),(r,@))((p,a,e),(r,@)) and ((r,e,@),(q,e))((r,e,@),(q,e))((r,e,@),(q,e))
  • Lemma: Every simple PDA has a equivalent CFG
  • Proof:
    • Let P=(K,Σ,Γ,Δ,s,F)P=(K,\Sigma,\Gamma,\Delta,s,F)P=(K,Σ,Γ,Δ,s,F) be a simple PDA
    • Construct G=(V,Σ,R,S)G=(V,\Sigma,R,S)G=(V,Σ,R,S) s.t. L(G)=L(P)L(G)=L(P)L(G)=L(P)
      • Non-terminals: {Apq:p,q∈K}\{A_{pq}:p,q\in K\}{Apq:p,qK}
        • ApqA_{pq}Apq represents {w∈Σ∗:(p,w,e)⊢P∗(q,e,e)}\{w\in\Sigma^*:(p,w,e)\vdash_P^*(q,e,e)\}{wΣ:(p,w,e)P(q,e,e)}
      • S=AsfS=A_{sf}S=Asf
      • R={Apq→aArtb:((p,a,e),(r,u)),((t,b,u),(q,e))∈Δ}∪{Apq→AprArq:r∈K}∪{App→e:p∈K}R=\{A_{pq}\to aA_{rt}b:((p,a,e),(r,u)),((t,b,u),(q,e))\in\Delta\}\cup\{A_{pq}\to A_{pr}A_{rq}:r\in K\}\cup\{A_{pp}\to e:p\in K\}R={ApqaArtb:((p,a,e),(r,u)),((t,b,u),(q,e))Δ}{ApqAprArq:rK}{Appe:pK}
        • w=avbw=avbw=avb for some v∈Σ∗v\in\Sigma^*vΣ with (r,v,e)⊢P∗(t,e,e)(r,v,e)\vdash^*_P(t,e,e)(r,v,e)P(t,e,e)
    • Claim: Apq⇒∗w∈Σ∗A_{pq}\xRightarrow{}^*w\in\Sigma^*ApqwΣ iff (p,w,e)⊢P∗(q,e,e)(p,w,e)\vdash^*_P(q,e,e)(p,w,e)P(q,e,e) (proof omitted)
  • Collary: A language is context-free iff it is accepted by some PDA
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值