Download presentation
Presentation is loading. Please wait.
1
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs
2
Fall 2005Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States
3
Fall 2005Costas Busch - RPI3 Initial Stack Symbol Stack bottomspecial symbol stack head top Appears at time 0
4
Fall 2005Costas Busch - RPI4 The States Input symbol Pop symbol Push symbol
5
Fall 2005Costas Busch - RPI5 top input stack Replace
6
Fall 2005Costas Busch - RPI6 Push top input stack
7
Fall 2005Costas Busch - RPI7 Pop top input stack
8
Fall 2005Costas Busch - RPI8 No Change top input stack
9
Fall 2005Costas Busch - RPI9 Pop top input stack Empty Stack empty When the stack gets empty, the automaton HALTS (no more transitions after )
10
Fall 2005Costas Busch - RPI10 Pop top input stack A Possible Transition
11
Fall 2005Costas Busch - RPI11 Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions
12
Fall 2005Costas Busch - RPI12 Example PDA PDA :
13
Fall 2005Costas Busch - RPI13 Basic Idea: 1.Push the a’s on the stack 2. Match the b’s on input with a’s on stack 3. Match found
14
Fall 2005Costas Busch - RPI14 Execution Example: Input current state Time 0 Stack
15
Fall 2005Costas Busch - RPI15 Input Time 1 Stack
16
Fall 2005Costas Busch - RPI16 Input Stack Time 2
17
Fall 2005Costas Busch - RPI17 Input Stack Time 3
18
Fall 2005Costas Busch - RPI18 Input Stack Time 4
19
Fall 2005Costas Busch - RPI19 Input Stack Time 5
20
Fall 2005Costas Busch - RPI20 Input Stack Time 6
21
Fall 2005Costas Busch - RPI21 Input Stack Time 7
22
Fall 2005Costas Busch - RPI22 Input Time 8 accept Stack
23
Fall 2005Costas Busch - RPI23 A string is accepted if there is a computation such that: All the input is consumed AND The last state is an accepting state At the end of the computation, we do not care about the stack contents (the stack can be empty at the last state)
24
Fall 2005Costas Busch - RPI24 The input string is accepted by the PDA:
25
Fall 2005Costas Busch - RPI25 is the language accepted by the PDA: In general,
26
Fall 2005Costas Busch - RPI26 Rejection Example: Input current state Time 0 Stack
27
Fall 2005Costas Busch - RPI27 Rejection Example: Input current state Time 1 Stack
28
Fall 2005Costas Busch - RPI28 Rejection Example: Input current state Time 2 Stack
29
Fall 2005Costas Busch - RPI29 Rejection Example: Input current state Time 3 Stack
30
Fall 2005Costas Busch - RPI30 Rejection Example: Input current state Time 4 Stack
31
Fall 2005Costas Busch - RPI31 Rejection Example: Input current state Time 4 Stack reject
32
Fall 2005Costas Busch - RPI32 The input string is rejected by the PDA:
33
Fall 2005Costas Busch - RPI33 A string is rejected if there is no computation such that: All the input is consumed AND The last state is an accept state At the end of the computation, we do not care about the stack contents
34
Fall 2005Costas Busch - RPI34 Another PDA example PDA :
35
Fall 2005Costas Busch - RPI35 Basic Idea: 1.Push v on stack 2. Guess middle of input 3. Match on input with v on stack 4. Match found
36
Fall 2005Costas Busch - RPI36 Execution Example: Input Time 0 Stack
37
Fall 2005Costas Busch - RPI37 Input Time 1 Stack
38
Fall 2005Costas Busch - RPI38 Input Time 2 Stack
39
Fall 2005Costas Busch - RPI39 Input Time 3 Stack Guess the middle of string
40
Fall 2005Costas Busch - RPI40 Input Time 4 Stack
41
Fall 2005Costas Busch - RPI41 Input Time 5 Stack
42
Fall 2005Costas Busch - RPI42 Input Time 6 Stack accept
43
Fall 2005Costas Busch - RPI43 Rejection Example: Input Time 0 Stack
44
Fall 2005Costas Busch - RPI44 Input Time 1 Stack
45
Fall 2005Costas Busch - RPI45 Input Time 2 Stack
46
Fall 2005Costas Busch - RPI46 Input Time 3 Stack Guess the middle of string
47
Fall 2005Costas Busch - RPI47 Input Time 4 Stack
48
Fall 2005Costas Busch - RPI48 Input Time 5 Stack There is no possible transition. Input is not consumed
49
Fall 2005Costas Busch - RPI49 Another computation on same string: Input Time 0 Stack
50
Fall 2005Costas Busch - RPI50 Input Time 1 Stack
51
Fall 2005Costas Busch - RPI51 Input Time 2 Stack
52
Fall 2005Costas Busch - RPI52 Input Time 3 Stack
53
Fall 2005Costas Busch - RPI53 Input Time 4 Stack
54
Fall 2005Costas Busch - RPI54 Input Time 5 Stack No final state is reached
55
Fall 2005Costas Busch - RPI55 There is no computation that accepts string
56
Fall 2005Costas Busch - RPI56 Another PDA example PDA
57
Fall 2005Costas Busch - RPI57 Execution Example: Input Time 0 Stack
58
Fall 2005Costas Busch - RPI58 Input Time 1 Stack
59
Fall 2005Costas Busch - RPI59 Input Time 2 Stack
60
Fall 2005Costas Busch - RPI60 Input Time 3 Stack accept
61
Fall 2005Costas Busch - RPI61 Rejection example: Input Time 0 Stack
62
Fall 2005Costas Busch - RPI62 Input Time 1 Stack
63
Fall 2005Costas Busch - RPI63 Input Time 2 Stack
64
Fall 2005Costas Busch - RPI64 Input Time 3 Stack
65
Fall 2005Costas Busch - RPI65 Input Time 4 Stack Halt and Reject
66
Fall 2005Costas Busch - RPI66 Pushing Strings Input symbol Pop symbol Push string
67
Fall 2005Costas Busch - RPI67 top input stack Push pushed string Example:
68
Fall 2005Costas Busch - RPI68 Another PDA example PDA
69
Fall 2005Costas Busch - RPI69 Time 0 Input current state Stack Execution Example:
70
Fall 2005Costas Busch - RPI70 Time 1 Input Stack
71
Fall 2005Costas Busch - RPI71 Time 3 Input Stack
72
Fall 2005Costas Busch - RPI72 Time 4 Input Stack
73
Fall 2005Costas Busch - RPI73 Time 5 Input Stack
74
Fall 2005Costas Busch - RPI74 Time 6 Input Stack
75
Fall 2005Costas Busch - RPI75 Time 7 Input Stack
76
Fall 2005Costas Busch - RPI76 Time 8 Input Stack accept
77
Fall 2005Costas Busch - RPI77 Formalities for PDAs
78
Fall 2005Costas Busch - RPI78 Transition function:
79
Fall 2005Costas Busch - RPI79 Transition function:
80
Fall 2005Costas Busch - RPI80 Formal Definition Pushdown Automaton (PDA) States Input alphabet Stack alphabet Transition function Accept states Stack start symbol Initial state
81
Fall 2005Costas Busch - RPI81 Instantaneous Description Current state Remaining input Current stack contents
82
Fall 2005Costas Busch - RPI82 Input Stack Time 4: Example:Instantaneous Description
83
Fall 2005Costas Busch - RPI83 Input Stack Time 5: Example:Instantaneous Description
84
Fall 2005Costas Busch - RPI84 We write: Time 4 Time 5
85
Fall 2005Costas Busch - RPI85 A computation:
86
Fall 2005Costas Busch - RPI86 For convenience we write:
87
Fall 2005Costas Busch - RPI87 Formal Definition Language accepted by PDA : Initial state Accept state
88
Fall 2005Costas Busch - RPI88 Example: PDA :
89
Fall 2005Costas Busch - RPI89 PDA :
90
Fall 2005Costas Busch - RPI90 PDA : Therefore:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.