fall 2005costas busch - rpi1 pushdown automata pdas

Download Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs

Post on 22-Dec-2015

216 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

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