Name Ima Sample ASU ID

Similar documents
Harvard University Computer Science 121 Midterm October 23, 2012

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

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

First Midterm Examination

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.

Lecture 08: Feb. 08, 2019

Finite Automata-cont d

First Midterm Examination

Homework 3 Solutions

CHAPTER 1 Regular Languages. Contents

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

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

1 Nondeterministic Finite Automata

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

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

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Homework Solution - Set 5 Due: Friday 10/03/08

Theory of Computation Regular Languages

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

Some Theory of Computation Exercises Week 1

1 From NFA to regular expression

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.

Convert the NFA into DFA

Let's start with an example:

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

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

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

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

Minimal DFA. minimal DFA for L starting from any other

Formal languages, automata, and theory of computation

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.

Finite-State Automata: Recap

Fundamentals of Computer Science

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

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

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

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

NFAs continued, Closure Properties of Regular Languages

CS 330 Formal Methods and Models

Designing finite automata II

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

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

Nondeterminism and Nodeterministic Automata

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

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

3 Regular expressions

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

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

Worked out examples Finite Automata

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

Deterministic Finite Automata

Lecture 09: Myhill-Nerode Theorem

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

CSE396 Prelim I Answer Key Spring 2017

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Languages & Automata

MATH 573 FINAL EXAM. May 30, 2007

Formal Languages and Automata

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

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

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

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

Finite Automata Part Three

CS375: Logic and Theory of Computing

Bases for Vector Spaces

Java II Finite Automata I

CISC 4090 Theory of Computation

CMSC 330: Organization of Programming Languages

Parse trees, ambiguity, and Chomsky normal form

CS 330 Formal Methods and Models

Spring 2017 Exam 1 MARK BOX HAND IN PART PIN: 17

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

Closure Properties of Regular 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

Today s Topics Automata and Languages

Automata and Languages

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

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

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

State Minimization for DFAs

1.4 Nonregular Languages

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

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

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

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

Thoery of Automata CS402

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

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

Non-deterministic Finite Automata

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

GNFA GNFA GNFA GNFA GNFA

Fall 2017 Exam 1 MARK BOX HAND IN PART PIN: 17

SWEN 224 Formal Foundations of Programming WITH ANSWERS

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

Tutorial Automata and formal Languages

Transcription:

Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to the instructor with short note indicting wht you elieve to e the error. Other thn for tht reson, test grdes re lmost never chnged. If you elieve tht you did not receive the proper credit, first red these smple solutions crefully to see if you cn understnd the nswer to your concern. If tht does not resolve it, write cler explntion of why you elieve the grde is in error nd sumit tht, long with the entire test pper, to the instructor. Plese do not discuss in your explntion how your solution is like tht of nother student, s FERPA legisltion mkes it impossile for me to discuss one student s work with nother. Plese tke into ccount tht more thn 350 ppers were grded, nd it is uite unfir to chnge the grde on one pper without giving every other student the sme opportunity. If you nevertheless wnt the pper regrded, e dvised tht the entire pper will e regrded nd the grde my go up, sty the sme, or go down. The new grde will e finl. It is violtion of the Acdemic Integrity Policy to reuest grde chnge simply ecuse you need or wnt higher grde. If you reuire clrifiction of the smple solutions (not grde chnge or review s discussed ove), sk in recittions, or in office hours of the TA or instructor. You will e sked whether you hve red the smple solution nd to indicte wht precisely is uncler to you out it, so red these smple solutions crefully first. Note tht under no circumstnces cn nyone chnge grde other thn the instructor, so do not sk the TAs to do so they re not le to. Grde chnge reuests, whether sumitted s descried ove or not, will not e considered if received fter 26 Octoer 2016. Instructions Do not open the exm until you re instructed to do so. The exm will e sumitted in THREE pieces: Multiple Choice Questions, Answers to Multiple Choice, nd Long Answer. You must write your nme nd student numer on ech nd every sheet indicted; filure to do so my result in your test not eing properly grded. Write legily we must e le to red your nme nd numer. You must turn in ll sheets including the multiple choice uestions. You hve 50 minutes to complete the exm. No ooks, notes, electronic devices, or other ids re permitted. Turn off ll wireless devices nd plce them wy from your work spce. Write ll nswers on the exmintion pper itself. BUDGET YOUR TIME WELL! SHOW ALL WORK! 1

Nme: Im Smple Multiple Choice 1 Student Numer: 2468024680 Some Generl Comments 1. As stted in clss, ppers written in pencil re not eligile for regrding. 2. Some students continued to write fter it ws nnounced tht the time is over. This is n cdemic integrity violtion nd my result in your receiving no credit for your test. 3. We noticed group of students discussing the test fter the time ws over ut efore they hnded in their tests. This is n cdemic integrity violtion. Hnd in your test efore you strt your post mortem. 4. Mny people did not write their nme nd/or student numer on ll sheets.this creted sustntil mount of extr work for the TAs nd instructor. You were sked to do this t the strt of the test; do not wit until it is time to hnd it in nd hold up 300+ people trying to hnd in the test. 5. Mny people wrote nme tht is not in greement with the nme under which they re listed in the ASU system. Use the nme y which ASU knows you. In t lest one cse, in trying to red the nme I did not guess single letter correctly, nor did I guess the numer of letters correctly. Plese write your nme clerly; use BLOCK letters if there is ny chnce it will e misred. 6. Sixteen people did not fill in the nswers to the multiple choice in the Answers to Multiple Choice. In two cses there ws no corresponding uestion sheets on which to locte the nswers. The Answers to Multiple Choice sheet ws displyed in clss on 28 Septemer precisely to void this prolem, nd the instructions on the test itself re cler. Follow the instructions. 7. I know tht the time is severely limited to do ech uestion. There is no need to write out of time or no time left. On the other hnd, kudos to the students who sid If I hd time, I would find long enough string in the lnguge nd show there is no wy it cn e pumped to lwys sty in the lnguge or similr sttement. Answers to Multiple Choice [17 mrks in totl] Enter ech response (one of,, c, d, e) for the uestions on the Multiple Choice pges. Giving 0, or 2 or more, responses to uestion is incorrect. Illegile or lnk responses re incorrect. 1 2 3 4 5 6 7 8 D D E B E A D D 9 10 11 12 13 14 15 16 E C C A E B D B 17 TOTAL A Multiple Choice [17 mrks in totl] Select the most pproprite nswer for ech, nd enter ech response (one of,, c, d, e) on the Answers to Multiple Choice pge.

Multiple Choice 2 1. The powerset method d constructs DFA from n NFA 2. Which of the following is flse? d Lnguges re defined to hve finite numer of strings. 3. On input string w Σ, the numer of computtions of n NFA (Q, Σ, δ, 0, F ) is lwys e t lest 1 if the NFA ccepts w 4. If DFA M = (Q, Σ, δ, 0, F ) ccepts input string w Σ with w = n, computtion of M on w is seuence of exctly n + 1 sttes 5. The pumping lemm for regulr lnguges cn e proved y e showing tht DFA computtion must repet stte. 6. DeMorgn s Lws ensure tht Closure under intersection nd complementtion imply closure under union. 7. The regulr opertions re d str, union, nd conctention. 8. To show tht lnguge is regulr, one could give DFA for it. One could lso d give regulr expression or use closure properties 9. To show tht lnguge is not regulr, one could e use the pumping lemm for regulr lnguges or use closure properties 10. The pumping lemm for regulr lnguges implies tht c regulr lnguge is infinite if nd only if it contins string tht cn e pumped 11. A generlized NFA, or GNFA, c cn hve trnsitions lelled with or 12. To rip stte rip in the GNFA method, when there is trnsition from to rip leled A, trnsition from rip to rip leled B, trnsition from rip to leled C, nd trnsition from to leled D, we mke trnsition from to leled (A(B) C) D 13. The GNFA method is used to show tht e Every regulr lnguge is descried y regulr expression. 14. Which of these does not imply tht L is regulr? L is closed under the regulr opertions: i.e, L = LL = L L = L. 15. The greement A of two lnguges L 1 nd L 2 is lnguge consisting of ll strings tht re in oth or neither of the two. Suppose tht L 1 nd L 2 re regulr. d A is regulr ecuse we could construct DFA using the product construction 16. For n NFA M = (Q, Σ, δ, 0, F ) nd suset S Q, which of the following is not lwys true out the ε closure E(S)? there is no ε trnsition from stte not in E(S) to stte in E(S) 17. { n m : n > m 0} is not regulr ecuse p+1 p cnnot e pumped

Nme: Im Smple Long Answers 1 Student Numer: 2468024680 Question 1. [11 mrks] Let L {, } e the lnguge L = { n m : n < m or m < n}. Stte whether or not L is regulr, nd show tht your nswer is correct. L is not regulr. To show this, suppose to the contrry tht L is regulr, nd let p e its pumping length from the pumping lemm for regulr lnguges. Choose w = p p2 +1. Note tht w L ecuse p < p 2 + 1, nd w = p 2 +p+1 p. Therefore y the pumping lemm, we cn write w = uvx with v not empty nd uv p so tht uv i x L for ll i 0. Becuse uv is prefix of w of length t most p, it contins only s. So without loss of generlity, u = α, v = β, nd x = p α β p2 +1, with α 0, β 1, nd α + β p. Now uv 2 x = p+β p2 +1, nd p + 1 p + β 2p. Becuse p + 1 > p 2 + 1, uv 2 x cn only elong to L if p 2 + 1 < p + β 2p. But for every positive integer p, p 2 + 1 > 2p. We conclude tht uv 2 x L, which is contrdiction. So L is not regulr. Other strings you might hve considered: w = p2 +1 p good choice, y considering uv 0 x, i.e. pumping down. w = p p+p! good choice, using the p! trick. w = p2 p or w = p p d choices, ecuse they re not in L. w = p 1 p d choice ecuse we cnnot e sure tht p is n integer. w = p 1 p or w = p 1 p2 d choice ecuse it cn e pumped in the s. w = d choice ecuse the string my e too short. Some students wrote L = L 1 L 2 with L 1 = { n m : n < m} nd L 2 = { n m : m < n}. Then they rgued tht neither L 1 nor L 2 is regulr, which is correct. But then they wnted to conclude tht therefore L is not regulr. But this is not true in generl. Indeed let N e ny lnguge tht is not regulr. Then N is not regulr either. However N N = Σ, which definitely is regulr. So this rgument is fllcious.

Nme: Im Smple Long Answers 2 Student Numer: 2468024680 Question 2. [11 mrks] () [5 mrks] Using the method from clss, produce n NFA for the regulr expression ( ). Do not simplify. (You cn give trnsition digrm or trnsition tle, nd do not need oth.) 2 3 4 5 0 1 6 7 8 9 () [6 mrks] Using the powerset method, produce DFA for the NFA from the () prt. Do not simplify the NFA first. (You cn give trnsition digrm or trnsition tle, nd do not need oth.) { 3, 4 } { 0, 1, 2, 5, 6 } { 0, 1, 2, 6 }, { 7, 8 } { 0, 1, 2, 6, 9 }

Nme: Im Smple Long Answers 3 Student Numer: 2468024680 Question 3. [11 mrks] DFAs with lphet {, } nd trnsition functions Stte Symol 0 strt, finl 1 0 1 0 1 Stte Symol 0 strt, finl 0 1 1 1 0 recognize lnguges of strings with n even numer of s, nd n even numer of s, respectively. () [5 mrks] Let L {, } consist of strings hving n n even numer of s or n even numer of s. Using the product construction on the two given mchines, produce DFA M tht recognizes L. 0,0 0,1 1,0 1,1 () [6 mrks] Show how to turn M into GNFA M. Then show the GNFA otined fter one stte is removed from M using the GNFA method. s 0,0 1,0 0,1 1,1 f Rip stte 1,1 : s 0,0 0,1 f 1,0