Pushdown Automata PDAs Costas Busch LSU 1 Pushdown
Pushdown Automata PDAs Costas Busch - LSU 1
Pushdown Automaton -- PDA Input String Stack States Costas Busch - LSU 2
Initial Stack Symbol Stack stack head top bottom special symbol Appears at time 0 Costas Busch - LSU 3
The States Input symbol Pop symbol Costas Busch - LSU Push symbol 4
input stack top Replace Costas Busch - LSU 5
input stack top Push Costas Busch - LSU 6
input stack top Pop Costas Busch - LSU 7
input stack top No Change Costas Busch - LSU 8
Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions Costas Busch - LSU 9
Example PDA : Costas Busch - LSU 10
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 - LSU 11
Execution Example: Time 0 Input Stack current state Costas Busch - LSU 12
Time 1 Input Stack Costas Busch - LSU 13
Time 2 Input Stack Costas Busch - LSU 14
Time 3 Input Stack Costas Busch - LSU 15
Time 4 Input Stack Costas Busch - LSU 16
Time 5 Input Stack Costas Busch - LSU 17
Time 6 Input Stack Costas Busch - LSU 18
Time 7 Input Stack Costas Busch - LSU 19
Time 8 Input Stack accept Costas Busch - LSU 20
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 - LSU 21
Rejection Example: Time 0 Input Stack current state Costas Busch - LSU 22
Rejection Example: Time 1 Input Stack current state Costas Busch - LSU 23
Rejection Example: Time 2 Input Stack current state Costas Busch - LSU 24
Rejection Example: Time 3 Input Stack current state Costas Busch - LSU 25
Rejection Example: Time 4 Input Stack current state Costas Busch - LSU 26
Rejection Example: Time 4 Input reject Stack current state Costas Busch - LSU 27
There is no accepting computation for The string is rejected by the PDA Costas Busch - LSU 28
Another PDA example PDA : Costas Busch - LSU 29
Basic Idea: • Push v on stack 2. Guess middle of input 3. Match on input with v on stack 4. Match found Costas Busch - LSU 30
Execution Example: Time 0 Input Stack Costas Busch - LSU 31
Time 1 Input Stack Costas Busch - LSU 32
Time 2 Input Stack Costas Busch - LSU 33
Time 3 Input Guess the middle of string Stack Costas Busch - LSU 34
Time 4 Input Stack Costas Busch - LSU 35
Time 5 Input Stack Costas Busch - LSU 36
Time 6 Input Stack accept Costas Busch - LSU 37
Rejection Example: Time 0 Input Stack Costas Busch - LSU 38
Time 1 Input Stack Costas Busch - LSU 39
Time 2 Input Stack Costas Busch - LSU 40
Time 3 Input Guess the middle of string Stack Costas Busch - LSU 41
Time 4 Input Stack Costas Busch - LSU 42
Input Time 5 There is no possible transition. Input is not consumed Stack Costas Busch - LSU 43
Another computation on same string: Input Time 0 Stack Costas Busch - LSU 44
Time 1 Input Stack Costas Busch - LSU 45
Time 2 Input Stack Costas Busch - LSU 46
Time 3 Input Stack Costas Busch - LSU 47
Time 4 Input Stack Costas Busch - LSU 48
Time 5 Input No accept state is reached Stack Costas Busch - LSU 49
There is no computation that accepts string Costas Busch - LSU 50
Pushing & Popping Strings Input symbol Pop string Costas Busch - LSU Push string 51
Example: input stack pop string top push string Replace Costas Busch - LSU 52
Equivalent transitions pop push Costas Busch - LSU 53
Another PDA example PDA Costas Busch - LSU 54
Execution Example: Time 0 Input Stack current state Costas Busch - LSU 55
Time 1 Input Stack Costas Busch - LSU 56
Time 3 Input Stack Costas Busch - LSU 57
Time 4 Input Stack Costas Busch - LSU 58
Time 5 Input Stack Costas Busch - LSU 59
Time 6 Input Stack Costas Busch - LSU 60
Time 7 Input Stack Costas Busch - LSU 61
Time 8 Input Stack accept Costas Busch - LSU 62
Formalities for PDAs Costas Busch - LSU 63
Transition function: Costas Busch - LSU 64
Transition function: Costas Busch - LSU 65
Formal Definition Pushdown Automaton (PDA) Accept states States Input alphabet Transition Initial Stack function state alphabet Costas Busch - LSU Stack start symbol 66
Instantaneous Description Current state Remaining input Costas Busch - LSU Current stack contents 67
Example: Instantaneous Description Time 4: Input Stack Costas Busch - LSU 68
Example: Instantaneous Description Time 5: Input Stack Costas Busch - LSU 69
We write: Time 4 Time 5 Costas Busch - LSU 70
A computation: Costas Busch - LSU 71
For convenience we write: Costas Busch - LSU 72
Language of PDA Language accepted by PDA Initial state Costas Busch - LSU : Accept state 73
Example: PDA : Costas Busch - LSU 74
PDA : Costas Busch - LSU 75
Therefore: PDA : Costas Busch - LSU 76
- Slides: 76