courtesy costas busch - rpi1 pushdown automata pdas

Download Courtesy Costas Busch - RPI1 Pushdown Automata PDAs

Post on 19-Dec-2015

215 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

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