Practice Problems for Final Exam CS 341: Foundations of Computer Science II Prof. Marvin K. Nakayama

Similar documents
Model 2.4 Faculty member + student

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Automata and Computability. Solutions to Exercises

CS 3719 (Theory of Computation and Algorithms) Lecture 4

The Halting Problem is Undecidable

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Computability Theory

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Overview of E0222: Automata and Computability

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Prime Numbers. Difficulties in Factoring a Number: from the Perspective of Computation. Computation Theory. Turing Machine 電 腦 安 全

Computational Models Lecture 8, Spring 2009

CS 301 Course Information

3515ICT Theory of Computation Turing Machines

Lecture 2: Universality

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Turing Machines: An Introduction

Chapter 7 Uncomputability

Introduction to Automata Theory. Reading: Chapter 1

Lecture summary for Theory of Computation

CS5236 Advanced Automata Theory


Lecture 7: NP-Complete Problems

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

OHJ-2306 Introduction to Theoretical Computer Science, Fall

Complexity Classes P and NP

Theory of Computation Chapter 2: Turing Machines

1 Definition of a Turing machine

CSC 373: Algorithm Design and Analysis Lecture 16

NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

Computer Architecture Syllabus of Qualifying Examination

Deterministic Finite Automata

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Automata and Formal Languages

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

The Classes P and NP

Course Manual Automata & Complexity 2015

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Finite Automata. Reading: Chapter 2

Notes on Complexity Theory Last updated: August, Lecture 1

C H A P T E R Regular Expressions regular expression

ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

Introduction to Theory of Computation

Automata on Infinite Words and Trees

Algebraic Computation Models. Algebraic Computation Models

24 Uses of Turing Machines

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Theory of Computation Class Notes 1

Notes on NP Completeness

1. Prove that the empty set is a subset of every set.

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

Reading 13 : Finite State Automata and Regular Expressions

Formal Grammars and Languages

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

CAs and Turing Machines. The Basis for Universal Computation

Theoretical Computer Science (Bridging Course) Complexity

Turing Machines, Part I

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Introduction to NP-Completeness Written and copyright c by Jie Wang 1

Lecture 1: Oracle Turing Machines

GENERIC COMPUTABILITY, TURING DEGREES, AND ASYMPTOTIC DENSITY

Schneps, Leila; Colmez, Coralie. Math on Trial : How Numbers Get Used and Abused in the Courtroom. New York, NY, USA: Basic Books, p i.

MATH 304 Linear Algebra Lecture 9: Subspaces of vector spaces (continued). Span. Spanning set.

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

Informatique Fondamentale IMA S8

Regular Languages and Finite State Machines

THE SEARCH FOR NATURAL DEFINABILITY IN THE TURING DEGREES

Scanner. tokens scanner parser IR. source code. errors

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

Introduction to Logic in Computer Science: Autumn 2006

Introduction to Turing Machines

Tutorial 8. NP-Complete Problems

4.6 The Primitive Recursive Functions

Two-dimensional Languages

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Notes on Complexity Theory Last updated: August, Lecture 1

Quantum and Non-deterministic computers facing NP-completeness

(67902) Topics in Theory and Complexity Nov 2, Lecture 7

On the Relationship between Classes P and NP

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Course Syllabus. Also listed as CS U1 Automata Theory (

CoNP and Function Problems

6.080/6.089 GITCS Feb 12, Lecture 3

Composability of Infinite-State Activity Automata*

Finite Automata. Reading: Chapter 2

Boolean Algebra Part 1

Compiler Construction

An example of a computable

(Teams removed to preserve address privacy)

Preventing Denial of Service Attacks in a Calculus of Mobile Resources

vii TABLE OF CONTENTS CHAPTER TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK

Two Way F finite Automata and Three Ways to Solve Them

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Lights and Darks of the Star-Free Star

Transcription:

Practice Problems for Final Exam CS 341: Foundations of Computer Science II Prof. Marvin K. Nakayama 1. Short answers: (a) Define the following terms and concepts: i. Union, intersection, set concatenation, Kleene-star, set subtraction, complement ii. A set S is closed under an operation f iii. Regular language iv. Kleene s theorem v. Context-free language vi. Chomsky normal form vii. Church-Turing Thesis viii. Turing-decidable language ix. Turing-recognizable language x. co-turing-recognizable language xi. Countable and uncountable sets xii. Language A is mapping reducible to language B, A m B xiii. Function f(n) is O(g(n)) xiv. Classes P and NP xv. Language A is polynomial-time mapping reducible to language B, A P B. xvi. NP-complete xvii. NP-hard (b) Give the transition functions δ of a DFA, NFA, PDA, Turing machine and nondeterministic Turing machine. (c) Explain the P vs. NP problem. 2. Recall that A TM = { M, w M is a TM that accepts string w }. (a) Prove that A TM is undecidable. You may not cite any theorems or corollaries in your proof. (b) Show that A TM is Turing-recognizable. 3. Each of the languages below in parts (a), (b), (c), (d) is of one of the following types: Type REG. Type CFL. Type DEC. It is regular. It is context-free, but not regular. It is Turing-decidable, but not context-free. For each of the following languages, specify which type it is. Also, follow these instructions: If a language L is of Type REG, give a regular expression and a DFA for L. If a language L is of Type CFL, give a context-free grammar and a PDA for L. Also, prove that L is not regular. If a language L is of Type DEC, give a description of a Turing machine that decides L. Also, prove that L is not context-free. (a) A = { w Σ w = reverse(w) and the length of w is divisible by 4 }, where Σ = {0, 1}. 1

(b) B = { b n a n b n n 0 }. (c) C = { w Σ n a (w) mod 4 = 1 }, where Σ = {a, b} and n a (w) is the number of a s in string w. For example, n a (babaabb) = 3. Also, recall j mod k returns the remainder after dividing j by k, e.g., 3 mod 4 = 3, and 9 mod 4 = 1. (d) D = { b n a n b k c k n 0, k 0 }. [Hint: Recall that the class of context-free languages is closed under concatenation.] 4. Each of the languages below in parts (a), (b), (c), (d) is of one of the following types: Type DEC. Type TMR. Type NTR. It is Turing-decidable. It is Turing-recognizable, but not decidable. It is not Turing-recognizable. For each of the following languages, specify which type it is. Also, follow these instructions: If a language L is of Type DEC, give a description of a Turing machine that decides L. If a language L is of Type TMR, give a description of a Turing machine that recognizes L. Also, prove that L is not decidable. If a language L is of Type NTR, give a proof that it is not Turing-recognizable. In each part below, if you need to prove that the given language L is undecidable or not Turingrecognizable, you must give an explicit proof of this; i.e., do not just cite a theorem that establishes this without a proof. However, if in your proof you need to show another language L has a particular property and there is a theorem that establishes this, then you may simply cite the theorem for L without proof. (a) EQ TM = { M 1, M 2 M 1, M 2 are TMs with L(M 1 ) = L(M 2 ) }. [Hint: show A TM m EQ TM.] (b) HALT TM = { M, w M is a TM that halts on input w }. [Hint: modify the universal TM to show HALT TM is Turing-recognizable.] (c) EQ DFA = { M 1, M 2 M 1, M 2 are DFAs with L(M 1 ) = L(M 2 ) }. (d) A TM, where A TM = { M, w M is a TM that accepts string w }. 5. Let L 1, L 2, L 3,... be an infinite sequence of regular languages, each of which is defined over a common input alphabet Σ. Let L = k=1 L k be the infinite union of L 1, L 2, L 3,.... Is it always the case that L is a regular language? If your answer is YES, give a proof. If your answer is NO, give a counterexample. Explain your answer. [Hint: Consider, for each k 0, the language L k = {a k b k }.] 2

6. Let L 1, L 2, and L 3 be languages defined over the alphabet Σ = {a, b}, where L 1 consists of all possible strings over Σ except the strings w 1, w 2,..., w 100 ; i.e., start with all possible strings over the alphabet, take out 100 particular strings, and the remaining strings form the language L 1 ; L 2 is recognized by an NFA; and L 3 is recognized by a PDA. Prove that (L 1 L 2 )L 3 is a context-free language. [Hint: First show that L 1 and L 2 are regular. Also, consider L 1, the complement of L 1.] 7. Write Y or N in the entries of the table below to indicate which classes of languages are closed under which operations. Regular Decidable Turing-recognizable Operation languages CFLs languages languages Union Intersection Complementation 8. Consider the following context-free grammar G in Chomsky normal form: S a Y Z Z ZY a Y b ZZ Y Y Use the CYK (dynamic programming) algorithm to fill in the following table to determine if G generates the string babba. Does G generate babba? 9. Recall that CLIQUE = { G, k G is an undirected graph with a k-clique }, 3SAT = { φ φ is a satisfiable 3cnf-function }. Show that CLIQUE is NP-Complete by showing that CLIQUE NP and 3SAT P CLIQUE. Explain your reduction for the general case and not just for a specific example. Be sure to prove your reduction works and that it requires polynomial time. Also, be sure to provide proofs of these results, and don t just cite a theorem. 10. Recall that ILP = { A, b matrix A and vector b satisfy Ay b with y and integer vector }. Show that ILP is NP-Complete by showing that ILP NP and 3SAT P ILP. Explain your reduction for the general case and not just for a specific example. Be sure to prove your reduction works and that it requires polynomial time. Also, be sure to provide proofs of these results, and don t just cite a theorem. 3

List of Theorems Thm 1.A. The class of regular languages is closed under union. Thm 1.B. The class of regular languages is closed under concatenation. Thm 1.C. Every NFA has an equivalent DFA. Thm 1.D. The class of regular languages is closed under Kleene-star. Thm 1.E. (Kleene s Theorem) Language A is regular iff A has a regular expression. Thm 1.F. If A is finite language, then A is regular. Thm 1.G. The class of regular languages is closed under intersection. Thm 1.H. The class of regular languages is closed under complementation. Thm 1.I. (Pumping lemma for regular languages) If A is regular language, then number p where, if s A with s p, then can split s = xyz satisfying the conditions (1) xy i z A for each i 0, (2) y > 0, and (3) xy p. Thm 2.A. Every CFL can be described by a CFG G = (V, Σ, R, S) in Chomsky normal form, i.e., each rule in G has one of two forms: A BC or A x, where A V, B, C V {S}, x Σ, and we also allow the rule S ε. Thm 2.B. If A is a regular language, then A is also a CFL. Thm 2.C. A language is context free iff some PDA recognizes it. Thm 2.D. (Pumping lemma for CFLs) For every CFL L, pumping length p such that strings s L with s p, can split s = uvxyz with (1) uv i xy i z L i 0, (2) vy 1, (3) vxy p. Thm 2.E. The class of CFLs is closed under union. Thm 2.F. The class of CFLs is closed under concatenation. Thm 2.G. The class of CFLs is closed under Kleene-star. Thm 3.A. For every multi-tape TM M, there is a single-tape TM M such that L(M) = L(M ). Thm 3.B. Every NTM has an equivalent deterministic TM. Cor 3.C. Language L is Turing-recognizable iff an NTM recognizes it. Thm 3.D. A language is enumerable iff some enumerator enumerates it. Church-Turing Thesis. Informal notion of algorithm corresponds to a Turing machine that always halts. Thm 4.A. A DFA = { B, w B is a DFA that accepts string w } is Turing-decidable. Thm 4.B. A NFA = { B, w B is an NFA that accepts string w } is Turing-decidable. Thm 4.C. A REX = { R, w R is a regular expression that generates string w } is Turing-decidable. Thm 4.D. E DFA = { B B is a DFA with L(B) = } is Turing-decidable. Thm 4.E. EQ DFA = { A, B A and B are DFAs with L(A) = L(B) } is Turing-decidable. Thm 4.F. A CFG = { G, w G is a CFG that generates string w } is Turing-decidable. Thm 4.G. E CFG = { G G is a CFG with L(G) = } is Turing-decidable. Thm 4.H. Every CFL is Turing-decidable. Thm 4.I. A TM = { M, w M is a TM that accepts string w } is undecidable. Thm 4.J. The set R of all real numbers is uncountable. 1

Cor 4.K. Some languages are not Turing-recognizable. Thm 4.L. A language is decidable iff it is both Turing-recognizable and co-turing-recognizable. Cor 4.M. A TM is not Turing-recognizable. Thm 5.A. HALT TM = { M, w M is a TM that halts on w } is undecidable. Thm 5.B. E TM = { M M is a TM with L(M) = } is undecidable. Thm 5.C. REG TM = { M M is a TM and L(M) is regular } is undecidable. Thm 5.D. EQ TM = { M 1, M 2 M 1, M 2 are TMs with L(M 1 ) = L(M 2 ) } is undecidable. Thm 5.E. (Rice s Thm.) Let P be any subset of the class of Turing-recognizable languages such that P and P. Then L P = { M L(M) P } is undecidable. Thm 5.F. If A m B and B is Turing-decidable, then A is Turing-decidable. Cor 5.G. If A m B and A is undecidable, then B is undecidable. Thm 5.H. If A m B and B is Turing-recognizable, then A is Turing-recognizable. Cor 5.I. If A m B and A is not Turing-recognizable, then B is not Turing-recognizable. Thm 5.J. E TM = { M M is a TM with L(M) = } is not Turing-recognizable. Thm 5.K. EQ TM = { M 1, M 2 M 1, M 2 are TMs with L(M 1 ) = L(M 2 ) } is neither Turing-recognizable nor co-turing-recognizable. Thm 7.A. Let t(n) be a function with t(n) n. Then any t(n)-time multi-tape TM has an equivalent O(t 2 (n))-time single-tape TM. Thm 7.B. Let t(n) be a function with t(n) n. Then any t(n)-time NTM has an equivalent 2 O(t(n)) -time deterministic 1-tape TM. Thm 7.C. PATH P. Thm 7.D. RELPRIME P. Thm 7.E. Every CFL is in P. Thm 7.F. A language is in NP iff it is decided by some nondeterministic polynomial-time TM. Cor 7.G. NP = k 0 NTIME(nk ) Thm 7.H. CLIQUE NP. Thm 7.I. SUBSET-SUM NP. Thm 7.J. If A P B and B P, then A P. Thm 7.K. 3SAT is polynomial-time reducible to CLIQUE. Thm 7.L. If there is an NP-Complete problem B and B P, then P = NP. Thm 7.M. If B is NP-Complete and B P C for C NP, then C is NP-Complete. Thm 7.N. (Cook-Levin Thm.) SAT is NP-Complete. Cor 7.O. 3SAT is NP-Complete. Cor 7.P. CLIQUE is NP-Complete. Thm 7.Q. ILP is NP-Complete. 2