CSC 311 Theory of Computation

Similar documents
Deterministic Finite Automata

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

Let's start with an example:

Formal languages, automata, and theory of computation

Normal Forms for Context-free Grammars

First Midterm Examination

First Midterm Examination

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

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

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

Revision Sheet. (a) Give a regular expression for each of the following languages:

CS375: Logic and Theory of Computing

FABER Formal Languages, Automata and Models of Computation

Languages & Automata

Formal Language and Automata Theory (CS21004)

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

Harvard University Computer Science 121 Midterm October 23, 2012

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

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

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

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

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

Some Theory of Computation Exercises Week 1

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

Nondeterminism and Nodeterministic Automata

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

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

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

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

CISC 4090 Theory of Computation

Formal Languages Simplifications of CFGs

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1.4 Nonregular Languages

Context-Free Grammars and Languages

Theory of Computation Regular Languages

Non-deterministic Finite Automata

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Lecture 08: Feb. 08, 2019

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Designing finite automata II

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Worked out examples Finite Automata

Fundamentals of Computer Science

Java II Finite Automata I

CHAPTER 1 Regular Languages. Contents

Lexical Analysis Finite Automate

Nondeterministic Automata vs Deterministic Automata

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

Homework 3 Solutions

Minimal DFA. minimal DFA for L starting from any other

Finite-State Automata: Recap

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 330 Formal Methods and Models

Lexical Analysis Part III

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

input tape head moves current state

Lecture 6 Regular Grammars

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

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

Formal Languages and Automata

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

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

Closure Properties of Regular Languages

Myhill-Nerode Theorem

Convert the NFA into DFA

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

Thoery of Automata CS402

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

NFAs continued, Closure Properties of Regular Languages

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

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

Midterm 1 Practice. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

CMSC 330: Organization of Programming Languages

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

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

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

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

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

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

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

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

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Non-Deterministic Finite Automata

Tutorial Automata and formal Languages

1 Nondeterministic Finite Automata

1 From NFA to regular expression

Today s Topics Automata and Languages

Automata and Languages

Chapter 2 Finite Automata

Review for the Midterm

Finite Automata-cont d

Name Ima Sample ASU ID

Non-deterministic Finite Automata

Prefix-Free Regular-Expression Matching

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

CS375: Logic and Theory of Computing

CS 330 Formal Methods and Models

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

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

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Transcription:

CSC 11 Theory of Computtion Tutoril on DFAs, NFAs, regulr expressions, regulr grmmr, closure of regulr lnguges, context-free grmmrs, non-deterministic push-down utomt, Turing mchines,etc. Tutoril 2 Second Semester 2017 Assume tht Σ = {,} when it is not otherwise given. 1. Given the regulr expression ( ) *, the corresponding NFA is given on the right. Rewrite this NFA into its corresponding DFA.ShowtheresultingDFAothstrnsition tle nd s trnsition digrm., ε q q 4 q 5 2. Given the NFA N with L(N) = {w Σ w strts with }, s the regulr expression (+) *, first confirm tht its NFA is s shown on the right, then derive its corresponding DFA. Show the resulting DFA oth s trnsition tle nd s trnsition digrm.. L(N) = {w Σ w hs s its 2nd letter} is the lnguge of the NFA N. Write its corresponding regulr expression. First confirmthtitsnfaissshownontherightthenderiveitscorresponding DFA. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. 4. Consider NFA N digrmmed on the right. Descrie L(N) = {w Σ w...}. Derive its corresponding DFA nd write the resulting DFA oth s trnsition tle nd s trnsition digrm.,, q q, ε ε q 5. Give regulr expression for this NFA given s trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. 6. Minimize the DFA given y this trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. q q 4 7. Rewrite the NFA given y the trnsition grph s DFA, nd then minimize the DFA. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. 1 q 5, ε 2, ε 4

8. Minimize the DFA given y the trnsition grph (Grcí et l., 2011). Show the resulting DFA oth s trnsition tle nd s trnsition digrm. 9. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. 10. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Hopcroft et l., 2001, Pge 155). 11. Minimize the DFA given y the trnsition tle. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Hopcroft et l., 2001, Pge 164). 12. Minimize the DFA given y the trnsition tle. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Hopcroft et l., 2001, Pge 165). 1. Minimize the DFA given y the trnsition tle. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Hopcroft et l., 2001, Pge 165). 14. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Vlmri, 2010). Note tht ll the missing trnsitions led to ded or sink stte, which is not shown in the stte digrm. 4 2 1 5 7 9 10 6 8, 1 4 2 q q 4 q 5 q 6 q 7 0 1 0 1 0 2 1 * 0 4 5 5 6 4 6 5 6 7 6 1 2 5 2 6 * 4 8 4 5 8 5 6 9 6 7 2 7 8 2 8 9 *9 1 5 0 1 4 1 2 5 2 7 * 4 7 4 5 8 5 6 1 6 7 1 7 8 2 8 0 4 q q 4 q 5

15. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm (Hopcroft et l., 2001, Pge 158). q 16. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm., 17. Minimize the DFA given y the trnsition grph. Show the resulting DFA oth s trnsition tle nd s trnsition digrm. q q 4 q 5 q 6, 18. Show tht the sentence Jim trins rt students hs derivtion in the following grmmr. Give prse tree for the sentence. S NV P N NN V P VN N students Jim rt trins V trins 19. Let G e the following grmmr S AB BC A BA B CC C AB Use the CYK lgorithm to determine whether w = is in L(G). Give prse tree for w, nd its rightmost derivtion from S

20. Given the grmmr G with strt symol E in CNF use the CYK lgorithm to determine whether w = (x + x) * x is in G. E is the strt vrile. E EF LR x F ME CE G EQ P + T * L ( R ) 21. Given the grmmr G with strt symol S in CNF use the CYK lgorithm to determine whether w = is in L(G). S AT AU ε T UB U AT UT A B 22. Show the CYK lgorithm for the CNF grmmr G with strt symol S y showing tht w = is or is not in L(G). S AB BC A BA B CC C AB 2. Wht is the lnguge L tht is derived from S where S AB A A B AB? 24. Write python code to red in the specifictions for n NFA or DFA nd then turns it into DFA if it is not lredy one. Your specifictions should give the NFA/DFA in the form of stte tle with numericlly numered sttes nd single chrcters s the lphet. Use python s sets, dictionry nd regulr expression pckge re. 25. Write python code which which minimizes your DFA.

26. Write python code to turn context-free grmmr into Chomsky-norml form if it is not yet in tht form. 27. Write python code to implement the CYK lgorithm, given grmmr in Chomsky norml form. It should red grmmr nd run CYK to determine if some strings re ccepted or rejected. 28. Develop code to implement PDA from specifictions, nd use it to show tht the PDA ccepts the plindromes lnguge. 29. Develop code to implement Turing mchine from specifictions, nd use it to show tht the TM ccepts the lnguge n n c n. Fuller specifictions for the coding prolems cn e given on request. References Grcí, P., López, D., nd Vázquez de Prg, M. 2011. DFA minimiztion: from Brzozowski to Hopcroft. Unknown, p. Unknown. Hopcroft, J. E., Motwni, R., nd Ullmn, J. 2001. Introduction to Automt Theory, Lnguges nd Computtion. Addison-Wesley, 2nd edn. Vlmri, A. 2010. O(m log n) time lgoritms for DFA minimiztion nd more. In Lecture Slides.