Name: Student ID: Instructions:

Similar documents
Do not start until you are given the green signal

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

CSE 105 THEORY OF COMPUTATION

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

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

10. The GNFA method is used to show that

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

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

CSE 105 THEORY OF COMPUTATION

CS 154 Introduction to Automata and Complexity Theory

Sri vidya college of engineering and technology

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

False. They are the same language.

Theory of Computation

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

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,

CSCE 551 Final Exam, Spring 2004 Answer Key

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

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

front pad rear pad door

Theory Bridge Exam Example Questions

Computer Sciences Department

What we have done so far

CSE 355 Test 2, Fall 2016

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Nondeterministic Finite Automata

CSE 105 THEORY OF COMPUTATION

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

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

CSE 105 Theory of Computation Professor Jeanne Ferrante

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Exam 1 CSU 390 Theory of Computation Fall 2007

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Theory of Computation (II) Yijia Chen Fudan University

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

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

The Pumping Lemma and Closure Properties

TDDD65 Introduction to the Theory of Computation

Closure under the Regular Operations

CS 154, Lecture 3: DFA NFA, Regular Expressions

Part I: Definitions and Properties

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

3515ICT: Theory of Computation. Regular languages

1. Induction on Strings

Computational Models: Class 3

Computational Theory

Closure under the Regular Operations

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

Chapter Five: Nondeterministic Finite Automata

More Properties of Regular Languages

CSE 105 THEORY OF COMPUTATION

Johns Hopkins Math Tournament Proof Round: Automata

Automata: a short introduction

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

CSE 105 Theory of Computation

CPSC 421: Tutorial #1

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

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

Computational Models Lecture 2 1

Finite Automata and Regular languages

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Computational Models Lecture 2 1

CpSc 421 Final Exam December 15, 2006

COMP4141 Theory of Computation

Theory of computation: initial remarks (Chapter 11)

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

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

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

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications

16.1 Countability. CS125 Lecture 16 Fall 2014

3130CIT Theory of Computation

CS 455/555: Finite automata

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

CSE 311 Lecture 23: Finite State Machines. Emina Torlak and Kevin Zatloukal

Proving languages to be nonregular

Theory of computation: initial remarks (Chapter 11)

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

Theory of Languages and Automata

CS21 Decidability and Tractability

Your Name: UVa Id:

Theory of Computation (I) Yijia Chen Fudan University

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

Lecture 4: More on Regexps, Non-Regular Languages

CS 121, Section 2. Week of September 16, 2013

Computational Models - Lecture 1 1

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

Fall 2014 CMSC250/250H Midterm II

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

CSC236 Week 11. Larry Zhang

Computational Models #1

Transcription:

Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student ID on each sheet. Write or mark your answers in the space provided. If you need more space or scratch paper, you can get additional sheets from the instructor. Make sure you write down the question number and your name/id on any additional sheets. 2. Read all questions carefully before answering them. Feel free to come to the front to ask for clarifications. 3. Hint 1: You may answer the questions in any order, so if you find that you're having trouble with one of them, move on to another one that seems easier. 4. Hint 2: If you don t know the answer to a question, don t omit it - do the best you can! You may still get partial credit for whatever you wrote down. Good luck! 1. (20 points) Circle True (T) or False (F) below. Very briefly justify your answers (e.g. by giving an example or counter-example, by citing a theorem or result we proved in class, or by briefly sketching a construction). a. Any infinite subset of an uncountably infinite set is also uncountable. T F Why? False. N is a infinite subset of R. R is uncountably infinite. N is not. b. For any set A, there is always a one-to-one function from A to the power set of A. T F Why? True. The function f(x) = {x} is one-to-one and maps an element of A to an element of the power set of A. Note: On the other hand, there cannot be an onto function (or a bijection) because Power(A) =2 A > A. c. If R is a regular language but R S is not regular for some language S, then S cannot be regular... T F Why? True. Proof by Contradiction. Given R is regular and R S is not. Suppose S is regular. This implies R S is regular (Regular languages are closed under union) which is a contradiction. d. For any language R, if R* is regular, then R is regular T F Why? False. Take R=0 n 1 n {0,1}. This language is clearly not regular but R * =Σ * is regular. (Other counter-examples can also be given) 1

2. (20 points) DFAs a. Let Σ = {0,1,2}. Draw the state diagram of a deterministic finite automaton (DFA) that recognizes the language L = {w Σ* sum of w s digits is divisible by 3}. For example: 111, 012, 222, 00, ε, 21120 are all in L but 020, 10, and 211 are not. b. Fill in the following proof for showing that the class of regular languages is closed under complement. Proof: Let L be a regular language. Then, there exists a DFA M = (Q, Σ, δ, q 0, F) such that L = L(M). The complement of L is recognized by the DFA M = (Q, Σ, δ, q 0, F ), where: Q = Q δ = δ q 0 = q 0 F = Q-F 2

3. (20 points) NFAs Consider the NFA N = (Q, Σ, δ, q 0, F) with the following state diagram: a. What states can N be in after reading: the string 0? 3, 4 the string 01? 3, 5 the string 0111? 3 b. Does N accept 0111? No. Why or why not? 3 F (3 is not an accept state) Consider the equivalent DFA M = (Q, Σ, δ, q 0, F ) derived using the subset construction method for converting an NFA to a DFA. c. What is q 0 (in terms of the states of N)? q 0 = {1,2,4} d. δ ({2,4},1) = {2,5}? δ ({6},1) =? δ ({3,5,6},1) = {3,6}? e. What state q Q is M in after reading the string 00100? q = {2,5} f. Is q above in F? Yes. Why or why not? Because {2,5} F (because 2 is an accept state of N) g. Complete the following: L(N) = {w w {0,1}* and w has even number of 0 s OR has exactly two 1 s} 3

4. (20 points) Regular Expressions and GNFAs a. Write a regular expression for the language L = {w w starts with a 0 and has odd length} over the alphabet Σ = {0,1}. 0(ΣΣ)* or equivalently, 0(00 01 10 11) * b. Using the construction from the text/lecture notes for converting a GNFA to a regular expression, remove state number 2 from the GNFA shown on the left. Show the result by labeling, with the appropriate regular expressions, the 4 resulting transition arrows between states in the GNFA on the right. Note: The special start and accept states have already been added (states 1 and 4). 01 * 01*0 1 11* ε 11*0 0 4

5. (20 points) Pumping Lemma and Non-Regular Languages Let Σ be the set containing ( and ) i.e. Σ = { (, ) }. Define the language L B as the set of all strings over Σ consisting of balanced parentheses. L B can be defined recursively as follows: a string w is in L B iff (1) w is the empty string, or (2) w is of the form: (w 1 ) for some w 1 in L B, or (3) w is of the form: w 1 w 2 for some w 1 and w 2 in L B. Examples of strings in L B : (), (()), (((()))), ()(), (())(), (()(())) Examples of strings not in L B : (, ((()), ())), (()()(, ((())(( (equivalent to ( 3 ) 2 ( 2!) Using the pumping lemma, prove that L B is not a regular language. 1. Assume that L B is regular. 2. This implies that it can be pumped. Let the pumping length be p. 3. Consider the string s=( p ) p. Note that s = 2p p 4. Let x,y,z be any three strings such that xyz=s, with xy p and y 1. Note that by our choice of s, y=( k for some k 1. 5. Choose i = 0 (other choices, e.g. i = 2, will also work). Then, xy i z = xz = ( p-k ) p for some k 1. xz is clearly not in L B. This contradicts the pumping lemma. Therefore, L B is not regular. 5