Acceptance by Empty Stack, Deterministic Pda: S. No Enrollment Number Admission Number Student Name Degree / Branch Sem

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

ACCEPTANCE BY EMPTY STACK,

DETERMINISTIC PDA

Enrollment Admission Degree /


S. No Student Name Sem
Number Number Branch
1 19021011398 19SCSE1010208 MANISH KUMAR B-Tech / CSE V

2 19021011279 19SCSE1010 MUSKAN RAHUJA B-Tech / CSE V

3 19021011730 19SCSE1010 MUKUL SHARMA B-Tech/ CSE V

TEA
PUSH DOWN AUTOMATA (PDA)

• It is a Finite Automata with extra memory called Stack which helps PDA to
recognize Context Free Languages.
• It is a way to implement Context Free Grammar (CFG).
• PDA are used in theories about what can be computed by machines.
• PDA is of 2 types - Deterministic PDA
• Non-Deterministic PDA
• PDA is defined as a collection of 7 components
PUSH DOWN AUTOMATA (PDA)

A Pushdown Automata (PDA) can be defined as :


M= <Q,Σ,Γ,q0,Z,δ,F>
Q is the set of states
∑ is the set of input symbols
Γ is the set of pushdown symbols (which can be pushed and popped from stack)
q0 is the initial state
Z is the initial pushdown symbol (which is initially present in stack)
F is the set of final states
δ is a transition function
ACCEPTANCE BY EMPTY STACK

There are other possible definitions of the acceptance of a string by P. Some


possibilities:
• The string is accepted when both the string and stack are empty (even when the
current state would not be an acceptable state).
• The string is accepted when both the string and stack are empty and we are in
an acceptable state.
One could also change the definition of the PDA as follows:
• One can push more than 1 symbol to the stack in 1 transition.
ACCEPTANCE BY EMPTY STACK

• Here a PDA accepts a string when, after reading the entire string, the PDA has
emptied its stack.
• For a PDA P = (Q, ∑, S, δ, q0, Z, F), the language accepted by P, denoted by
N(P) by the empty stack is −
N(P) = {w | (q0, w, Z) ⊢* (q, ε, ε), q ∈ Q}
• That is, N(P) is the set of inputs w that P can consume and at the same time
empty its stack. (The N in N(P) stands for null stack, a synonym for empty
stack.)
ACCEPTANCE BY EMPTY STACK
ACCEPTANCE BY EMPTY STACK

INPUT STRING-
wcwR w ε (a,b)*
ACCEPTANCE BY EMPTY STACK

• Stack Transition States

δ(q0, a, Z) = (q0, aZ)


δ(q0, a, a) = (q0, aa)
δ(q0, b, Z) = (q0, bZ)
δ(q0, b, b) = (q0, bb)
δ(q0, a, b) = (q0, ab)
δ(q0, b, a) = (q0, ba)

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

δ(q1, b, b) = (q1, ε)
δ(q1, a, a) = (q1, ε)
δ(q1, ε, Z) = (qf, ε)
DETERMINISTIC PDA

• A deterministic pushdown automata (DPDA) is a variation of the pushdown


automata.
• The class of deterministic pushdown automata accepts the deterministic context
free languages, a proper subset of context-free languages.
• A deterministic pushdown automaton has at most one legal transition for the
same combination of input symbol, state, and top stack symbol. This is where it
differs from the nondeterministic pushdown automata.
• Transition function is defined as :
DETERMINISTIC PDA

• Let be a PDA. Then M is deterministic if and only if both the following


conditions are satisfied:

• A Language L is accepted by DPDA if and only if there is a single computation


from the initial configuration until an accepting one for all string belongs to
Language.
DETERMINISTIC PDA

Example : Define the pushdown automata for language {an bn | n > 0}


Solution : M = where Q = { q0, q1 } and Σ = { a, b } and Γ = { A, Z } and δ is
given by :
δ( q0, a, Z ) = { ( q0, AZ ) }
δ( q0, a, A) = { ( q0, AA ) }
δ( q0, b, A) = { ( q1, ∈) }
δ( q1, b, A) = { ( q1, ∈) }
δ( q1, ∈, Z) = { ( q1, ∈) }
DETERMINISTIC PDA

Let us see how this automata works for aaabbb.

You might also like