Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs
Fall 2005Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States
Fall 2005Costas Busch - RPI3 Initial Stack Symbol Stack bottomspecial symbol stack head top Appears at time 0
Fall 2005Costas Busch - RPI4 The States Input symbol Pop symbol Push symbol
Fall 2005Costas Busch - RPI5 top input stack Replace
Fall 2005Costas Busch - RPI6 Push top input stack
Fall 2005Costas Busch - RPI7 Pop top input stack
Fall 2005Costas Busch - RPI8 No Change top input stack
Fall 2005Costas Busch - RPI9 Pop top input stack Empty Stack empty When the stack gets empty, the automaton HALTS (no more transitions after )
Fall 2005Costas Busch - RPI10 Pop top input stack A Possible Transition
Fall 2005Costas Busch - RPI11 Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions
Fall 2005Costas Busch - RPI12 Example PDA PDA :
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
Fall 2005Costas Busch - RPI14 Execution Example: Input current state Time 0 Stack
Fall 2005Costas Busch - RPI15 Input Time 1 Stack
Fall 2005Costas Busch - RPI16 Input Stack Time 2
Fall 2005Costas Busch - RPI17 Input Stack Time 3
Fall 2005Costas Busch - RPI18 Input Stack Time 4
Fall 2005Costas Busch - RPI19 Input Stack Time 5
Fall 2005Costas Busch - RPI20 Input Stack Time 6
Fall 2005Costas Busch - RPI21 Input Stack Time 7
Fall 2005Costas Busch - RPI22 Input Time 8 accept Stack
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)
Fall 2005Costas Busch - RPI24 The input string is accepted by the PDA:
Fall 2005Costas Busch - RPI25 is the language accepted by the PDA: In general,
Fall 2005Costas Busch - RPI26 Rejection Example: Input current state Time 0 Stack
Fall 2005Costas Busch - RPI27 Rejection Example: Input current state Time 1 Stack
Fall 2005Costas Busch - RPI28 Rejection Example: Input current state Time 2 Stack
Fall 2005Costas Busch - RPI29 Rejection Example: Input current state Time 3 Stack
Fall 2005Costas Busch - RPI30 Rejection Example: Input current state Time 4 Stack
Fall 2005Costas Busch - RPI31 Rejection Example: Input current state Time 4 Stack reject
Fall 2005Costas Busch - RPI32 The input string is rejected by the PDA:
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
Fall 2005Costas Busch - RPI34 Another PDA example PDA :
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
Fall 2005Costas Busch - RPI36 Execution Example: Input Time 0 Stack
Fall 2005Costas Busch - RPI37 Input Time 1 Stack
Fall 2005Costas Busch - RPI38 Input Time 2 Stack
Fall 2005Costas Busch - RPI39 Input Time 3 Stack Guess the middle of string
Fall 2005Costas Busch - RPI40 Input Time 4 Stack
Fall 2005Costas Busch - RPI41 Input Time 5 Stack
Fall 2005Costas Busch - RPI42 Input Time 6 Stack accept
Fall 2005Costas Busch - RPI43 Rejection Example: Input Time 0 Stack
Fall 2005Costas Busch - RPI44 Input Time 1 Stack
Fall 2005Costas Busch - RPI45 Input Time 2 Stack
Fall 2005Costas Busch - RPI46 Input Time 3 Stack Guess the middle of string
Fall 2005Costas Busch - RPI47 Input Time 4 Stack
Fall 2005Costas Busch - RPI48 Input Time 5 Stack There is no possible transition. Input is not consumed
Fall 2005Costas Busch - RPI49 Another computation on same string: Input Time 0 Stack
Fall 2005Costas Busch - RPI50 Input Time 1 Stack
Fall 2005Costas Busch - RPI51 Input Time 2 Stack
Fall 2005Costas Busch - RPI52 Input Time 3 Stack
Fall 2005Costas Busch - RPI53 Input Time 4 Stack
Fall 2005Costas Busch - RPI54 Input Time 5 Stack No final state is reached
Fall 2005Costas Busch - RPI55 There is no computation that accepts string
Fall 2005Costas Busch - RPI56 Another PDA example PDA
Fall 2005Costas Busch - RPI57 Execution Example: Input Time 0 Stack
Fall 2005Costas Busch - RPI58 Input Time 1 Stack
Fall 2005Costas Busch - RPI59 Input Time 2 Stack
Fall 2005Costas Busch - RPI60 Input Time 3 Stack accept
Fall 2005Costas Busch - RPI61 Rejection example: Input Time 0 Stack
Fall 2005Costas Busch - RPI62 Input Time 1 Stack
Fall 2005Costas Busch - RPI63 Input Time 2 Stack
Fall 2005Costas Busch - RPI64 Input Time 3 Stack
Fall 2005Costas Busch - RPI65 Input Time 4 Stack Halt and Reject
Fall 2005Costas Busch - RPI66 Pushing Strings Input symbol Pop symbol Push string
Fall 2005Costas Busch - RPI67 top input stack Push pushed string Example:
Fall 2005Costas Busch - RPI68 Another PDA example PDA
Fall 2005Costas Busch - RPI69 Time 0 Input current state Stack Execution Example:
Fall 2005Costas Busch - RPI70 Time 1 Input Stack
Fall 2005Costas Busch - RPI71 Time 3 Input Stack
Fall 2005Costas Busch - RPI72 Time 4 Input Stack
Fall 2005Costas Busch - RPI73 Time 5 Input Stack
Fall 2005Costas Busch - RPI74 Time 6 Input Stack
Fall 2005Costas Busch - RPI75 Time 7 Input Stack
Fall 2005Costas Busch - RPI76 Time 8 Input Stack accept
Fall 2005Costas Busch - RPI77 Formalities for PDAs
Fall 2005Costas Busch - RPI78 Transition function:
Fall 2005Costas Busch - RPI79 Transition function:
Fall 2005Costas Busch - RPI80 Formal Definition Pushdown Automaton (PDA) States Input alphabet Stack alphabet Transition function Accept states Stack start symbol Initial state
Fall 2005Costas Busch - RPI81 Instantaneous Description Current state Remaining input Current stack contents
Fall 2005Costas Busch - RPI82 Input Stack Time 4: Example:Instantaneous Description
Fall 2005Costas Busch - RPI83 Input Stack Time 5: Example:Instantaneous Description
Fall 2005Costas Busch - RPI84 We write: Time 4 Time 5
Fall 2005Costas Busch - RPI85 A computation:
Fall 2005Costas Busch - RPI86 For convenience we write:
Fall 2005Costas Busch - RPI87 Formal Definition Language accepted by PDA : Initial state Accept state
Fall 2005Costas Busch - RPI88 Example: PDA :
Fall 2005Costas Busch - RPI89 PDA :
Fall 2005Costas Busch - RPI90 PDA : Therefore: