Pushdown Automata PDAs - PowerPoint PPT Presentation

About This Presentation
Title:

Pushdown Automata PDAs

Description:

Pushdown Automaton -- PDA. Input String. Stack. States. Fall 2004 ... The automaton Halts in state. and Rejects the input string. Empty stack. HALT. Fall 2004 ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 77
Provided by: cost80
Learn more at: http://web.cs.wpi.edu
Category:

less

Transcript and Presenter's Notes

Title: Pushdown Automata PDAs


1
Pushdown AutomataPDAs

2
Pushdown Automaton -- PDA
Input String
Stack
States
3
Initial Stack Symbol
Stack
Stack
stack head
top
bottom
special symbol
4
The States
Pop symbol
Input symbol
Push symbol
5
input
stack
top
Replace
6
input
stack
top
Push
7
input
stack
top
Pop
8
input
stack
top
No Change
9
A Possible Transition
input
stack
empty
Pop
top
10
A Bad Transition
input
Empty stack

HALT
The automaton Halts in state and Rejects the
input string
11
A Bad Transition
input
Empty stack

HALT
The automaton Halts in state and Rejects the
input string
12
No transition is allowed to be followed when the
stack is empty
Empty stack
13
A Good Transition
input
stack
Pop
top
14
Non-Determinism
These are allowed transitions in a
Non-deterministic PDA (NPDA)
15
NPDA Non-Deterministic PDA
Example
16
Execution Example
Time 0
Input
Stack
current state
17
Time 1
Input
Stack
18
Time 2
Input
Stack
19
Time 3
Input
Stack
20
Time 4
Input
Stack
21
Time 5
Input
Stack
22
Time 6
Input
Stack
23
Time 7
Input
Stack
24
Time 8
Input
Stack
accept
25
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
26
The input string is accepted by the NPDA
27
In general,
is the language accepted by the NPDA
28
NPDA -- Another example
NPDA
29
Execution Example
Time 0
Input
Stack
30
Time 1
Input
Stack
31
Time 2
Input
Stack
32
Time 3
Input
Guess the middle of string
Stack
33
Time 4
Input
Stack
34
Time 5
Input
Stack
35
Time 6
Input
Stack
accept
36
Rejection Example
Time 0
Input
Stack
37
Time 1
Input
Stack
38
Time 2
Input
Stack
39
Time 3
Input
Guess the middle of string
Stack
40
Time 4
Input
Stack
41
Time 5
There is no possible transition.
Input
Input is not consumed
Stack
42
Another computation on the same string
Input
Time 0
Stack
43
Time 1
Input
Stack
44
Time 2
Input
Stack
45
Time 3
Input
Stack
46
Time 4
Input
Stack
47
Time 5
Input
No final state is reached
Stack
48
There is no computation that accepts string
49
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
50
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 OR The stack head moves below the bottom of
the stack
51
NPDA Another Example
52
Pushing Strings
Pop symbol
Input symbol
Push string
53
Example
input
pushed string
stack
top
Push
54
Another NPDA example
NPDA
55
Execution Example
Time 0
Input
Stack
current state
56
Time 1
Input
Stack
57
Time 3
Input
Stack
58
Time 4
Input
Stack
59
Time 5
Input
Stack
60
Time 6
Input
Stack
61
Time 7
Input
Stack
62
Time 8
Input
Stack
accept
63
Formalities for NPDAs

64
Transition function
65
Transition function
66
Formal Definition
Non-Deterministic Pushdown Automaton
NPDA
Final states
States
Input alphabet
Stack end symbol
Transition function
Initial state
Stack alphabet
67
Instantaneous Description (ID)
Current state
Current stack contents
Remaining unread input
68
Example
Instantaneous Description (ID)
Input
Time 4
Stack
69
Example
Instantaneous Description (ID)
Input
Time 5
Stack
70
We write
Time 4
Time 5
71
A computation
72
For convenience we write
73
Formal Definition
Language of NPDA
Initial ID
Final ID
74
Example
NPDA
75
NPDA
76
Therefore
NPDA
Write a Comment
User Comments (0)
About PowerShow.com