Download presentation
Presentation is loading. Please wait.
1
Pushdown Automata PDAs
Costas Busch - RPI
2
Pushdown Automaton -- PDA
Input String Stack States Costas Busch - RPI
3
Formal Definition Non-Deterministic Pushdown Automaton NPDA Final
states States Input alphabet Stack start symbol Transition function Initial state Stack alphabet Costas Busch - RPI
4
Initial Stack Symbol Stack Stack stack head top bottom special symbol
Costas Busch - RPI
5
The States Pop symbol Input symbol Push symbol Costas Busch - RPI
6
input stack top Replace Costas Busch - RPI
7
input stack top Push Costas Busch - RPI
8
input stack top Pop Costas Busch - RPI
9
input stack top No Change Costas Busch - RPI
10
A Possible Transition input stack empty Pop top Costas Busch - RPI
11
The automaton Halts in state and Rejects the input string
A Bad Transition input Empty stack HALT The automaton Halts in state and Rejects the input string Costas Busch - RPI
12
The automaton Halts in state and Rejects the input string
A Bad Transition input Empty stack HALT The automaton Halts in state and Rejects the input string Costas Busch - RPI
13
No transition is allowed to be followed When the stack is empty
Empty stack Costas Busch - RPI
14
A Good Transition input stack Pop top Costas Busch - RPI
15
Non-Determinism These are allowed transitions in a
Non-deterministic PDA (NPDA) Costas Busch - RPI
16
NPDA: Non-Deterministic PDA
Example: Costas Busch - RPI
17
Execution Example: Time 0 Input Stack current state Costas Busch - RPI
18
Time 1 Input Stack Costas Busch - RPI
19
Time 2 Input Stack Costas Busch - RPI
20
Time 3 Input Stack Costas Busch - RPI
21
Time 4 Input Stack Costas Busch - RPI
22
Time 5 Input Stack Costas Busch - RPI
23
Time 6 Input Stack Costas Busch - RPI
24
Time 7 Input Stack Costas Busch - RPI
25
Time 8 Input Stack accept Costas Busch - RPI
26
A string is accepted if there is a computation such that:
All the input is consumed AND The last state is a final state At the end of the computation, we do not care about the stack contents Costas Busch - RPI
27
is accepted by the NPDA:
The input string is accepted by the NPDA: Costas Busch - RPI
28
is the language accepted by the NPDA:
In general, is the language accepted by the NPDA: Costas Busch - RPI
29
Another NPDA example NPDA Costas Busch - RPI
30
Execution Example: Time 0 Input Stack Costas Busch - RPI
31
Time 1 Input Stack Costas Busch - RPI
32
Time 2 Input Stack Costas Busch - RPI
33
Time 3 Input Guess the middle of string Stack Costas Busch - RPI
34
Time 4 Input Stack Costas Busch - RPI
35
Time 5 Input Stack Costas Busch - RPI
36
Time 6 Input Stack accept Costas Busch - RPI
37
Rejection Example: Time 0 Input Stack Costas Busch - RPI
38
Time 1 Input Stack Costas Busch - RPI
39
Time 2 Input Stack Costas Busch - RPI
40
Time 3 Input Guess the middle of string Stack Costas Busch - RPI
41
Time 4 Input Stack Costas Busch - RPI
42
There is no possible transition. Input
Time 5 There is no possible transition. Input Input is not consumed Stack Costas Busch - RPI
43
Another computation on same string:
Input Time 0 Stack Costas Busch - RPI
44
Time 1 Input Stack Costas Busch - RPI
45
Time 2 Input Stack Costas Busch - RPI
46
Time 3 Input Stack Costas Busch - RPI
47
Time 4 Input Stack Costas Busch - RPI
48
Time 5 Input No final state is reached Stack Costas Busch - RPI
49
There is no computation that accepts string
Costas Busch - RPI
50
A string is rejected if there is no computation such that:
All the input is consumed AND The last state is a final state At the end of the computation, we do not care about the stack contents Costas Busch - RPI
51
In other words, a string is rejected
if in every computation with this string: The input cannot be consumed OR The input is consumed and the last state is not a final state The stack head moves below the bottom of the stack Costas Busch - RPI
52
Another NPDA example NPDA Costas Busch - RPI
53
Execution Example: Time 0 Input Stack Costas Busch - RPI
54
Time 1 Input Stack Costas Busch - RPI
55
Time 2 Input Stack Costas Busch - RPI
56
Time 3 Input Stack accept Costas Busch - RPI
57
Rejection example: Time 0 Input Stack Costas Busch - RPI
58
Time 1 Input Stack Costas Busch - RPI
59
Time 2 Input Stack Costas Busch - RPI
60
Time 3 Input Stack Costas Busch - RPI
61
Time 4 Input Stack Halt and Reject Costas Busch - RPI
62
Pushing Strings Pop symbol Input symbol Push string Costas Busch - RPI
63
Example: input pushed string stack top Push Costas Busch - RPI
64
Another NPDA example NPDA Costas Busch - RPI
65
Execution Example: Time 0 Input Stack current state Costas Busch - RPI
66
Time 1 Input Stack Costas Busch - RPI
67
Time 3 Input Stack Costas Busch - RPI
68
Time 4 Input Stack Costas Busch - RPI
69
Time 5 Input Stack Costas Busch - RPI
70
Time 6 Input Stack Costas Busch - RPI
71
Time 7 Input Stack Costas Busch - RPI
72
Time 8 Input Stack accept Costas Busch - RPI
73
Formalities for NPDAs Costas Busch - RPI
74
Transition function: Costas Busch - RPI
75
Transition function: Costas Busch - RPI
76
Formal Definition Non-Deterministic Pushdown Automaton NPDA Final
states States Input alphabet Stack start symbol Transition function Initial state Stack alphabet Costas Busch - RPI
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.