Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pushdown Automata PDAs

Similar presentations


Presentation on theme: "Pushdown Automata PDAs"— Presentation transcript:

1 Pushdown Automata PDAs
2nd 2017 Lecture 8

2 Pushdown Automaton -- PDA
Input String Stack States 2nd 2017 Lecture 8

3 Initial Stack Symbol Stack Stack stack head top bottom special symbol
Appears at time 0 2nd 2017 Lecture 8

4 The States Pop symbol Input symbol Push symbol 2nd 2017 Lecture 8

5 input stack top Replace 2nd 2017 Lecture 8

6 input stack top Push 2nd 2017 Lecture 8

7 input stack top Pop 2nd 2017 Lecture 8

8 input stack top No Change 2nd 2017 Lecture 8

9 If the automaton attempts to pop from
Pop from Empty Stack input Pop Automaton halts! stack top If the automaton attempts to pop from empty stack then it halts and rejects input 2nd 2017 Lecture 8

10 PDAs are non-deterministic
Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions 2nd 2017 Lecture 8

11 Example PDA PDA : 2nd 2017 Lecture 8

12 Basic Idea: Push the a’s 2. Match the b’s on input on the stack
with a’s on stack 3. Match found 2nd 2017 Lecture 8

13 Execution Example: Time 0 Input Stack current state 2nd 2017 Lecture 8

14 Time 1 Input Stack 2nd 2017 Lecture 8

15 Time 2 Input Stack 2nd 2017 Lecture 8

16 Time 3 Input Stack 2nd 2017 Lecture 8

17 Time 4 Input Stack 2nd 2017 Lecture 8

18 Time 5 Input Stack 2nd 2017 Lecture 8

19 Time 6 Input Stack 2nd 2017 Lecture 8

20 Time 7 Input Stack 2nd 2017 Lecture 8

21 Time 8 Input Stack accept 2nd 2017 Lecture 8

22 A string is accepted if there is a computation such that:
All the input is consumed AND The last state is an accepting state we do not care about the stack contents at the end of the accepting computation 2nd 2017 Lecture 8

23 Rejection Example: Time 0 Input Stack current state 2nd 2017 Lecture 8

24 Rejection Example: Time 1 Input Stack current state 2nd 2017 Lecture 8

25 Rejection Example: Time 2 Input Stack current state 2nd 2017 Lecture 8

26 Rejection Example: Time 3 Input Stack current state 2nd 2017 Lecture 8

27 Rejection Example: Time 4 Input Stack current state 2nd 2017 Lecture 8

28 reject Rejection Example: Time 4 Input Stack current state 2nd 2017
Lecture 8

29 There is no accepting computation for
The string is rejected by the PDA 2nd 2017 Lecture 8

30 Another PDA example PDA : 2nd 2017 Lecture 8

31 Basic Idea: Push v on stack 3. Match on input with v on stack 2. Guess
middle of input 4. Match found 2nd 2017 Lecture 8

32 Execution Example: Time 0 Input Stack 2nd 2017 Lecture 8

33 Time 1 Input Stack 2nd 2017 Lecture 8

34 Time 2 Input Stack 2nd 2017 Lecture 8

35 Time 3 Input Guess the middle of string Stack 2nd 2017 Lecture 8

36 Time 4 Input Stack 2nd 2017 Lecture 8

37 Time 5 Input Stack 2nd 2017 Lecture 8

38 Time 6 Input Stack accept 2nd 2017 Lecture 8

39 Rejection Example: Time 0 Input Stack 2nd 2017 Lecture 8

40 Time 1 Input Stack 2nd 2017 Lecture 8

41 Time 2 Input Stack 2nd 2017 Lecture 8

42 Time 3 Input Guess the middle of string Stack 2nd 2017 Lecture 8

43 Time 4 Input Stack 2nd 2017 Lecture 8

44 There is no possible transition. Input
Time 5 There is no possible transition. Input Input is not consumed Stack 2nd 2017 Lecture 8

45 Another computation on same string:
Input Time 0 Stack 2nd 2017 Lecture 8

46 Time 1 Input Stack 2nd 2017 Lecture 8

47 Time 2 Input Stack 2nd 2017 Lecture 8

48 Time 3 Input Stack 2nd 2017 Lecture 8

49 Time 4 Input Stack 2nd 2017 Lecture 8

50 Time 5 Input No accept state is reached Stack 2nd 2017 Lecture 8

51 There is no computation that accepts string
2nd 2017 Lecture 8

52 Pushing & Popping Strings
Input symbol Push string 2nd 2017 Lecture 8

53 Example: input stack top push string top pop string Replace 2nd 2017
Lecture 8

54 Equivalent transitions pop push 2nd 2017 Lecture 8

55 Another PDA example PDA 2nd 2017 Lecture 8

56 Execution Example: Time 0 Input Stack current state 2nd 2017 Lecture 8

57 Time 1 Input Stack 2nd 2017 Lecture 8

58 Time 3 Input Stack 2nd 2017 Lecture 8

59 Time 4 Input Stack 2nd 2017 Lecture 8

60 Time 5 Input Stack 2nd 2017 Lecture 8

61 Time 6 Input Stack 2nd 2017 Lecture 8

62 Time 7 Input Stack 2nd 2017 Lecture 8

63 Time 8 Input Stack accept 2nd 2017 Lecture 8

64 Formalities for PDAs 2nd 2017 Lecture 8

65 Transition function: 2nd 2017 Lecture 8

66 Transition function: 2nd 2017 Lecture 8

67 Formal Definition Pushdown Automaton (PDA) Accept states States Input
alphabet Stack start symbol Transition function Initial state Stack alphabet 2nd 2017 Lecture 8

68 Instantaneous Description
Current state Current stack contents Remaining input 2nd 2017 Lecture 8

69 Instantaneous Description
Example: Instantaneous Description Input Time 4: Stack 2nd 2017 Lecture 8

70 Instantaneous Description
Example: Instantaneous Description Input Time 5: Stack 2nd 2017 Lecture 8

71 We write: Time 4 Time 5 2nd 2017 Lecture 8

72 A computation: 2nd 2017 Lecture 8

73 For convenience we write:
2nd 2017 Lecture 8

74 Language of PDA Language accepted by PDA : Initial state Accept state
2nd 2017 Lecture 8

75 Example: PDA : 2nd 2017 Lecture 8

76 PDA : 2nd 2017 Lecture 8

77 Therefore: PDA : 2nd 2017 Lecture 8


Download ppt "Pushdown Automata PDAs"

Similar presentations


Ads by Google