770 likes | 837 Views
Learn the basics of pushdown automata (PDAs) through Costas Busch's detailed examples and step-by-step execution scenarios. Explore the concepts of stack manipulation, states, input processing, and acceptance/rejection criteria.
E N D
Pushdown AutomataPDAs Costas Busch - RPI
Pushdown Automaton -- PDA Input String Stack States Costas Busch - RPI
Initial Stack Symbol Stack Stack stack head top bottom special symbol Appears at time 0 Costas Busch - RPI
The States Pop symbol Input symbol Push symbol Costas Busch - RPI
input stack top Replace Costas Busch - RPI
input stack top Push Costas Busch - RPI
input stack top Pop Costas Busch - RPI
input stack top No Change Costas Busch - RPI
Pop from Empty Stack input Pop Automaton halts! stack top If the automaton attempts to pop from empty stack then it halts and rejects input Costas Busch - RPI
Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions Costas Busch - RPI
Example PDA PDA : Costas Busch - RPI
Basic Idea: • Push the a’s • on the stack 2. Match the b’s on input with a’s on stack 3. Match found Costas Busch - RPI
Execution Example: Time 0 Input Stack current state Costas Busch - RPI
Time 1 Input Stack Costas Busch - RPI
Time 2 Input Stack Costas Busch - RPI
Time 3 Input Stack Costas Busch - RPI
Time 4 Input Stack Costas Busch - RPI
Time 5 Input Stack Costas Busch - RPI
Time 6 Input Stack Costas Busch - RPI
Time 7 Input Stack Costas Busch - RPI
Time 8 Input Stack accept Costas Busch - RPI
A string is accepted if there is a computation such that: All the input is consumed AND The last state is an accepting state we do not care about the stack contents at the end of the accepting computation Costas Busch - RPI
Rejection Example: Time 0 Input Stack current state Costas Busch - RPI
Rejection Example: Time 1 Input Stack current state Costas Busch - RPI
Rejection Example: Time 2 Input Stack current state Costas Busch - RPI
Rejection Example: Time 3 Input Stack current state Costas Busch - RPI
Rejection Example: Time 4 Input Stack current state Costas Busch - RPI
Rejection Example: Time 4 Input Stack reject current state Costas Busch - RPI
There is no accepting computation for The string is rejected by the PDA Costas Busch - RPI
Another PDA example PDA : Costas Busch - RPI
Basic Idea: • Push v • on stack 3. Match on input with v on stack 2. Guess middle of input 4. Match found Costas Busch - RPI
Execution Example: Time 0 Input Stack Costas Busch - RPI
Time 1 Input Stack Costas Busch - RPI
Time 2 Input Stack Costas Busch - RPI
Time 3 Input Guess the middle of string Stack Costas Busch - RPI
Time 4 Input Stack Costas Busch - RPI
Time 5 Input Stack Costas Busch - RPI
Time 6 Input Stack accept Costas Busch - RPI
Rejection Example: Time 0 Input Stack Costas Busch - RPI
Time 1 Input Stack Costas Busch - RPI
Time 2 Input Stack Costas Busch - RPI
Time 3 Input Guess the middle of string Stack Costas Busch - RPI
Time 4 Input Stack Costas Busch - RPI
Time 5 There is no possible transition. Input Input is not consumed Stack Costas Busch - RPI
Another computation on same string: Input Time 0 Stack Costas Busch - RPI
Time 1 Input Stack Costas Busch - RPI
Time 2 Input Stack Costas Busch - RPI
Time 3 Input Stack Costas Busch - RPI
Time 4 Input Stack Costas Busch - RPI
Time 5 Input No accept state is reached Stack Costas Busch - RPI