Exam 1 CSU 390 Theory of Computation Fall 2007

Similar documents
Closure under the Regular Operations

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

CS375 Midterm Exam Solution Set (Fall 2017)

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

Finite Automata and Regular languages

Name: Student ID: Instructions:

TDDD65 Introduction to the Theory of Computation

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

CS 154, Lecture 3: DFA NFA, Regular Expressions

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Lecture 4: More on Regexps, Non-Regular Languages

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Theory of Computation

10. The GNFA method is used to show that

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application

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

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

False. They are the same language.

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

CS 133 : Automata Theory and Computability

More Properties of Regular Languages

What we have done so far

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

3515ICT: Theory of Computation. Regular languages

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

Computer Sciences Department

Theory of Computation (II) Yijia Chen Fudan University

Chapter 6. Properties of Regular Languages

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

Formal Languages, Automata and Models of Computation

Computational Models - Lecture 3 1

CpSc 421 Homework 1 Solutions

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Theory of Computation (I) Yijia Chen Fudan University

Computational Theory

Computational Models - Lecture 3

Author: Vivek Kulkarni ( )

1 Alphabets and Languages

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

1. Induction on Strings

Lecture 7 Properties of regular languages

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 105 Homework 5 Due: Monday November 13, Instructions. should be on each page of the submission.

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

Languages, regular languages, finite automata

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

Figure 1: NFA N. Figure 2: Equivalent DFA N obtained through function nfa2dfa

CSE 105 THEORY OF COMPUTATION

Finite-State Machines (Automata) lecture 12

Uses of finite automata

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

UNIT II REGULAR LANGUAGES

Intro to Theory of Computation

Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017

CpSc 421 Final Exam December 15, 2006

CSE 105 Theory of Computation Professor Jeanne Ferrante

Closure under the Regular Operations

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

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

Question Bank UNIT I

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Chapter 6: NFA Applications

Mathematics for linguists

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

Automata: a short introduction

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

Finite Automata and Regular Languages

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

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

Nondeterministic Finite Automata

CSE 105 THEORY OF COMPUTATION

CS 154 Formal Languages and Computability Assignment #2 Solutions

CSCE 551 Final Exam, April 28, 2016 Answer Key

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Author: Vivek Kulkarni ( )

Your Name: UVa Id:

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions

Nondeterminism. September 7, Nondeterminism

Before we show how languages can be proven not regular, first, how would we show a language is regular?

CSCE 551 Final Exam, Spring 2004 Answer Key

UNIT-III REGULAR LANGUAGES

CS 455/555: Finite automata

ECS120 Fall Discussion Notes. October 25, The midterm is on Thursday, November 2nd during class. (That is next week!)

Theory of Languages and Automata

VTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Warshall s algorithm

CMSC 330: Organization of Programming Languages

CS 341 Homework 16 Languages that Are and Are Not Context-Free

HW 3 Solutions. Tommy November 27, 2012

UNIT-I. Strings, Alphabets, Language and Operations

Regular expressions and Kleene s theorem

Chapter Five: Nondeterministic Finite Automata

front pad rear pad door

Recap from Last Time

Theory of Computation

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Equivalence of DFAs and NFAs

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

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

Transcription:

Exam 1 CSU 390 Theory of Computation Fall 2007 Solutions Problem 1 [10 points] Construct a state transition diagram for a DFA that recognizes the following language over the alphabet Σ = {a, b}: L 1 = {w w = ba, and w does not contain bab} 1

Problem 2 [10 points] Construct a state transition diagram for 5-state NFA that recognizes the language given by the regular expression a(cb) c(ba). Problem 3 [10 points] Give a regular expression for the language L 2 over the alphabet Σ = {0, 1}: L 2 = {w w starts with 1, ends with 0, contains an even number of substrings 01} 1(0 + 1 + 0 + 1+) 0 Note: I omitted the word substrings on the exam it was shown on the blackboard. However, a large number of people misread the problem. Therefore, the solution: 1(0101) + 0 was considered nearly correct for 9 out of 10 points. 2

Problem 4 [10 points] Convert the following NFA to an equivalent DFA using the technique shown in class (and in Example 1.41 of the Sipser text). In your final result, show only those states reachable from the start state. Problem 5 [10 points] Convert the following DFA to an equivalent regular expression using the technique shown in class (and in Examples 1.66 and 1.68 of the Sipser text). Eliminate states as follows: First eliminate state 2, then state 1. Initial GNFA: 3

qs : ɛ q2 : a q2 : qa qs : qa get: qs : qa qs : ɛ q2 : a q2 : b q1 qs : ɛ q1 get: qs : ɛ q1 q1 : b q2 : a q2 : b q1 q1 : a q1 get: q1 : a (ba b) q1 q1 : b q2 : a q2 : b qa q1 : a qa get: q1 : ɛ qa After state 2 has been eliminated: qs : ɛ q1 : a (ba b) q1 : ɛ qa qs : qa get: qs : (a (ba b)) qa After state 1 has been eliminated: The corresponding regular expression is: (ba b)) 4

Problem 6 [30 points 5, 5, 10, 10] The min of a language L is defined as min(l) = {w L there is no u L, v Σ + such that w = uv} 1. Define min(l 3 ) for the language L 3 defined by aba b. min(l 3 ) is defined by aba b, i.e. min(l 3 ) = L 3. 2. Define min(l 4 ) for the language L 4 defined by a(ba) +. min(l 4 ) = {aba} 3. Consider min(l 5 ) for the language L 5 defined by b (aa) + b. Show all strings of length 5 five in the language min(l 5 ). aa, baa, bbaa, bbbaa Define the language min(l 5 ). L is defined by b aa 4. Prove that regular languages are closed under the operation min. Hint: Construct the DFA for the language min(l) from the DFA for the language L. Construct an DFA = (Q, Σ, δ, q 0, F) to represent the language L. Construct a new DFA min = Q q sink, Σ, δ min, F) to represent the language min(l) with δ min defined as follows: δ min (q i, q j ) = δ(q i, q j ) for all q i / F. δ min (q i, q j ) = δ(q i, q sink ) for all q i F and q j Q. For every a Σ add the transitions δ min (q sink, q sink ) = a. 5

That means every transition from an accept state is replaced with a new transition with the same label that leads to a new sink state q sink. To complete the DFA we add transitions with the labels for all letters of alphabet emanating from q sink lead to q sink. The resulting DFA min accepts every word w in L that traverses only through non-accept states except for the last transition that leads to an accept state. If there was a u L, v Σ + such that w = uv}, then the last transition in u ends in one of the original accept states. However, in our DFA min there are no transitions from the acccept states that lead later to an accept state, and so there is no v Σ + that would result in a word uv L min. QED Alternate Regular languages are closed under complement and under concatenation. The language L Σ + is regular. L min = complement of L Σ +, and so it also must be regular. QED Problem 7 [20 points 5, 15] 1. Consider the following language over the alphabet Σ = {0, 1}: L 6 = {www w starts with 0} Asked to determine whether this language is regular, Amos Mart argues as follows: Language L = {w w starts with 0} is regular. Regular languages are closed over concatenation, and because L 6 = L L L, L 6 is also regular. This argument is not correct. Explain what is wrong with it. L L L = {w 1 w 2 w 3 w i L} does not say anything about w 1 = w 2 = w 3, so the statement that L 6 = L L L is false. 6

2. Prove that the language L 6 is not regular. We use the pumping lemma. For any p we select the string s = www where w = 01 p, i.e. s = 01 p 01 p 01 p. The xy = 01 k for some 1 k < p and then we can only choose x = 01 k where 0 k < p 1 and either y = 1 m or x = ɛ and y = 01 k. In the first case xy n z = 01 m n 1 p k 01 p 01 p where m n + (p k) > p and so the string s cannot be pumped this way. In the second case xy n z = (01 k ) n 1 p k 01 p 01 p which is definitely not a string in L 6 and so the string s cannot be pumped this way either. That means the string w = 01 p cannot be pumped and the language cannot be a regular language. 7