a b b a pop push read unread

Similar documents
Normal Forms for Context-free Grammars

Lecture 6 Regular Grammars

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

CS 275 Automata and Formal Language Theory

1.4 Nonregular Languages

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

Let's start with an example:

Non-deterministic Finite Automata

Non-Deterministic Finite Automata

Formal languages, automata, and theory of computation

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

This lecture covers Chapter 8 of HMU: Properties of CFLs

1.3 Regular Expressions

CS 314 Principles of Programming Languages

Deterministic Finite-State Automata

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Automata and Languages

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Convert the NFA into DFA

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS375: Logic and Theory of Computing

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

In-depth introduction to main models, concepts of theory of computation:

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Worked out examples Finite Automata

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Non-deterministic Finite Automata

Regular expressions, Finite Automata, transition graphs are all the same!!

Context-Free Grammars and Languages

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Java II Finite Automata I

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Minimal DFA. minimal DFA for L starting from any other

CHAPTER 1 Regular Languages. Contents

Closure Properties of Regular Languages

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

CSC 473 Automata, Grammars & Languages 11/9/10

Lecture 08: Feb. 08, 2019

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Lexical Analysis Part III

Finite Automata-cont d

CS 330 Formal Methods and Models

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Agenda. Agenda. Regular Expressions. Examples of Regular Expressions. Regular Expressions (crash course) Computational Linguistics 1

Turing Machines Part One

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

More general families of infinite graphs

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

I. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CMSC 330: Organization of Programming Languages

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Lecture 09: Myhill-Nerode Theorem

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Nondeterminism and Nodeterministic Automata

FABER Formal Languages, Automata and Models of Computation

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

7 Automata and formal languages. 7.1 Formal languages

More on automata. Michael George. March 24 April 7, 2014

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

3 Regular expressions

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

Turing Machines Part One

Finite-State Automata: Recap

Chapter 2 Finite Automata

CS 275 Automata and Formal Language Theory

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Recursively Enumerable and Recursive. Languages

CS 275 Automata and Formal Language Theory

Hybrid Control and Switched Systems. Lecture #2 How to describe a hybrid system? Formal models for hybrid system

First Midterm Examination

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

Thoery of Automata CS402

NFAs continued, Closure Properties of Regular Languages

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Overview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.

Some Theory of Computation Exercises Week 1

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

CSC 311 Theory of Computation

Formal Languages Simplifications of CFGs

CS 330 Formal Methods and Models

Designing finite automata II

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

Formal Languages and Automata

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

NFAs continued, Closure Properties of Regular Languages

Transcription:

A Finite Automton A Pushdown Automton 0000 000 red unred b b pop red unred push 2 An Exmple A Pushdown Automton Recll tht 0 n n not regulr. cn push symbols onto the stck cn pop them (red them bck) lter stck is potentilly unbounded Consider the following PDA: red input symbols for ech 0, push it on the stck s soon s is seen, pop 0 for ech red ccept if stck empty when lst symbol red. reject if stck non-empty, if input symbol exist, if 0 red fter, etc. 3 4

Forml Denition Non-Determinism PDA my be non-deterministic. PDA must be non-deterministic. Unlike nite utomt, non-determinism dds power. Use dierent lphbet for inputs nd for stck ;. rnsition function looks dierent. From: current stte: Q next input, if ny: " stck symbol symbol popped, if ny: ; " o: new stte: Q stck symbol pushed, if ny: ; " non-determinism: P() : Q " ; "!P(Q ; " ) 5 6 Forml Denitions Conventions A pushdown utomton (PDA) is 6-tuple (Q ; 0 F), where Q is nite set clled the sttes, is nite set clled the input lphbet, ; is nite set clled the stck lphbet, : Q " ; "!P(Q) is the trnsition function, 0 2 Q is the strt stte, nd F Q is the set of ccept sttes. Question: When is the stck empty? strt by pushing $ onto stck if you see it gin, stck is empty. When is input string exhusted? doesn't mtter ccepting stte ccepts only if inputs exhusted! 7 8

Exmple Nottion rnsition he PDA $ 2 0, $ mens red from input pop b from stck push c onto stck b! c Mening of " trnsitions: if = ", don't red inputs if b = ", don't pop ny symbols if c = ", don't push ny symbols ccepts 4,0,$ 3,0 f0 n n jn g : 9 0 Another Exmple Another Exmple A PDA tht ccepts n o i b j c k ji j k > 0 nd i = j or i = k Informlly: red nd push 's either pop nd mtch with b's or else pop nd mtch with c's non-deterministic choice! Note: non-determinism essentil here! $ b, c,,$ 3 4 2 5 0 7, b, c, A PDA tht ccepts n o i b j c k ji j k > 0 nd i = j or i = k Unlike nite utomt, non-determinism dds power 2

Yet Another Exmple Yet Another Exmple his PDA $ 2 0, 0, A plindrome hs the form ww R. \Mdm I'm Adm" \Dennis nd Edn sinned" \Red rum, sir, is murder" \In girum imus nocte et consumimur igni" 4, $ 3 0,0, ccepts binry plindromes. 3 4 If Prt heorem heorem: A lnguge is context free if nd only if some pushdown utomton ccepts it. his time, both the \if" prt nd the \only if" prt re interesting. heorem: If lnguge is context free, then some pushdown utomton ccepts it. Let A be context-free lnguge. We know A hs context-free grmmr G. on input w, the PDA P gures out if there is derivtion of w using G. Question: How does P gure out which substitution to mke? Answer: It guesses. 5 6

Where do we keep the intermedite string? Informlly: P pushes strt vrible S on stck keeps mking substitutions when only terminls remin... tests whether derived string euls input red 000 unred A A 0 $ pop push intermedite string: 0AA0 cn't put it ll on the stck only symbols strting with rst vrible on stck 7 8 Need shorthnd to push entire string onto stck. Informl description: push S$ on stck if top of stck is vrible A, non-deterministiclly select rule nd substitute. if top of stck is terminl red next input nd compre. If they dier, reject. if top of stck is $, enter ccept stte. (Relly ccepts only if input hs ll been red!). (r w) 2 ( s) Esy to do by introducing intermedite sttes.,s z,s xyz r r x y 9 20

rnsition Function Initilize stck ( " ")=f` S$g op of stck is vrible (` " A)=f(` w)j where A! w is rule g Sttes of P re strt stte ccept stte loop stte ` E sttes needed for shorthnd op of stck is terminl (` )=f(` ")g End of Stck (` " $) = f( ")g 2 22 rnsition Function Exmple S$ S! bjb! j" l,a, w Initiliztion: S$,$ l 23 24

Exmple Exmple S! bjb! j" S! bjb! j" Rules for S Rules for S$ S$ l, l, 25 26 Exmple Exmple S! bjb! j" S! bjb! j" Rules for terminls ermintion: S$, l bb, S$, bb l, $, 27 28