Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Advertisements

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Chapter 5 Pushdown Automata
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
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,
CFGs and PDAs Sipser 2 (pages ). Long long ago…
CS21 Decidability and Tractability
PDAs => CFGs Sipser 2.2 (pages ). Last time…
CFGs and PDAs Sipser 2 (pages ). Last time…
PDAs => CFGs Sipser 2.2 (pages ). Last time…
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
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.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Applied Computer Science II Chapter 2 : Context-free languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany.
CS 310 – Fall 2006 Pacific University CS310 Pushdown Automata Sections: 2.2 page 109 October 11, 2006.
Chap 2 Context-Free Languages. Context-free Grammars is not regular Context-free grammar : eg. G 1 : A  0A1substitution rules A  Bproduction rules B.
CS 310 – Fall 2006 Pacific University CS310 Pushdown Automata Sections: 2.2 page 109 October 9, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2009 with acknowledgement.
January 14, 2015CS21 Lecture 51 CS21 Decidability and Tractability Lecture 5 January 14, 2015.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
January 15, 2014CS21 Lecture 61 CS21 Decidability and Tractability Lecture 6 January 16, 2015.
1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
نظریه زبان ها و ماشین ها فصل دوم Context-Free Languages دانشگاه صنعتی شریف بهار 88.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Context-free Languages
Push-down Automata Section 3.3 Fri, Oct 21, 2005.
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Equivalence of Pushdown Automata and Context-Free Grammar Prof. Héctor Muñoz-Avila.
Pushdown Accepters & Context-Free Grammars Sipser, Theorem 2.12 Denning, Chapter 8.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
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 2670 Introduction to Theory of Computing September 23, 2004.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Formal Languages, Automata and Models of Computation
Lecture 14UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 14.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
Theory of Computation Automata Theory Dr. Ayman Srour.
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
CSCI 2670 Introduction to Theory of Computing September 22, 2004.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
6. Pushdown Automata CIS Automata and Formal Languages – Pei Wang.
Formal Languages, Automata and Models of Computation
CSE 105 theory of computation
Context-Free Languages
Chapter 2 Context-Free Language - 01
CSE 105 theory of computation
Principles of Computing – UFCFA3-30-1
… NPDAs continued.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Pushdown automata The Chinese University of Hong Kong Fall 2011
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Introduction to the Theory of Computation John Paxton Montana State University Summer 2003

Humor A little boy, who wanted $ very badly, prayed for two weeks but nothing happened. Then he decided to write GOD a letter requesting $ When the postal authorities received the letter to GOD, U.S.A., they decided to send it to the President. The President was so impressed, touched, and amused that he instructed his secretary to send the boy $ Mr. President thought that this would appear to be a lot of money to the little boy. The little boy was delighted with the $50.00 and immediately sat down to write a thank you note to GOD that read: "Dear God, Thank you very much for sending me the money. However, I noticed that for some reason you had to send it through Washington, D.C., and, as usual, those devil's took half of it.

2.2 Pushdown Automata Fundamentally, an NFA with a stack A recognizer Equivalent to a Context Free Grammar A CFG is a generator

PDA Definition A PDA is a 6-tuple (Q, , Γ, ,q 0, F) where 1.Q is the set of states  is the input alphabet 3.Γ is the stack alphabet  : Q x   x Γ   P(Q x Γ  ) is transition 5.q 0 is the start state 6.F ≤ Q is the set of accept states

Acceptance A pushdown automaton M accepts input w if w can be written w 1 w 2 …w m where each w i    and states r 0,r 1,…r m  Q and strings s 0, s 1, … s m  Γ* exist that satisfy 1.r 0 = q 0 and s 0 =  2.(r i+1, b)   (r i, w i+1, a) where s i = at and s i+1 = bt 3.r m  F

Example 1 Q = {q 1, q 2, q 3, q 4 } S = {0, 1} F = {0, $} F = {q 1, q 4 } d(q 1, ,  ) = (q 2, $) d(q 2, 0,  ) = (q 2, 0) d(q 2, 1, 0) = (q 3,  ) d(q 3, 1, 0) = (q 3,  ) d(q 3, , $) = (q 4,  )

Example 1 q1q1 q2q2 q3q3 q4q4 ,  -> $ 0,  -> 0 1, 0 ->  , $ -> 

Exercise Show a PDA that recognizes the language {a i b j c k | i, j, k >= 0 and i = j or j = k}. Draw a picture. Show it formally, (Q, , Γ, ,q 0, F).

Exercise Show a PDA that recognizes the language { ww R | w  {0,1}* Draw a picture. Show it formally.

Theorem: PDAs and CFGs are equivalent Part 1: If a language is context free, then some pushdown automaton recognizes it. Part 2: If a pushdown automaton recognizes some language, then it is context free.

Part 1 q start q loop q accept ,  -> S$ , $ ->  , A -> w (for rule A -> w) a, a ->  (for terminal a)

Part 1 What about a rule such as A -> aBc? q loop ,A -> c ,  -> B ,  -> a

Exercise Construct a PDA that is equivalent to the following CFG S -> aTb | b T -> Ta | 

Part 2 Construct the PDA such that 1.It has a single accept state q accept 2.It empties its stack before accepting 3.Each transition either pushes a symbol onto the stack (a push move) or pops one off the stack (a pop move), but does not do both at the same time.

Construction The start variable is q 0 q accept The variables are q i q j if  (p, a,  ) contains (r, t) and  (s, b, t) contains (q,  ), then add q p q q -> aq rs b add q pq -> q pr q rq for all p, q, r add q pp ->  for all p

Example 1, revisited q1q1 q2q2 q3q3 q4q4 ,  -> $ 0,  -> 0 1, 0 ->  , $ -> 

Example 1, CFG q 11 -> , q 22 -> , etc. q 11 -> q 11 q 11 | q 12 q 21 | q 13 q 31 | q 14 q 41 q 14 ->  q 23  q 23 -> 0q 23 1 Example derivation: q 14 -> q 23 -> 0q > 00q > 0011

Corollary Every regular language is context free regular languages context-free languages