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

Similar documents
Practice Midterm Exam Solutions

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

CSE 105 THEORY OF COMPUTATION

Name: Student ID: Instructions:

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Lecture 5: Minimizing DFAs

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

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,

ECS 20: Discrete Mathematics for Computer Science UC Davis Phillip Rogaway June 12, Final Exam

Section 7.1 Relations and Their Properties. Definition: A binary relation R from a set A to a set B is a subset R A B.

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

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

CPSC 421: Tutorial #1

Most General computer?

16.1 Countability. CS125 Lecture 16 Fall 2014

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

ACS2: Decidability Decidability

1 Showing Recognizability

1. Induction on Strings

Decidability (What, stuff is unsolvable?)

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.

Intro to Theory of Computation

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Lecture Notes: The Halting Problem; Reductions

CSE 105 THEORY OF COMPUTATION

6.8 The Post Correspondence Problem

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Exam in Discrete Mathematics

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Lecture Notes on Inductive Definitions

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December Points Possible

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Economics 204 Summer/Fall 2017 Lecture 1 Monday July 17, 2017

CSCE 551 Final Exam, Spring 2004 Answer Key

CSE 311: Foundations of Computing. Lecture 14: Induction

CSE 311: Foundations of Computing. Lecture 26: More on Limits of FSMs, Cardinality

CS 581: Introduction to the Theory of Computation! Lecture 1!

452 FINAL- VERSION E Do not open this exam until you are told. Read these instructions:

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

CSCI3390-Lecture 6: An Undecidable Problem

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M001: Green) 6 December Points Possible

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CSE 105 THEORY OF COMPUTATION

Theory of Computation

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CS103 Handout 47 Spring 2018 Practice CS103 Final Exam V

Computational Models Lecture 8 1

Lecture 2: Regular Expression

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Lecture Notes on Inductive Definitions

(pp ) PDAs and CFGs (Sec. 2.2)

1 Functions, relations, and infinite cardinality

CS103 Handout 12 Winter February 4, 2013 Practice Midterm Exam

Finite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Nondeterministic finite automata

CS481F01 Solutions 8

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CSE 105 THEORY OF COMPUTATION

Supplementary Notes on Inductive Definitions

Review 3. Andreas Klappenecker

Computational Models Lecture 8 1

Selected problems from past exams

CSE 311 Lecture 25: Relating NFAs, DFAs, and Regular Expressions. Emina Torlak and Kevin Zatloukal

CSE 105 THEORY OF COMPUTATION

Computational Models Lecture 8 1

Handout: Proof of the completeness theorem

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

S15 MA 274: Exam 3 Study Questions

CS375 Midterm Exam Solution Set (Fall 2017)

Lecture 1: Finite State Automaton

CpSc 421 Final Exam December 6, 2008

Computational Models - Lecture 5 1

Introduction to the Theory of Computing

Turing Machines. Lecture 8

CSE 555 Homework Three Sample Solutions

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

Answers to the CSCE 551 Final Exam, April 30, 2008

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

COM364 Automata Theory Lecture Note 2 - Nondeterminism

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

CSE 311: Foundations of Computing. Lecture 25: Pattern Matching, DFA NFA Regex Languages vs Representations

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CS 125 Section #10 (Un)decidability and Probability November 1, 2016

Theory Bridge Exam Example Questions

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

CSE 105 THEORY OF COMPUTATION

Automata Theory and Formal Grammars: Lecture 1

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

Theory of Computation (IX) Yijia Chen Fudan University

Automata Theory, Computability and Complexity

Transcription:

CSE 311: Foundations of Computing I Autumn 014 Practice Final: Section X YY ZZ Name: UW ID: Instructions: Closed book, closed notes, no cell phones, no calculators. You have 110 minutes to complete the exam. Answer all problems on the exam paper. If you need extra space use the back of a page. Problems are not of equal difficulty; if you get stuck on a problem, move on. You may tear off the last two pages of equivalence and inference rules. These must be handed in at the end but will not be graded. It may be to your advantage to read all the problems before beginning the exam. 1 Score Table Here

1. [? points] Let Σ = {0, 1}. Prove that the language L = {x Σ : # 0 (x) < # 1 (x)} is irregular. Solution: Let D be an arbitrary DFA. Consider S = {0 n : n 0}. Since S is infinite and D has finitely many states, we know 0 i S and 0 j S both end in the same state for some i < j. Append 1 j to both strings to get: a = 0 i 1 j Note that a L, because i < j and 0 i 1 j Σ. b = 0 j 1 j Note that b L, because j j. Since a and b both end in the same state, and that state cannot both be an accept and reject state, D cannot recognize L. Since D was arbitrary, no DFA recognizes L; so, L is irregular.

. [? points] Define T (n) = { n if n = 0, 1 4T ( n ) + n otherwise Prove that T (n) n 3 for n 3. Solution: We go by strong induction on n. Let P (n) be T (n) n 3 for n N. Base Cases. When n = 3, T (3) = 4T ( 3 ) + 3 = 4T (1) + 3 = 7 7 = 3 3. When n = 4, T (4) = 4T ( 4 ) + 4 = 4T () + 4 = 7 64 = 4 3. When n = 5, T (5) = 4T ( 5 ) + 5 = 4T () + 5 = 8 4 4. Induction Hypothesis. Suppose P (3) P (4) P (k) for some k 5. Induction Step. We want to prove P (k + 1): Note that ( ) k + 1 T (k + 1) = 4T + k + 1, because k + 1. ( ) 3 k + 1 4 + k + 1, by IH. ( ) 3 k + 1 4 + k + 1, by def of floor. ( ) (k + 1) 3 = 4 + k + 1, by algebra. = 3 (k + 1)3 + k + 1, by algebra. = (k + 1)((k + 1) + ), by algebra. (k + 1)((k + 1) + (k + 1) ), because (k + 1). = (k + 1) 3, by algebra Thus, since the base case and induction step hold, the P (n) is true for n 3. 3

3. [? points] Let Σ = {0, 1, }. Consider L = {w Σ : Every 1 in the string has at least one 0 before and after it}. a) Give a regular expression that represents A. Solution: (0 ) (0(0 1 ) 0) (0 ) b) Give a DFA that recognizes A. Solution: Omitted. c) Give a CFG that generates A. Solution: S ε 0S S 0ST T 1R0S R ε 0R 1R R 4

4. [? points] Consider the following CFG: S SS S1 S01. Another way of writing the recursive definition of this set, Q, is as follows: ε Q If S Q, then S1 Q and S01 Q If S, T Q, then ST Q. Prove, by structural induction that if w Q, then w has at least as many 1 s as 0 s. Solution: We go by structal induction on w. Let P (w) be # 0 (w) # 1 (w) for w Σ. Base Case. When w = ε, note that # 0 (w) = 0 = # 1 (w). So, the claim is true. Induction Hypothesis. Suppose P (w), P (v) are true for some w, v generated by the grammar. Induction Step 1. Note that # 0 (w1) = # 0 (w) # 1 (w)+1 = # 1 (w1) by IH, and # 0 (w01) = # 0 (w) + 1 # 1 (w) + 1 = # 1 (w01) by IH. Induction Step. Note that # 0 (wv) = # 0 (w) + # 0 (v) # 1 (w) + # 1 (v) by IH. Since the claim is true for all recursive rules, the claim is true for all strings generated by the grammar. 5

5. [? points] For each of the following answer True or False and give a short explanation of your answer. Any subset of a regular language is also regular. Solution: False. Consider {0, 1} and {0 n 1 n : n 0}. Note that the first is regular and the second is irregular, but the second is a subset of the first. The set of programs that loop forever on at least one input is decidable. Solution: False. If we could solve this problem, we could solve HaltNoInput. Intuitively, a program that solves this problem would have to try all inputs, but, since the program might infinte loop on some of them, it won t be able to. If R A for some set A, then A is uncountable. Solution: True. Diagonalization would still work; alternatively, if A were countable, then we could find an onto function between N and R by skipping all the elements in A that aren t in R. If the domain of discourse is people, the logical statement x (P (x) y (x y P (y)) can be correctly translated as There exists a unique person who has property P. Solution: False. Any x for which P (x) is false makes the entire statement true. This is not the same as there existing a unique person with property P. x ( y P (x, y)) y ( x P (x, y)) is true regardless of what predicate P is. Solution: True. The left part of the implication is saying that there is a single x that works for all y; the right one is saying that for every y, we can find an x that depends on it, but the single x that works for everything will still work. 6

6. [? points] The following is the graph of a binary relation R. a) Draw the transitive-reflexive closure of R. Solution: Omitted. b) Let S = {(X, Y ) : X, Y P(N) X Y }. Recall that R is antisymmetric iff ((a, b) R a b) (b, a) R. Prove that S is antisymmetric. Solution: Suppose (a, b) S and a b. Then, by definition of S, a b and there is some x b where x a (since they aren t equal). Then, (b, a) S, because b a, because x b and x a. So, S is antisymmetric. 7

7. [? points] Convert the following NFA into a DFA using the algorithm from lecture. 1 1 1 0 q 0 q 1 1 q ε Solution: Omitted. 8

8. [? points] Let Σ = {0, 1, }. Construct a DFA that recognizes exactly strings with a 0 in all positions i where i mod 3 = 0. 9

Solution: Omitted. 10