1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.

Slides:



Advertisements
Similar presentations
Chapter 5 Pushdown Automata
Advertisements

Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
Pushdown Automata CPSC 388 Ellen Walker Hiram College.
Pushdown Automata Part II: PDAs and CFG Chapter 12.
CFG => PDA Sipser 2 (pages ). CS 311 Fall Formally… A pushdown automaton is a sextuple M = (Q, Σ, Γ, δ, q 0, F), where – Q is a finite set.
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Courtesy Costas Busch - RPI1 Pushdown Automata PDAs.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
1 Converting NPDAs to Context-Free Grammars. 2 For any NPDA we will construct a context-free grammar with.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
Fall 2004COMP 3351 NPDA’s Accept Context-Free Languages.
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.
Fall 2006Costas Busch - RPI1 Pushdown Automata PDAs.
January 14, 2015CS21 Lecture 51 CS21 Decidability and Tractability Lecture 5 January 14, 2015.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
1 Context-Free Languages. 2 Regular Languages 3 Context-Free Languages.
Fall 2006Costas Busch - RPI1 PDAs Accept Context-Free Languages.
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
1 PDAs Accept Context-Free Languages. 2 Context-Free Languages (Grammars) Languages Accepted by PDAs Theorem:
CS 3240: Languages and Computation Pushdown Automata & CF Grammars NOTE: THESE ARE ONLY PARTIAL SLIDES RELATED TO WEEKS 9 AND 10. PLEASE REFER TO THE TEXTBOOK.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Push-down Automata Section 3.3 Fri, Oct 21, 2005.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 Mälardalen University 2010.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Formal Languages, Automata and Models of Computation
1 Pushdown Automata Definition Moves of the PDA Languages of the PDA Deterministic PDA’s.
Lecture 14 Push Down Automata (PDA) Topics:  Definition  Moves of the PDA  Languages of the PDA  Deterministic PDA’s June 18, 2015 CSCE 355 Foundations.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
1 Chapter Pushdown Automata. 2 Section 12.2 Pushdown Automata A pushdown automaton (PDA) is a finite automaton with a stack that has stack operations.
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 154 Formal Languages and Computability March 15 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
6. Pushdown Automata CIS Automata and Formal Languages – Pei Wang.
Formal Languages, Automata and Models of Computation
PDAs Accept Context-Free Languages
NPDAs Accept Context-Free Languages
Pushdown Automata (PDA). Part 2
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
PDAs Accept Context-Free Languages
Pushdown Automata PDAs
Chapter 7 PUSHDOWN AUTOMATA.
Pushdown Automata PDAs
NPDAs Accept Context-Free Languages
Principles of Computing – UFCFA3-30-1
CS322D Tutorials.
Pushdown automata a_introduction.htm.
Chapter 2 Context-Free Language - 01
Principles of Computing – UFCFA3-30-1
… NPDAs continued.
Pushdown automata The Chinese University of Hong Kong Fall 2011
Normal Forms for Context-free Grammars
Presentation transcript:

1 Pushdown Automata PDAs

2 Pushdown Automaton -- PDA Input String Stack States

3 Initial Stack Symbol Stack bottom special symbol

4 The States Input symbol Pop symbol Push symbol

5 top input stack

6 top input stack

7 top input stack

8 top input stack

9 Non-Determinism

10 NPDA: Non-Deterministic PDA Example:

11 Execution Example: Input current state Time 0 Stack

12 Input Time 1 Stack

13 Input Stack Time 2

14 Input Stack Time 3

15 Input Stack Time 4

16 Input Stack Time 5

17 Input Stack Time 6

18 Input Stack Time 7

19 Input Time 8 accept Stack

20 A string is accepted if: All the input is consumed The last state is a final state We do not care about the stack contents

21 The input string is accepted by the NPDA:

22 is the language accepted by the NPDA: In general,

23 Another NPDA example NPDA

24

25 Execution Example: Input Time 0 Stack

26 Input Time 1 Stack

27 Input Time 2 Stack

28 Input Time 3 Stack

29 Input Time 4 Stack

30 Input Time 5 Stack

31 Input Time 6 Stack accept

32 Pushing Strings Input symbol Pop symbol Push string

33 top input stack pushed string Example:

34 Another NPDA example NPDA

35

36 Execution: Time 0 Input current state Stack

37 Time 1 Input Stack

38 Time 3 Input Stack

39 Time 4 Input Stack

40 Time 5 Input Stack

41 Time 6 Input Stack

42 Time 7 Input Stack

43 Time 8 Input Stack accept

44 Formalities for NPDAs

45 Transition function:

46 Transition function:

47 Formal Definition Non-Deterministic Pushdown Automaton NPDA States Input alphabet Stack alphabet Transition function Final states Stack start symbol

48 Instantaneous Description Current state Remaining input Current stack contents

49 Input Stack Time 4: Example:Instantaneous Description

50 Input Stack Time 5: Example:Instantaneous Description

51 We write: (Time 4)(Time 5)

52 A computation:

53 For convenience we write:

54 Formal Definition Language of NPDA : Start state Final state

55 Example: NPDA : thus

56 NPDA : thus

57 NPDA : Therefore:

58 Converting Context-Free Grammars to NPDAs

59 An example grammar: What is the equivalent NPDA?

60 Grammar: NPDA:

61 The NPDA simulates leftmost derivations of the grammar L(grammar) = L(NPDA)

62 Grammar: A leftmost derivation:

63 NPDA execution: Input Stack Time 0 current state

64 Input Stack Time 1

65 Input Stack Time 2

66 Input Stack Time 3

67 Input Stack Time 4

68 Input Stack Time 5

69 Input Stack Time 6

70 Input Stack Time 7

71 Input Stack Time 8

72 Input Stack Time 9

73 Input Stack Time 10 accept

74 In general: Given any grammar We can construct a NPDA With

75 Constructing NPDA from grammar : For any production For any terminal

76 Grammar generates string if and only if NPDA accepts

77 Therefore: For any context-free language there is an NPDA that accepts the same language