Unit 4
Unit 4
Unit: 4
TAFL
Mr. Nagesh Sharma
Assistant Professor
Course Details IT
(B Tech 4th Sem)
• Introduction
• Push Down Automata
• Example of PDA
• Formal Definition of PDA
• Operation of PDA
• Instantons Description of PDA
• PDA Examples
• Construction of PDA from CFG
• Non Deterministic PDA
Prerequisite:
Recap:
Recap: Till now we have studied about FA and its types, Regular
Expressions and Grammar.
• A Language is given L=
• This cannot be handled by a finite automata. But same can be
handled by a PDA
• In order to remember the first half of the strings that is umber of a’s
, machine will PUSH all the a’s into the stack.
• For example as given in the image after reading first 5 a’s the stack
contains 5 a’s.
• While reading the second half of the input string containing b’s, the
machine POP out an a from the stack for every b as input.
• After reading 5 b’s, input will finish and the stack will become
empty. This will indicate that the input string is of the form .
POP Operation:
PUSH Operation:
• For a PDA, we want to know its state and the entire content of its
stack.
– Often the stack is one of the most useful pieces of
information, since it is not bounded in size.
• Write down the IDs or moves for input string w = “aabb” of PDA
as M = ({q0, q1, q2}, {a, b}, {a, b, Z0}, δ, q0, Z0, {q2}), where δ is
defined by following rules:
Recap: Till now we have studied about basic concept and definition of
Push Down Automata.
Solution:
Sequence of a’s should be pushed onto the stack in state q0.
δ(q0,a,z0) = (q0, az0)
δ(q0,a,a) = (q0, aa)
Solution:
Stack will be used to store excess of a’s over b’s or excess of b’s
over a’s out of input seen so far.
Transition Diagram
Solution:
Step 1: Design a DFA of given language:
Recap: Till now we have studied about basic concept and definition of
Push Down Automata with examples.
Solution:
The equivalent PDA, M is given by:
M = ({q},{0,1}, {0,1,S}, δ, q, S, Φ), where δ is given by:
Recap: Till now we have studied about basic concept and definition of
Push Down Automata with examples and relationship between CFG and
PDA.
Simulation of abaaba
• δ(q1, abaaba, Z) Apply rule 1
• ⊢ δ(q1, baaba, aZ) Apply rule 5
• ⊢ δ(q1, aaba, baZ) Apply rule 4
• ⊢ δ(q1, aba, abaZ) Apply rule 7
• ⊢ δ(q2, ba, baZ) Apply rule 8
• ⊢ δ(q2, a, aZ) Apply rule 7
• ⊢ δ(q2, ε, Z) Apply rule 11
• ⊢ δ(q2, ε) Accept
• https://www.youtube.com/watch?v=-WKPbLV7JPI
• https://www.youtube.com/watch?v=7ZbDEfnYwAo
• https://
drive.google.com/file/d/13kK3291TzguwU6GAA8vIqrRw6w_13ypj/v
iew?usp=sharing
1. Top down PDA first move the ……. into the stack
a. start symbol
b. input symbol
c. first symbol
d. last production
e. Shift
f. Reduce
g. Both A ad B
h. Neither A and B
a. x
b. a
c. ax
d. xa
• https://
drive.google.com/file/d/12YgCV_q7QeE1d_Hp0JrOWRFgXOcd
KSRc/view?usp=sharing
• https://
drive.google.com/file/d/1J5wqcdUF3nf_8UMcYD_wTblTK3Sm
Chqr/view?usp=sharing
• https://
drive.google.com/file/d/1VxIo8y0ZSdXXcHYLwUgii9MuZEosG
GyC/view?usp=sharing
• https://
drive.google.com/file/d/1ZlOKf6Il9xwPF6YlmSGAsFSsAjT4fNP
u/view?usp=sharing
• https://
drive.google.com/file/d/1dyqbDpBPuY50gsmu62JcVtgD65t_0l
u4/view?usp=sharing
12/25/2024 Mr. Nagesh Sharma KCS - 402 TAFL Unit Number: 4 51
Expected Questions for University Exam
Thank You