Your Name: UVa Id:

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

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Name: Student ID: Instructions:

CS154 Final Examination

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

CS154 Final Examination

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Theory Bridge Exam Example Questions

CSE 355 Test 2, Fall 2016

Proving languages to be nonregular

NPDA, CFG equivalence

Theory of Computation

10. The GNFA method is used to show that

Exam 1 CSU 390 Theory of Computation Fall 2007

Finite Automata and Regular languages

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

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

CS 154 Introduction to Automata and Complexity Theory

CSCE 551 Final Exam, Spring 2004 Answer Key

(pp ) PDAs and CFGs (Sec. 2.2)

Ogden s Lemma for CFLs

Theory of Computation (I) Yijia Chen Fudan University

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

Computer Sciences Department

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Automata: a short introduction

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

September 7, Formal Definition of a Nondeterministic Finite Automaton

Lecture 4: More on Regexps, Non-Regular Languages

MA/CSSE 474 Theory of Computation

1 Functions, relations, and infinite cardinality

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

Theory of Computation Lecture 1. Dr. Nahla Belal

CS481F01 Solutions 6 PDAS

CSE 105 THEORY OF COMPUTATION

CS500 Homework #2 Solutions

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

CPSC 421: Tutorial #1

Languages, regular languages, finite automata

1 Functions, relations, and infinite cardinality

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

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

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

CpSc 421 Homework 1 Solutions

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

UNIT-VI PUSHDOWN AUTOMATA

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Final exam study sheet for CS3719 Turing machines and decidability.

Lecture 17: Language Recognition

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

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,

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Introduction to Formal Languages, Automata and Computability p.1/42

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

CSE 105 THEORY OF COMPUTATION

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

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

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Theory of Computation (II) Yijia Chen Fudan University

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

CSE 105 THEORY OF COMPUTATION

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

Context-Free Languages (Pre Lecture)

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

CSE 105 THEORY OF COMPUTATION

Introduction to Turing Machines. Reading: Chapters 8 & 9

October 6, Equivalence of Pushdown Automata with Context-Free Gramm

(Make-Up) Test 1: Multivariable Calculus

Finite Automata and Regular Languages (part III)

Nondeterministic finite automata

CSC173 Workshop: 13 Sept. Notes

CSE 105 THEORY OF COMPUTATION

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

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

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

CpSc 421 Final Exam December 15, 2006

Turing Machines Part III

False. They are the same language.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Johns Hopkins Math Tournament Proof Round: Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CS 455/555: Finite automata

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

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

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CSC236 Week 10. Larry Zhang

Computational Models - Lecture 1 1

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

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

Properties of Context-Free Languages. Closure Properties Decision Properties

Automata Theory, Computability and Complexity

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

(pp ) PDAs and CFGs (Sec. 2.2)

Transcription:

University of Virginia - cs3102: Theory of Computation Spring 2010 Exam 1 2 March 2010 Honor Policy. For this exam, you must work alone. You may consult the single page of notes you brought, but may not look at any other materials. You may not aid or accept aid from other students. Directions. Answer all 6 questions, including all sub-parts. You may use the backs of pages for your scratch work, but we will only grade answers that are written in the answer spaces, or that are found following clearly marked arrows from these boxes. The space provided for each answer is designed to be big enough to easily fit a full credit, correct answer. If you feel like you need more space to write your answer, then either you have extremely large handwriting, or your answer is incorrect, inelegant, or you are providing more detail than is needed for full credit. In general, the questions are organized by topic and the sub-parts of each question are intended to get progressively more challenging (so question 5a may be easier than question 1d). Your Name: UVa Email Id: X1-1

Problem 1: Definitions. For each question, provide a correct, clear, precise, and concise answer from the perspective of a theoretical computer scientist. a. (5) What is a language? b. (5) How do we measure the power of a type of machine such as a DFA or NPDA? c. (5) What does it mean for a machine model to be nondeterministic? X1-2

Problem 2: Language Classification. For each of these questions, provide a convincing argument supporting the proposition. You may use any technique you wish to make your argument, and may assume any of the properties we have proved in class or in the book. a. (5, semi-trick question) Show that the language produced by the context-free grammar below is a regular language: S 0S0 1S1 b. (5) Show that the language produced by the context-free grammar below is a regular language: S 0S S1 ɛ X1-3

c. (5) Show that the language NOTREPEATING defined below is not a regular language: NOTREPEATING = {w w {0, 1} there is no x such that w = xx} X1-4

d. (5 + 5) A squarefree sequence is a sequence that contains no adjacent repeating subsequences of any non-zero length. For example, ab and abcba are squarefree, but aa is not since it contains a 2 and abcbacbab is not since it contains (cba) 2. Show the language consisting of all squarefree strings in {a, b, c} is not context-free. X1-5

Problem 3: Language Classes. (15) Define a type of machine that recognizes the set of languages in the Mystery Class ellipse depicted below: Your class should include infinitely many non-regular languages, but there should be infinitely many finite languages that are not included in your class. For full credit, your answer should include a convincing argument why your class includes infinitely many non-regular languages and excludes infinitely many finite languages. X1-6

Problem 4: Broken Proofs. Each of these proofs claims to prove a conjecture that is false. For each proof, identify the first step that is wrong, and briefly and clearly explain why. The explanation is more important than the step you identify. a. (5) False Conjecture: The intersection of two context free languages is context free. Claimed Proof. 1. We define the intersection of two languages A B = {w w A w B}. 2. The language X = A B is a subset of the language A: X A. This is true since every string in X must also be in A. 3. Since X is a subset of A, and A is context free, X is context free. X1-7

b. (7) False Conjecture: All whole numbers are even. Claimed Proof. We use induction on the numbers to prove the conjecture. 1. A number n is even if 2m = n for some integer m. 2. Basis: 0 is even. Select m = 0, then 2m = 0. 3. Induction: Assume the conjecture holds for all i < n. We show that it holds for n. 4. n = k + 2 for some integer k < n. 5. By the induction hypothesis, k = 2m for some integer m. 6. n = k + 2 = (2m) + 2 = 2(m + 1). Thus, n is even. X1-8

c.(8, tricky) False Conjecture: The language TRIPLES is not regular. { } TRIPLES = 1 3n n 0 Claimed Proof. We use the pumping lemma for regular languages to obtain a contradiction. 1. Assume TRIPLES is regular. Then, there exists some DFA M with pumping length p that recognizes TRIPLES. 2. Choose s = 1 p. 3. The pumping lemma requires that there is a way to divide s into s = xyz where y 1 and xy p and xy i z TRIPLES for all i 0. 4. Since s is all 1s, we know y can contain only 1s. 5. Choose y = 1. 6. Choose i = 2. 7. Since xy 2 z now has p + 1 ones, it is not in the language TRIPLES. 8. Thus, we have a contradiction of the pumping lemma and TRIPLES must not be regular. X1-9

d. (Bonus; don t work on this one until you finish the rest of the exam) In the 2010 annual Latkes (fried potato cakes) v. Hamentash (triangular cookies) debate at MIT, Michael Sipser presented the proof described below (taken from Faculty fling fake facts in food fight, The Tech, 26 February 2010, with numbers added): Sipser wrapped things up for Team Hamentash with the HamenTheorem, which proves by contradiction that the hamentash is better than the latke. (1) First, the proof assumes latkes are best. (2) Then by obviousness, he claimed that hamentashen are better than nothing, and (3) by first assumption, claimed that nothing is better than latkes. (4) Therefore, Sipser argued that the HamenTheorem proved that hamentashen are better than latkes. Since everyone knows latkes are better, the proof must be flawed. Explain the flaw in Sipser s proof. X1-10

Problem 5: Leaky PDAs. Consider a new machine model known as a LeakyPDA. A LeakyPDA is similar to a deterministic PDA except that the stack has a limited depth. A LeakyPDA is specified by the 7-tuple (Q, Σ, D, Γ, δ, q 0, F) where D N is a natural number giving the maximum stack depth and the other elements have the same meaning as for a deterministic PDA. When the stack contains D elements, if a transition pushes another element on the stack, the bottom element of the stack is removed. That is, the result of following the transition rule, δ(q i, a, ɛ) (q t, h p ) starting with a stack γ 0 γ 1,..., γ D 2 γ D 1 is the stack h p γ 0 γ 1,..., γ D 2. (10) Precisely describe the computing power of a LeakyPDA. For full credit, your answer should include a convincing proof supporting your answer. X1-11

Problem 6: Language Class Differences. a. (10) If A and B are regular languages, is A B always a regular language? Recall that the difference of two sets is defined as A B = {s : s A x / B} (For full credit, your answer should include a convincing proof supporting your answer.) X1-12

b. (10) If A and B are context-free languages, is A B always a context-free language? (For full credit, your answer should include a convincing proof supporting your answer.) 1 (15) 2 (20) 3 (15) 4 (20) 5 (10) 6 (20) Total X1-13