SlideShare a Scribd company logo
3
Most read
8
Most read
15
Most read
CSC218
COMPUTERORGANIZATIONANDFORMALLANGUAGES
Push down automata (PDA).
Nnamene C.C 1
Overview
• Introduction to Push Down Automata (PDA)
• Implementation
• State Operations
2
Push down Automata (PDA)
• This is similar to the FSM, but has additional memory
• This memory uses a stack, which has two operations:
• Push (add a new symbol at the top)
• Pop (read and remove the top symbol)
3
PDA = Finite Automata + Memory (Stack)
a1 a2 a3 .. anInput
FSM
Stack
Used to manipulate the
stacks from the states
Structure of the Push Down Automaton
From left to right 
PDA cntd.
• A PDA is a septuple (7-tuple) system (Q,Σ,Г,δ,q0,Z0,F)
where:
• Q is a finite set of states {qi …., qn)
• Σ is an input alphabet (alphabet of the language);
• Г is a stack alphabet (stack-symbols denoted by Gamma);
• δ is the transition mapping from Q×(Σ ∪{ε})×Г to finite
subsets of Q× Г *
• q0 in Q is the initial state (start state);
• Z0 in Г is a particular stack-symbol called the start symbol;
• F: the set of final states (F ⊆ Q)
4
Conventions used
• Lower cases are used for input symbols eg. a, b, c,…
• e is also allowed as a possible value
• Upper cases are used for stack symbols
• Eg. X, Y, Z, …
• Lower case letters at the end of the alphabets are used
for strings of input symbols eg. x, y, z, …
• The beginning Greek alphabets are used for strings of
stack symbols
• Eg. a, b, …
5
Implementing PDA
• This take into account a transition function with the
following arguments:
1. A state, in Q
2. An input symbol in Σ or e
3. A stack symbol Г
6
For every δ(q, a, z), this will contain (p, a) such that:
p = a state
a = a string of stack symbols
In addition, a PDA having a state ‘q’, and ‘a’ at the front of
the input, and Z at the top of the stack implies:
change the state to p
Remove ‘a’ from the front of input
Replace Z on the top of the stack by ‘a’
Implementing PDA cntd.
Example.
To design a PDA which will accept the Language
{0n1n | n ≥ 1}
• The states in here shows:
• q= the start state (permitting zeros at the beginning)
• p = At least one 1 can proceed if the inputs are 1’s
• f = Final state (we will accept if the number of 1’s
matches the number of 0’s)
• Z0 = Start symbol (this marks the bottom of the stark
• X = a marker that counts the number of 0’s in the
input 7
Implementing PDA
Given the following input string
Does this satisfy the automaton?
The following transitions apply:
δ(q, 0, Z0) = {(q, XZ0)}
δ(q, 0, X) = {(q, XX)}
:
δ(q, 1, X) = {(p, e)}
δ(p, 1, X) = {(p, e)}
δ(p, e , Z0) = {(f, Z0)}
8
Number of X on stack = the number
of 0’s read from input
When 1 is encountered, then we
pop one X from the stack
No input
Z0 at the top of stack
Pop one X per occurrence of 1
0 0 0 1 1 1
String: from left to right
Stack: LIFO
Stay in state q since
the input = 0’s
Change to state p
since the input =1’s
Mapping (Replacement string)
9
0 0 0 1 1 1
X
X
Z0
X
Z0
X
X
X
Z0
X
X
Z0
X
Z0
δ
Z0
Z0
start
T1 T2 T3 T4 T5
Push 0
Push 0
Push 0
Pop 1
Pop 1
Pop 1
T6
accept
Criteria: All inputs are
completely consumed
inputs
Transition function mapping each triple (qi , a, X), where qi = a state;
a = input symbol or ᴧ; X = stack symbol
δ(q, 0, X) = {(q, XZ0)}
Z0 = top
symbol and
also marks the
Bottom of the
stack
Marker to
count the
number of
zeros on the
input
State q State p
State Operations
• Note that transitions of the PDA is the form:
a, x  y
This implies that if “a” is seen in the input string, and there is an
“x” symbol on top of the stack,
“y” is then added and the “x” is removed
10
This applies to the operations (Replace, push, pop, No Change)
… a …
Input string
State Operations (Replace)
11
a, b  cInput symbol
Top stack symbol
Push symbol
q1 q2
a, b  c
b
f
$
c
f
$
Transition to state q2
replace
State Operation (Push)
12
a, e  cInput symbol
Top stack symbol
Push symbol
q1 q2
a, e  c
Transition to state q2
b
f
$
push
c
b
f
$
State Operation (Pop)
13
a, b  eInput symbol
Top stack symbol
Push symbol
q1 q2
a, b  e
Transition to state q2
b
f
$
pop
f
$
State Operation (No change)
14
a, e  eInput symbol
Top stack symbol
Push symbol
q1 q2
a, e  e
Transition to state q2
b
f
$
No change
b
f
$
Note: the Automaton will
halts or rejects input if
there is an attempt to
perform a pop or replace
operation on an empty
stack.
Condition for PDAacceptanceor rejection
• The PDA accepts if there is a computation such that:
• the computation path ends in an accept state, and
• all the inputs in the string is consumed.
• On the other hand, the PDA rejects if in all paths:
• the computation path ends in the non accepting state, and
• there is an incomplete computation path such that there is no
possible transition in the input and stack symbols.
15
Empty stack indicator ($)
• We place dollar sign ($) or Z0 as the case may be to
help indicate when the stack is empty.
• Discovering the sign again indicates the end of the
stack
16
Familiar Example
• Consider the Machine to accept the PDA for the language {an bn | n ≥ 0}
17
start
Initial placement of $
sign to the empty stack
Push
Operation
Pop
Operation
Pop
Operation
$
$
a
:
.
Sequence of moves (Goes to “˫”)
• To describe the sequence of moves of the previous
example, the following holds:
• (q, 000111, Z0) ˫ (q, 00111, XZ0) ˫
• (q,0111, XXZ0) ˫ (q, 111, XXXZ0) ˫
• (p, 11, XXZ0) ˫ (p, 1, Z0) ˫
• (p, e, Z0) ˫ (f, e, Z0 )
• Therefore, (q, 000111, Z0) ˫ (f, e, Z0 )
18
Sequence of moves (Goes to “˫”)
• In a situation where there is an extra 1 eg. 0001111 on
the input, this gives the following sequence:
• (q, 0001111, Z0) ˫ (q, 001111, XZ0) ˫
• (q,01111, XXZ0) ˫ (q, 1111, XXXZ0) ˫
• (p, 111, XXZ0) ˫ (p, 11, XZ0) ˫ (p, 1, Z0) ˫
• (f, 1, Z0)
Therefore, 0001111 is not accepted.
19
THANK YOU!
20

More Related Content

PPTX
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
PPTX
Grid computing
PPT
HCI 3e - Ch 1: The human
PPTX
Cloud storage
PPTX
Iot architecture
PPT
Memory management
PPTX
Turing machine-TOC
PPTX
Context free grammar
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Grid computing
HCI 3e - Ch 1: The human
Cloud storage
Iot architecture
Memory management
Turing machine-TOC
Context free grammar

What's hot (20)

PPTX
Automata theory - Push Down Automata (PDA)
PPTX
Pushdown Automata Theory
PPT
pushdown automata
PPTX
Push down automata
PPTX
LINEAR BOUNDED AUTOMATA (LBA).pptx
PPTX
Pumping lemma
PPTX
1.10. pumping lemma for regular sets
PPTX
Turing Machine
PPT
Finite automata
PDF
Deterministic Finite Automata (DFA)
PPTX
Push down automata
PPTX
Introduction TO Finite Automata
PPTX
Sum of subset problem.pptx
PPTX
Moore Mealy Machine Conversion
PPTX
daa-unit-3-greedy method
PPT
Variants of Turing Machine
PPTX
CONTEXT FREE GRAMMAR
PPTX
1.7. eqivalence of nfa and dfa
PPTX
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Automata theory - Push Down Automata (PDA)
Pushdown Automata Theory
pushdown automata
Push down automata
LINEAR BOUNDED AUTOMATA (LBA).pptx
Pumping lemma
1.10. pumping lemma for regular sets
Turing Machine
Finite automata
Deterministic Finite Automata (DFA)
Push down automata
Introduction TO Finite Automata
Sum of subset problem.pptx
Moore Mealy Machine Conversion
daa-unit-3-greedy method
Variants of Turing Machine
CONTEXT FREE GRAMMAR
1.7. eqivalence of nfa and dfa
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Ad

Similar to push down automata (20)

PPTX
csc218pushdownautomata-160627235627.pptx
PPTX
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
PPTX
16 PDA push down autometa push down.pptx
PPTX
PDA (1) (1).pptx
PPTX
Theory of automata
PPTX
Unit iv
PPT
Turing Machine push down automata-examples
PPT
Description of Finite Automata and Languages Accepted by Push Down Automata
PPT
Push Down Automata (PDA) Definition, Problems and State Diagrams including tr...
PPTX
Pushdown Automata toc presentation 2025.pptx
PPT
Designing of a Determinstic Push Down Atomaton
PPTX
Unit 2 Pumping lemma Unit 2 Pumping lemma
PPTX
INTRODUTION Formal Language and Automatic Theory.pptx
PPT
Unit-3_TOC theory of computation subj.ppt
PPT
Pushdown Automaton (1).ppt
PDF
Formal Languages and Automata Theory unit 3
PDF
TuringMachines.pdf
PDF
Theory of computation and automata
PDF
Theory of computation and automata
csc218pushdownautomata-160627235627.pptx
AUTOMATA AUTOMATA AUTOMATAAutomata7Chapter6.pptx
16 PDA push down autometa push down.pptx
PDA (1) (1).pptx
Theory of automata
Unit iv
Turing Machine push down automata-examples
Description of Finite Automata and Languages Accepted by Push Down Automata
Push Down Automata (PDA) Definition, Problems and State Diagrams including tr...
Pushdown Automata toc presentation 2025.pptx
Designing of a Determinstic Push Down Atomaton
Unit 2 Pumping lemma Unit 2 Pumping lemma
INTRODUTION Formal Language and Automatic Theory.pptx
Unit-3_TOC theory of computation subj.ppt
Pushdown Automaton (1).ppt
Formal Languages and Automata Theory unit 3
TuringMachines.pdf
Theory of computation and automata
Theory of computation and automata
Ad

Recently uploaded (20)

PDF
CHAPTER 3 Cell Structures and Their Functions Lecture Outline.pdf
PPTX
Seminar Hypertension and Kidney diseases.pptx
PPTX
TORCH INFECTIONS in pregnancy with toxoplasma
PPTX
Microbes in human welfare class 12 .pptx
PPTX
PMR- PPT.pptx for students and doctors tt
PPT
veterinary parasitology ````````````.ppt
PDF
The Land of Punt — A research by Dhani Irwanto
PPTX
ap-psych-ch-1-introduction-to-psychology-presentation.pptx
PPTX
Biomechanics of the Hip - Basic Science.pptx
PPTX
Introcution to Microbes Burton's Biology for the Health
PPTX
Welcome-grrewfefweg-students-of-2024.pptx
PDF
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
PPT
LEC Synthetic Biology and its application.ppt
PPT
Mutation in dna of bacteria and repairss
PPT
Presentation of a Romanian Institutee 2.
PDF
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
PDF
lecture 2026 of Sjogren's syndrome l .pdf
PDF
Communicating Health Policies to Diverse Populations (www.kiu.ac.ug)
PPTX
perinatal infections 2-171220190027.pptx
PPTX
BODY FLUIDS AND CIRCULATION class 11 .pptx
CHAPTER 3 Cell Structures and Their Functions Lecture Outline.pdf
Seminar Hypertension and Kidney diseases.pptx
TORCH INFECTIONS in pregnancy with toxoplasma
Microbes in human welfare class 12 .pptx
PMR- PPT.pptx for students and doctors tt
veterinary parasitology ````````````.ppt
The Land of Punt — A research by Dhani Irwanto
ap-psych-ch-1-introduction-to-psychology-presentation.pptx
Biomechanics of the Hip - Basic Science.pptx
Introcution to Microbes Burton's Biology for the Health
Welcome-grrewfefweg-students-of-2024.pptx
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
LEC Synthetic Biology and its application.ppt
Mutation in dna of bacteria and repairss
Presentation of a Romanian Institutee 2.
Worlds Next Door: A Candidate Giant Planet Imaged in the Habitable Zone of ↵ ...
lecture 2026 of Sjogren's syndrome l .pdf
Communicating Health Policies to Diverse Populations (www.kiu.ac.ug)
perinatal infections 2-171220190027.pptx
BODY FLUIDS AND CIRCULATION class 11 .pptx

push down automata

  • 2. Overview • Introduction to Push Down Automata (PDA) • Implementation • State Operations 2
  • 3. Push down Automata (PDA) • This is similar to the FSM, but has additional memory • This memory uses a stack, which has two operations: • Push (add a new symbol at the top) • Pop (read and remove the top symbol) 3 PDA = Finite Automata + Memory (Stack) a1 a2 a3 .. anInput FSM Stack Used to manipulate the stacks from the states Structure of the Push Down Automaton From left to right 
  • 4. PDA cntd. • A PDA is a septuple (7-tuple) system (Q,Σ,Г,δ,q0,Z0,F) where: • Q is a finite set of states {qi …., qn) • Σ is an input alphabet (alphabet of the language); • Г is a stack alphabet (stack-symbols denoted by Gamma); • δ is the transition mapping from Q×(Σ ∪{ε})×Г to finite subsets of Q× Г * • q0 in Q is the initial state (start state); • Z0 in Г is a particular stack-symbol called the start symbol; • F: the set of final states (F ⊆ Q) 4
  • 5. Conventions used • Lower cases are used for input symbols eg. a, b, c,… • e is also allowed as a possible value • Upper cases are used for stack symbols • Eg. X, Y, Z, … • Lower case letters at the end of the alphabets are used for strings of input symbols eg. x, y, z, … • The beginning Greek alphabets are used for strings of stack symbols • Eg. a, b, … 5
  • 6. Implementing PDA • This take into account a transition function with the following arguments: 1. A state, in Q 2. An input symbol in Σ or e 3. A stack symbol Г 6 For every δ(q, a, z), this will contain (p, a) such that: p = a state a = a string of stack symbols In addition, a PDA having a state ‘q’, and ‘a’ at the front of the input, and Z at the top of the stack implies: change the state to p Remove ‘a’ from the front of input Replace Z on the top of the stack by ‘a’
  • 7. Implementing PDA cntd. Example. To design a PDA which will accept the Language {0n1n | n ≥ 1} • The states in here shows: • q= the start state (permitting zeros at the beginning) • p = At least one 1 can proceed if the inputs are 1’s • f = Final state (we will accept if the number of 1’s matches the number of 0’s) • Z0 = Start symbol (this marks the bottom of the stark • X = a marker that counts the number of 0’s in the input 7
  • 8. Implementing PDA Given the following input string Does this satisfy the automaton? The following transitions apply: δ(q, 0, Z0) = {(q, XZ0)} δ(q, 0, X) = {(q, XX)} : δ(q, 1, X) = {(p, e)} δ(p, 1, X) = {(p, e)} δ(p, e , Z0) = {(f, Z0)} 8 Number of X on stack = the number of 0’s read from input When 1 is encountered, then we pop one X from the stack No input Z0 at the top of stack Pop one X per occurrence of 1 0 0 0 1 1 1 String: from left to right Stack: LIFO Stay in state q since the input = 0’s Change to state p since the input =1’s Mapping (Replacement string)
  • 9. 9 0 0 0 1 1 1 X X Z0 X Z0 X X X Z0 X X Z0 X Z0 δ Z0 Z0 start T1 T2 T3 T4 T5 Push 0 Push 0 Push 0 Pop 1 Pop 1 Pop 1 T6 accept Criteria: All inputs are completely consumed inputs Transition function mapping each triple (qi , a, X), where qi = a state; a = input symbol or ᴧ; X = stack symbol δ(q, 0, X) = {(q, XZ0)} Z0 = top symbol and also marks the Bottom of the stack Marker to count the number of zeros on the input State q State p
  • 10. State Operations • Note that transitions of the PDA is the form: a, x  y This implies that if “a” is seen in the input string, and there is an “x” symbol on top of the stack, “y” is then added and the “x” is removed 10 This applies to the operations (Replace, push, pop, No Change) … a … Input string
  • 11. State Operations (Replace) 11 a, b  cInput symbol Top stack symbol Push symbol q1 q2 a, b  c b f $ c f $ Transition to state q2 replace
  • 12. State Operation (Push) 12 a, e  cInput symbol Top stack symbol Push symbol q1 q2 a, e  c Transition to state q2 b f $ push c b f $
  • 13. State Operation (Pop) 13 a, b  eInput symbol Top stack symbol Push symbol q1 q2 a, b  e Transition to state q2 b f $ pop f $
  • 14. State Operation (No change) 14 a, e  eInput symbol Top stack symbol Push symbol q1 q2 a, e  e Transition to state q2 b f $ No change b f $ Note: the Automaton will halts or rejects input if there is an attempt to perform a pop or replace operation on an empty stack.
  • 15. Condition for PDAacceptanceor rejection • The PDA accepts if there is a computation such that: • the computation path ends in an accept state, and • all the inputs in the string is consumed. • On the other hand, the PDA rejects if in all paths: • the computation path ends in the non accepting state, and • there is an incomplete computation path such that there is no possible transition in the input and stack symbols. 15
  • 16. Empty stack indicator ($) • We place dollar sign ($) or Z0 as the case may be to help indicate when the stack is empty. • Discovering the sign again indicates the end of the stack 16
  • 17. Familiar Example • Consider the Machine to accept the PDA for the language {an bn | n ≥ 0} 17 start Initial placement of $ sign to the empty stack Push Operation Pop Operation Pop Operation $ $ a : .
  • 18. Sequence of moves (Goes to “˫”) • To describe the sequence of moves of the previous example, the following holds: • (q, 000111, Z0) ˫ (q, 00111, XZ0) ˫ • (q,0111, XXZ0) ˫ (q, 111, XXXZ0) ˫ • (p, 11, XXZ0) ˫ (p, 1, Z0) ˫ • (p, e, Z0) ˫ (f, e, Z0 ) • Therefore, (q, 000111, Z0) ˫ (f, e, Z0 ) 18
  • 19. Sequence of moves (Goes to “˫”) • In a situation where there is an extra 1 eg. 0001111 on the input, this gives the following sequence: • (q, 0001111, Z0) ˫ (q, 001111, XZ0) ˫ • (q,01111, XXZ0) ˫ (q, 1111, XXXZ0) ˫ • (p, 111, XXZ0) ˫ (p, 11, XZ0) ˫ (p, 1, Z0) ˫ • (f, 1, Z0) Therefore, 0001111 is not accepted. 19

Editor's Notes