0% found this document useful (0 votes)
10 views

Module4 Push Down Automata

Uploaded by

manjunatha.4252
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Module4 Push Down Automata

Uploaded by

manjunatha.4252
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

PUSHDOWN AUTOMATA

Chapter 5

PUSHDOWN AUTOMATA (PDA)

To process input string PDA uses stack along with input, such an automata is called Push Down
Automata (PDA). PDA is defined with seven tuples, (Q, ∑, δ, Z0, ┌, IS, FS)

Q is number of states in PDA

∑ is input alphabet

δ is transition function defined as

Z0 is initial symbol of stack

┌ is stack symbols
IS is initial state

FS is final state

The PDA works on equal symbol, if the input string is 100001.

Figure 5.1: Different position of stack for the input string is 100001.

There are two types of PDA

i. Deterministic Push Down Automata (DPDA)


ii. Non-deterministic Push Down Automata (NPDA)

Deterministic Push Down Automata (DPDA):

In Deterministic Push Down Automata (DPDA), we are designing PDA. The design of PDA begins with
Instantaneous Description (IDs), each IDs consist of state, input string to be processed and initial symbol
of the stack (z0).

Example 5.1: Design DPDA for the string 000111.

The Instantaneous Descriptions (IDs) for the given problem are as follows:

Page 5.1
PUSHDOWN AUTOMATA

By making use of the above IDs we can obtain the transition functions, which are required for the
construction of PDA.

For first transition function, ID1 is used for input transition and ID2 is used as output.

δ(q0, 0, z0)=q0, 0z0

Next ID2 is the input of transition and ID3 is used for output transition function.

δ(q0, 0, 0)=q0, 00

ID3 and ID4 are same as ID2 and ID3

ID4 and ID5

δ(q0, 1, 0)=q0, Ɛ

ID7 and ID8

δ(q0, Ɛ, z0)=q1, z0

Figure 5.2: DPDA for the string 000111.

Example 5.2: Design DPDA for the language L={anb2n | n≥0}.

The Instantaneous Descriptions (IDs) for the given problem are as follows

By making use of the above IDs we can obtain the transition functions, which are required to
construct the PDA.

For first transition function, ID1 is used for input transition and ID2 is used as output.

Page 5.2
PUSHDOWN AUTOMATA

δ(q0, a, z0)=q0, aaz0

Next ID2 is the input of transition and ID3 is used for output transition function.

δ(q0, a, a)=q0, aaa

ID3 and ID4

δ(q0, b, a)=q0, Ɛ

ID7 and ID8

δ(q0, Ɛ, z0)=q1, z0

Figure 5.3 DPDA for the language L={anb2n | n≥0}.

Example 5.3: Design DPDA for the language L={x | na(x)=Nb(x)}.

L={Ɛ, ab, ba, abab, baba, aabb, bbaa …}

The Instantaneous Descriptions (IDs) for the given problem are as follows

By making use of the above IDs we can obtain the transition functions, which are required for the
construction of a PDA.

For first transition function, ID1 is used for input transition and ID2 is used as output.

δ(q0, a, z0)=q0, az0

Possible transition

δ(q0, b, z0)=q0, bz0

Next ID2 is the input of transition and ID3 is used for output transition function.

δ(q0, a, a)=q0, aa

Possible transition

δ(q0, b, b)=q0, bb

Page 5.3
PUSHDOWN AUTOMATA

ID3 and ID4

δ(q0, b, a)=q0, Ɛ

δ(q0, a, b)=q0, Ɛ

ID5 and ID6

δ(q0, Ɛ, z0)=q1, z0

Figure 5.4: DPDA for the language L={x | na(x)=Nb(x)}.

Example 5.4: Design DPDA for the language L={anbncn| n≥0}.

The Instantaneous Descriptions (IDs) for the given problem are as follows

By making use of the above IDs we can obtain the transition functions, which are required to
construct the PDA.

For first transition function, ID1 is used for input transition and ID2 is used as output.

δ(q0, a, z0)=q0, az0

Next ID2 is the input of transition and ID3 is used for output transition function.

δ(q0, a, a)=q0, aa

ID3 and ID4

δ(q0, b, a)=q0, Ɛ

δ(q0, c, z0)=q0, cz0

δ(q0, c, c)=q0, cc

δ(q0, Ɛ, c)=q0, Ɛ

ID8 and ID9

Page 5.4
PUSHDOWN AUTOMATA

δ(q0, Ɛ, z0)=q1, z0

Figure 5.5: DPDA for the language L={anbncn| n≥0}.

i. Non-deterministic Push Down Automata:

Example 5.5: Design NPDA for the language L={wwR| w={a, b}*}.

L={Ɛ, aa, bb, aaaa, bbbb, abba…}

In NPDA, it treats all the symbols into

i. Symbol of first half continues in the same state and push the symbol to top of the stack.
ii. Symbol of second half, it just changes the state and continues further.

The Instantaneous Descriptions (IDs) for the given problem are as follows

δ(q0, a, z0)=q0, az0

δ(q0, a, a)=q0, aa

δ(q0, a, a)=q1, a

δ(q1, a, a)=q1, Ɛ

δ(q1, Ɛ, z0)=q2, z0

Figure 5.6: NPDA for the language L={wwR| w={a, b}*}.

Page 5.5
PUSHDOWN AUTOMATA

Equivalence of CFG and PDA:

Each CFG has PDA and each PDA has CFG.

i. Converting PDA to CFG


ii. Converting CFG to PDA
i. Converting PDA to CFG
In this method we convert transition functions into variables. Each variable consist of state,
stack symbol and state, all are represented in square bracket [Q, Stack Symbol, Q].

Example 5.6: Convert following transition function of PDA to productions.

δ(q0, a, z0)=q0, XZ0; δ(q0, a, z0)=q0, X;

This conversion method is a blind, we do not have any specific rules

CFG begins with starting symbol. Therefore starting symbol in the form of transition function of PDA is
derived as:

The production for the above transition function can be written as

The production for the above transition function can be written as

ii. Converting CFG to PDA

In this case productions of CFG’s are given; we need to find out equivalent transition functions of
PDA.

Example 5.7: Convert following productions of CFG into transition function of PDA.

Before converting CFG to PDA, see that all productions are in the form of Greibach Normal form. In
Greibach Normal form there should not be undesired production and all the right hand side
production are only terminal or terminal followed by any number of variables.

Page 5.6
PUSHDOWN AUTOMATA

Closure Properties of CFLs:

CFLs are closed under operator; there are different types of operators

i. Union
ii. Concatenation
iii. Star Closure
iv. Intersection of two CFLs
v. Intersection of CFL and regular language
vi. Compliment of CFLs
vii. Reversal.
viii. Substitution.
ix. Inverse Homomorphism,
i. Union:
CFL1=G1=(V1, T1, P1, S1) CFL2=( V2, T2, P2, S2)
CFL3=G3 =(V1UV2, T1UT2, P1UP2, S1|S2)
ii. Concatenation:
CFL3=G3 =(V1V2, T1T2, P1P2, S1S2)
iii. Star Closure:
CFL1=G1=(V1, T1, P1, S1)
S1=TS1|Ɛ;
iv. Intersection of two CFLs:
CFL1=L1={anbnci :n≥0, i≥0}
CFL2=L2={aibncn :n≥0, i≥0} is not a CFL

Proof:

L1={Ɛ, c, ab, abc, aabb, cc, aabbcc…}

L2={Ɛ, a, bc, abc, aa, bbcc, aabbcc…}

L3= L1ᴒL2={Ɛ, abc, aabbcc…}

={anbncn :n≥0}

Page 5.7
PUSHDOWN AUTOMATA

The above language is neither belongs to L1 nor L2 therefore intersection of two CFLs are not CFL.

v. Intersection of CFL and regular language:


CFL =(Q1, ∑1, δ1, ┌1, IS1, FS1)
Regular language M=(Q2, ∑2, δ2, IS2, FS2)
CFLᴒM=((Q1, Q2), (∑1, ∑2), (δ1, δ2), ┌1, (IS1, IS2), (FS1, FS2))
Intersection consist of seven tuples, it is a CFL.

Figure 5.7: Intersection of CFL and regular language.


vi. Compliment of CFLs
CFL1, CFL2
According to De’morgan’s theorem

vii. Reversal:
In this case the right hand side of production is reversed.

viii. Substitution:
h(0)= aba; h(1)= ba
h(010)=ababaaba
S(0)= {anbn:n≥0}; S(1)={aa, bb}
S(01)={anbnaa, anbnbb}
ix. Inverse Homomorphism:

Figure 5.8: Homomorphism and inverse homomorphism

Figure 5.9: Substitution and inverse substitution.

Figure 5.10: PDA for Substitution method.

Page 5.8

You might also like