Please give details of your calculation. A direct answer without explanation is not counted.

Similar documents
Please give details of your answer. A direct answer without explanation is not counted.

Please give details of your answer. A direct answer without explanation is not counted.

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Name: Student ID: Instructions:

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

10. The GNFA method is used to show that

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

CSE 105 THEORY OF COMPUTATION

TDDD65 Introduction to the Theory of Computation

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSE 105 Theory of Computation Professor Jeanne Ferrante

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CSE 105 THEORY OF COMPUTATION

Lecture 4: More on Regexps, Non-Regular Languages

CSE 105 THEORY OF COMPUTATION

1.3 Regular Expressions

Formal Languages, Automata and Models of Computation

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

More Properties of Regular Languages

Theory of Computation (II) Yijia Chen Fudan University

Lecture 3: Finite Automata

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Chapter 2 The Pumping Lemma

The Pumping Lemma and Closure Properties

Computer Sciences Department

CSCE 551 Final Exam, Spring 2004 Answer Key

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Proving languages to be nonregular

Properties of Regular Languages. Wen-Guey Tzeng Department of Computer Science National Chiao Tung University

Finite Automata (contd)

Lecture 3: Finite Automata

Finite Automata and Regular languages

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove

Intro to Theory of Computation

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA

3515ICT: Theory of Computation. Regular languages

CS 154, Lecture 3: DFA NFA, Regular Expressions

front pad rear pad door

Chapter 6. Properties of Regular Languages

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

CS 154, Lecture 4: Limitations on DFAs (I), Pumping Lemma, Minimizing DFAs

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Lecture 4: Finite Automata

What we have done so far

Theory of Computation

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

CpSc 421 Final Exam December 15, 2006

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Theory of Computation Prof. Raghunath Tewari Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Exam 1 CSU 390 Theory of Computation Fall 2007

The Pumping Lemma: limitations of regular languages

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Computational Theory

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

1 More finite deterministic automata

V Honors Theory of Computation

CS 154 Introduction to Automata and Complexity Theory

CS154. Non-Regular Languages, Minimizing DFAs

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Sample Midterm. Understanding the questions is part of the exam; you are not allowed to ask questions during the exam.

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Johns Hopkins Math Tournament Proof Round: Automata

CpSc 421 Homework 1 Solutions

CSC236 Week 11. Larry Zhang

Chapter 6: NFA Applications

More on Regular Languages and Non-Regular Languages

Mathematics for linguists

CSE 105 THEORY OF COMPUTATION

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

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

Sri vidya college of engineering and technology

Your Name: UVa Id:

Solutions to the Mathematics Masters Examination

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

CS 311 Sample Final Examination

Fooling Sets and. Lecture 5

Notes on Pumping Lemma

Computational Models: Class 3

Theory of Languages and Automata

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Automata and Computability. Solutions to Exercises

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

False. They are the same language.

Regular Languages and Finite Automata

Non-regular languages

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

CSE Theory of Computing: Homework 3 Regexes and DFA/NFAs

Automata and Computability. Solutions to Exercises

Regular Expressions and Language Properties

CSE 105 THEORY OF COMPUTATION

Transcription:

Please give details of your calculation. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to borrow others class notes. Try to work on easier questions first. Problem (5 pts). Consider the following lanagage A = { n n } Give a DFA state diagram for this language (no more than 3 states) Give the formal definition of your DFA 2. Consider the following lanagage B = {() n n } Give a DFA state diagram for this language (no more than 3 states) No need to give the formal definition of your DFA 3. Construct the state diagram of A B using the method used in Theorem.25 (i.e., the method before we introduced NFA). Please remove unnecessary states in final answer. No need to give the formal definition of your DFA., q q, q 2

Formal definition:m = (Q, Σ, δ, q, F ) Q = {q, q, q 2 } Σ = {, } F = {q } δ is described as q q q q q 2 q 2 q 2 q 2 q 2 2. q q 2 q, 3. q q q 2 q q q 2 q, 2 q 2 q 22, The simplified diagram is 2

q q 2 q q 2 q, 2 q 2 q 22, Problem 2 (5 pts). For any regular language A, consider the following way to generate language A.. Find a DFA M (Figure a) which recognizes language A. 2. Add an edge from each accepting state to the initial state with empty character. 3. Since we need to accept empty string, the initial state should also be an accepting state. 4. So we get a new NFA (Figure b). q... other states... q... other states... (a) original DFA M (b) new NFA Figure : A NFA generated from DFA M by the procedure in Problem 2. Give a DFA M with number of states = 2, such that the language generated by the procedure above is not A. You only need to give a state diagram, and you can assume Σ = {, }. 3

2. For a general DFA M = (Q, Σ, δ, q, F ), what is the formal definition of the NFA in Figure?. The following DFA recognizes Σ. q q 2 Following the procedure, we obtain the following NFA, which accepts any string, but we want it to recognize (Σ ) = Σ. q q 2, 2. The new NFA M = (Q, Σ, δ, q, F ), where F = F {q }, and {δ (q, σ)} if σ δ (q, σ) = {q } if σ = and q F φ if σ = and q / F. We intended to use NFA in Figure a, but wrongly stated DFA there. So the problem, while doable, is a bit strange. We grade this problem based on if you made some serious mistakes. Problem 3 (5 pts) Consider following NFA:,, q q 2 q 3 Please convert this NFA to DFA and remove unnecessary state in final answer. 4

, q φ q q 2 q 3, q 2 q 23 q 3, q 23 The simplified diagram is q, q 23 q 3, Problem 4 (2 pts) Given DFA in Figure.4. 2, r, r 2 q 2 q 2, r q 5

Σ = {r,,, 2} and we treat r as a single symbol. Transform it to a GNFA and then obtain a regular expression by sequentially removing state q 2, q, and q. Step, add q s and q a : 2 r r 2 q q 2 q 2 r q s q a Step 2, remove q 2 : ( 2) 2 r ( r) q r 2 ( r) q 2 2 q s q a Step 3, remove q : r 2 ( r) ( 2 2)( ( 2)) (2 r ( r)) q q s q a 6

Step 4, remove q : q s ( r 2 ( r) ( 2 2)( ( 2)) (2 r ( r))) q a The regular expression is ( r 2 ( r) ( 2 2)( ( 2)) (2 r ( r))). Common Mistakes. Forget at the final step. 2. Missing parentheses. For example, someone wrote ( ( 2)) 2 r ( r) rather than ( ( 2)) (2 r ( r)). Problem 5 (5 pts) Is the following language regular? L = { i j gcd(i, j) = }, where gcd(i, j) means the greatest common divider of i and j. Explain your answer clearly. No. Assume the language is regular. By pumping lemma, there is a positive integer p such that for all s L, s = xyz satisfying the following conditions: y xy p for all i, xy i z L Let s = q (q )!, where q is the smallest prime p. Then, gcd(q, (q )!) =. Since q p, y must be k for some k. For i =, xy z = (q k) (q )!, but gcd(q k, (q )!) = q k if k. We have proved xy z / L and got a contradiction, so the language L is not regular. 7

Problem 6 (2 pts) Is the following language regular? L = {uww R v u, v, w {, } +, u v }, where {, } + means the set of strings which are composed of and ( is not included). And w R means the reverse of the string w. Explain your answer clearly. No. Assume the language is regular. By pumping lemma, there is a positive integer p such that for all s L, s = xyz satisfying the following conditions: y xy p for all i, xy i z L Let s = () p () p. We have s L because we can choose w =, u = () p, and v = () p. And the only way to cut s to uw and w R v is to cut between () p and () p. For this case, u = v, uw = () p, w R v = () p. And because () p p, y must be some part of () p. Now we claim for i =, xy z / L. Since u v, uw w R v, and there is no way to cut () p, the possible cut we can find in xy z to let uw longest is the cut we found in s. Since we take off some part of () p (the y), uw < w R v, and u < v. We can claim xy z / L by the above statments and get a controdiction. So the language L is not regular. Other Solutions You can choose s to be () p () p or 2p () p. They can both be used to obtain a contradiction. Common Mistakes. When you choose a string s, you cannot sepcity x, y, or z there. For example, you cannot choose s to be p y y p 2. 2. You can not choose the pumping length. 8