Download presentation
Presentation is loading. Please wait.
1
Fall 2004COMP 3351 Pushdown Automata PDAs
2
Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States
3
Fall 2004COMP 3353 Initial Stack Symbol Stack bottom special symbol stack head top
4
Fall 2004COMP 3354 The States Input symbol Pop symbol Push symbol
5
Fall 2004COMP 3355 top input stack Replace
6
Fall 2004COMP 3356 Push top input stack
7
Fall 2004COMP 3357 Pop top input stack
8
Fall 2004COMP 3358 No Change top input stack
9
Fall 2004COMP 3359 Pop top input stack A Possible Transition empty
10
Fall 2004COMP 33510 input A Bad Transition The automaton Halts in state and Rejects the input string Empty stack HALT
11
Fall 2004COMP 33511 input A Bad Transition The automaton Halts in state and Rejects the input string Empty stack HALT
12
Fall 2004COMP 33512 No transition is allowed to be followed when the stack is empty Empty stack
13
Fall 2004COMP 33513 Pop top input stack A Good Transition
14
Fall 2004COMP 33514 Non-Determinism These are allowed transitions in a Non-deterministic PDA (NPDA)
15
Fall 2004COMP 33515 NPDA: Non-Deterministic PDA Example:
16
Fall 2004COMP 33516 Execution Example: Input current state Time 0 Stack
17
Fall 2004COMP 33517 Input Time 1 Stack
18
Fall 2004COMP 33518 Input Stack Time 2
19
Fall 2004COMP 33519 Input Stack Time 3
20
Fall 2004COMP 33520 Input Stack Time 4
21
Fall 2004COMP 33521 Input Stack Time 5
22
Fall 2004COMP 33522 Input Stack Time 6
23
Fall 2004COMP 33523 Input Stack Time 7
24
Fall 2004COMP 33524 Input Time 8 accept Stack
25
Fall 2004COMP 33525 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
Fall 2004COMP 33526 The input string is accepted by the NPDA:
27
Fall 2004COMP 33527 is the language accepted by the NPDA: In general,
28
Fall 2004COMP 33528 NPDA -- Another example NPDA
29
Fall 2004COMP 33529 Execution Example: Input Time 0 Stack
30
Fall 2004COMP 33530 Input Time 1 Stack
31
Fall 2004COMP 33531 Input Time 2 Stack
32
Fall 2004COMP 33532 Input Time 3 Stack Guess the middle of string
33
Fall 2004COMP 33533 Input Time 4 Stack
34
Fall 2004COMP 33534 Input Time 5 Stack
35
Fall 2004COMP 33535 Input Time 6 Stack accept
36
Fall 2004COMP 33536 Rejection Example: Input Time 0 Stack
37
Fall 2004COMP 33537 Input Time 1 Stack
38
Fall 2004COMP 33538 Input Time 2 Stack
39
Fall 2004COMP 33539 Input Time 3 Stack Guess the middle of string
40
Fall 2004COMP 33540 Input Time 4 Stack
41
Fall 2004COMP 33541 Input Time 5 Stack There is no possible transition. Input is not consumed
42
Fall 2004COMP 33542 Another computation on the same string: Input Time 0 Stack
43
Fall 2004COMP 33543 Input Time 1 Stack
44
Fall 2004COMP 33544 Input Time 2 Stack
45
Fall 2004COMP 33545 Input Time 3 Stack
46
Fall 2004COMP 33546 Input Time 4 Stack
47
Fall 2004COMP 33547 Input Time 5 Stack No final state is reached
48
Fall 2004COMP 33548 There is no computation that accepts string
49
Fall 2004COMP 33549 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
Fall 2004COMP 33550 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
Fall 2004COMP 33551 NPDA – Another Example
52
Fall 2004COMP 33552 Pushing Strings Input symbol Pop symbol Push string
53
Fall 2004COMP 33553 top input stack Push pushed string Example:
54
Fall 2004COMP 33554 Another NPDA example NPDA
55
Fall 2004COMP 33555 Time 0 Input current state Stack Execution Example:
56
Fall 2004COMP 33556 Time 1 Input Stack
57
Fall 2004COMP 33557 Time 3 Input Stack
58
Fall 2004COMP 33558 Time 4 Input Stack
59
Fall 2004COMP 33559 Time 5 Input Stack
60
Fall 2004COMP 33560 Time 6 Input Stack
61
Fall 2004COMP 33561 Time 7 Input Stack
62
Fall 2004COMP 33562 Time 8 Input Stack accept
63
Fall 2004COMP 33563 Formalities for NPDAs
64
Fall 2004COMP 33564 Transition function:
65
Fall 2004COMP 33565 Transition function:
66
Fall 2004COMP 33566 Formal Definition Non-Deterministic Pushdown Automaton NPDA States Input alphabet Stack alphabet Transition function Final states Stack end symbol Initial state
67
Fall 2004COMP 33567 Instantaneous Description (ID) Current state Remaining unread input Current stack contents
68
Fall 2004COMP 33568 Input Stack Time 4: Example:Instantaneous Description (ID)
69
Fall 2004COMP 33569 Input Stack Time 5: Example:Instantaneous Description (ID)
70
Fall 2004COMP 33570 We write: Time 4 Time 5
71
Fall 2004COMP 33571 A computation:
72
Fall 2004COMP 33572 For convenience we write:
73
Fall 2004COMP 33573 Formal Definition Language of NPDA : Initial IDFinal ID
74
Fall 2004COMP 33574 Example: NPDA :
75
Fall 2004COMP 33575 NPDA :
76
Fall 2004COMP 33576 NPDA : Therefore:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.