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

Unit 3

The document discusses pushdown automata and context-free languages. It begins by defining a pushdown automaton as a computational machine that recognizes context-free languages using a finite control, input tape, and infinite stack. It then covers deterministic and non-deterministic pushdown automata, the equivalence between pushdown automata and context-free grammars, and problems related to these topics. Examples are provided to illustrate pushdown automata computations and the relationships between different formal language models.

Uploaded by

abcd efgh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Unit 3

The document discusses pushdown automata and context-free languages. It begins by defining a pushdown automaton as a computational machine that recognizes context-free languages using a finite control, input tape, and infinite stack. It then covers deterministic and non-deterministic pushdown automata, the equivalence between pushdown automata and context-free grammars, and problems related to these topics. Examples are provided to illustrate pushdown automata computations and the relationships between different formal language models.

Uploaded by

abcd efgh
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 60

UNIT-3

Pushdown Automata: Definitions Moves


Instantaneous descriptions
Deterministic pushdown automata-Problems related to DPDA
Non - Deterministic pushdown automata-Problems related to NDPDA
Pushdown automata to CFL Equivalence-Problems of PDA to CFG
CFL to Pushdown automata Equivalence
Problems related to Equivalence of CFG
Pushdown Automata: Definitions Moves
NFA Vs PDA: Definitions
Pushdown Automata: Definitions

A PDA is a computational machine to recognize a Context free language. Computational power of


PDA is between Finite automaton and Turing machines. The PDA has a finite control , and the
memory is organized as a stack.
Pushdown Automata: Definitions Conti….
Basic Structure of PDA

A PDA has three components −


 an input tape,
 a control unit, and
 a stack with infinite size.
The stack head scans the top symbol of the stack.

A stack does two operations −

 Push − a new symbol is added at the top.

 Pop − the top symbol is read and removed.


PDA-Transitions
Language Acceptability by PDA
• The input string is accepted by the PDA if:
o The final state is reached .
o The stack is empty.
• For a PDA M=(Q, Σ ,Ґ ,δ ,q0 ,Z0 ,F ) we define : Language accepted by final state L(M)
as:

{ w | (q0 , w , Z0 ) |--- ( p, Є , γ ) for some p in F and γ in Ґ * }.

• Language accepted by empty / null stack N(M) is:

{ w | (q0,w ,Z0) |----( p, Є, Є ) for some p in Q}.


Ex:1Language Acceptability by PDA
Ex:1Language Acceptability by PDA
Conti….
Conti….
Conti….
Example :2
Ex:2Language Acceptability by PDA
Conti….
Assignment Exercises:
Instantaneous Description
• ID describe the configuration of a PDA at a given instant.ID is a triple such as
• (q, w ,γ ) , where q is a state , w is a string of input symbols and is a string of stack symbols.

• Instantaneous Description (ID) is an informal notation of how a PDA “computes” a input string and make a decision that string
is accepted or rejected.
• The relevant factors of pushdown configuration notation by a triple (q, w, γ) where;

 q is the current state of the control unit

 w is the unread part of the input string or the remaining input alphabets

 γ is the current contents of the PDA stack.

 Conventionally, we show leftmost symbol indicating the top of the stack γ and the bottom at the right end. Such a triple
notation is called an instantaneous description or ID of the pushdown automata.
• It is also useful to represent as part of the configuration the portion of the input that remains.
Turnstile Notation

The "turnstile" notation is used for connecting pairs of ID's that represent one or many
moves of a PDA.
The process of transition is denoted by the turnstile symbol "⊢".
Consider a PDA (Q, ∑, S, δ, q0, I, F).
A transition can be mathematically represented by the following turnstile notation −(p,
aw, Tβ) ⊢ (q, w, αb) .
This implies that while taking a transition from state p to state q, the input symbol ‘a’ is
consumed, and the top of the stack ‘T’ is replaced by a new string ‘α’.
Note − If we want zero or more moves of a PDA, we have to use the symbol (⊢*) for it.
Conti..
• 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:

• δ(q0, a, Z0) = {(q0, aZ0)} Rule (1)


δ(q0, a, a) = {(q0, aa)} Rule (2)
δ(q0, b, a) = {(q1, λ)} Rule (3)
δ(q1, b, a) = {(q1, λ)} Rule (4)
δ(q1, λ, Z 0) = {(q2, λ)} Rule (5)
δ(q0, λ, Z0) = {(q2, λ)} Rule (6)
Conti..

• check string w is accepted by PDA or not?


• Solution: Instantaneous Description for string w = “aabb”

• (q0, aabb, Z 0) |- (q0, abb, aZ0) as per Rule (1)


|- (q0, bb, aaZ0) as per Rule (2)
|- (q1, b, aZ0) as per Rule (3)
|- (q1, λ, Z 0) as per Rule (3)
|- (q2, λ, λ) as per Rule (5)

• Finally PDA reached a configuration of (q2, λ, λ) i.e. the input tape is empty or input string w is
completed, PDA stack is empty and PDA has reached a final state. So the string ‘w’ is accepted.
Write down the IDs or moves for input string w = “aaabb” of PDA.
Also check it is accepted by PDA or not?

• Solution: Instantaneous Description for string w = “aaabb”


(q0, aaabb, Z0) |- (q0, aabb, aZ0) as per transition Rule (1)
|- (q0, abb, aaZ0) as per transition Rule (2)
|- (q0, bb, aaaZ0) as per transition Rule (2)
|- (q1, b, aaZ0) as per transition Rule (3)
|- (q1, λ, aZ0) as per transition Rule (3)
|- There is no defined move.

• So the pushdown automaton stops at this move and the string is not accepted because the input
tape is empty or input string w is completed but the PDA stack is not empty. So the string ‘w’
is not accepted.
Give examples of languages handled by PDA.

• L={ anbn | n>=0 },here n is unbounded , hence counting cannot


be done by finite memory. So we require a PDA ,a machine that
can count without limit.
• L= { wwR | w Є {a,b}* } , to handle this language we need
unlimited counting capability .
Ex:1
Ex:2
Ex:3
Ex:4
Ex:5
Assignment Exercises:
Deterministic pushdown Automata
Deterministic pushdown automata-Problems related to DPDA
Deterministic pushdown automata-
Problems related to DPDA
Deterministic pushdown Automata-
Problems related to DPDA
NDPDA-Problems related to DPDA
NDPDA-Problems related to DPDA
Assignment Exercises:
Pushdown automata to CFL
Pushdown automata to CFL
Pushdown automata to CFL Equivalence-Problems
of PDA to CFG
Pushdown automata to CFL Equivalence-
Problems of PDA to CFG
CFL to Pushdown automata Equivalence
CFL to Pushdown automata Equivalence
-Problems
CFL to PDA - Problems
CFL to PDA - Problems
Assignment Exercises:
Ex:1
Ex:2
Ex:3
End OF UNIT-III

You might also like