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.

Slides:



Advertisements
Similar presentations
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
Advertisements

Pushdown Automata CPSC 388 Ellen Walker Hiram College.
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,
Pushdown Automata Chapter 12. Recognizing Context-Free Languages We need a device similar to an FSM except that it needs more power. The insight: Precisely.
CFGs and PDAs Sipser 2 (pages ). Long long ago…
Pushdown Automata Part II: PDAs and CFG Chapter 12.
CS21 Decidability and Tractability
CFGs and PDAs Sipser 2 (pages ). Last time…
CFG => PDA Sipser 2 (pages ).
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.
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.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
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.
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.
1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
1 PDAs Accept Context-Free Languages. 2 Context-Free Languages (Grammars) Languages Accepted by PDAs Theorem:
Finite State Machines Data Structures and Algorithms for Information Processing 1.
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.
Problem of the DAY Create a regular context-free grammar that generates L= {w  {a,b}* : the number of a’s in w is not divisible by 3} Hint: start by designing.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
CSCI 2670 Introduction to Theory of Computing September 20, 2005.
Pushdown Automata (PDAs)
Design contex-free grammars that generate: L 1 = { u v : u ∈ {a,b}*, v ∈ {a, c}*, and |u| ≤ |v| ≤ 3 |u| }. L 2 = { a p b q c p a r b 2r : p, q, r ≥ 0 }
1 For each language, give a regular expression that generates the language and a DFA that accepts it. L 1 = { w  {0, 1}* : has both 00 and 11 as substrings}
Pushdown Automata Part I: PDAs Chapter Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2)
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.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
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.
1 For each language, give a DFA that accepts it. L 1 = { w  {a, b}* : w at most 2 a’s} L 2 = { w  {0, 1}* : has both 00 and 11 as substrings} L 3 = {
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Formal Languages, Automata and Models of Computation
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
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.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
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,
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Theory of Languages and Automata By: Mojtaba Khezrian.
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
Pushdown Automata - like NFA-  but also has a stack - transition takes the current state, the current input symbol, and the top-of-the-stack symbol (which.
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
L1= { w  {a,b}* : w consists of all strings that begin with an even number of a's followed by an odd number of b's. } L2= { w  {a,b}* : the number of.
Pushdown Automata PDAs
Push-down Automata Section 3.3 Wed, Oct 27, 2004.
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
AUTOMATA THEORY VI.
CSE322 Definition and description of finite Automata
… NPDAs continued.
Pushdown automata The Chinese University of Hong Kong Fall 2011
More About Nondeterminism
Normal Forms for Context-free Grammars
Presentation transcript:

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 tree u, v, x, y, z as per the pumping theorem. 3. Prove that the language for this question is an infinite language.

Announcements Assignment #3: Due Wed. Oct. 20. Our midterm is Friday October 22 in class. Midterm tutorial: Tues. Oct. 19, 5pm-8pm, ECS 116. The preliminary final exam schedule has been posted.

L= { a n b p : n ≤ p ≤ 3n, n,p ≥0} Start symbol S. S → a S b S → ε S → a S bb S → a S bbb This works because any integer p can be expressed as: p= r + 2 (n – r) when n ≤ p ≤ 2n, and p= 2r + 3 (n - r) when 2n ≤ p ≤ 3n.

Pushdown Automata Picture from: Torsten Schaßan

Pushdown Automata: A pushdown automaton is like a NDFA which has a stack. Every context-free language has a pushdown automaton that accepts it. This lecture starts with some examples, gives the formal definition, then investigates PDA’s further.

Stacks

Stack Data Structure: permits push and pop at the top of the stack.

L= { w c w R : w  {a, b}* } StateInputPopNext state Push saεsA sbεsB scεtε taAtε tbBtε Start state: s, Final State: {t}

To accept, there must exist a computation which: 1.Starts in the start state with an empty stack. 2. Applies transitions of the PDA which are applicable at each step. 3. Consumes all the input. 4. Terminates in a final state with an empty stack.

B B A w = a b b c b b a BBA (s, abbcbba, ε) ├* (s, cbba, BBA)├ (t, bba, BBA) ├* (t, ε, ε) Stack is knocked over like this:

A pushdown automaton is a sextuple M= (K, Σ, Γ, Δ, s, F) where K is a finite set of states, Σ is an alphabet (the input symbols) Γ is an alphabet (the stack symbols) Δ, the transition relation, is a finite subset of ( K x (Σ ⋃ { ε}) x Γ*) x (K x Γ*) state input pop next state push

A configuration of a PDA is a member of K x Σ* x Γ* current state input remaining stack A configuration (q, σ w, α x) ├ (r, w, βx) if ((q, σ, α ), (r, β))  Δ. For M= (K, Σ, Γ, Δ, s, F), L(M) (the language accepted by M) = { w  Σ* : (s, w, ε) ├ * (f, ε, ε) for some final state f in F}.

To accept, there must exist a computation which: 1.Starts in the start state with an empty stack. 2. Applies transitions of the PDA which are applicable at each step. 3. Consumes all the input. 4. Terminates in a final state with an empty stack. L(M)= { w  Σ* : (s, w, ε) ├ * (f, ε, ε) for some final state f in F}.

L= { w w R : w  {a, b}* } StateInputPopNext state Push saεsA sbεsB sεεtε taAtε tbBtε Start state: s, Final State: {t} PDA’s are non-deterministic: Guessing wrong time to switch from s to t gives non-accepting computations.

StateInputPop Next state Push saεsB saAsε sbεsA sbBsε L= {w in {a, b}* : w has the same number of a’s and b’s} Start state: s Final states: {s}

StateInputPopNext state Push sεεtX taXtBX taAtε taBtBB tbXtAX tbAtAA tbBtε tεXfε L= {w in {a, b}* : w has the same number of a’s and b’s} State state: s, Final states: {f} A more deterministic solution: Stack will never contain both A’s and B’s. X- bottom of stack marker.