THC Homework #1. 1. Give the state diagram of a DFA recognizing the following language:

Similar documents
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

Lecture 2: Universality

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

3515ICT Theory of Computation Turing Machines

Computability Theory

Reading 13 : Finite State Automata and Regular Expressions

Turing Machines: An Introduction

Notes on Complexity Theory Last updated: August, Lecture 1

The Halting Problem is Undecidable

Automata and Formal Languages

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

CS 3719 (Theory of Computation and Algorithms) Lecture 4

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

CSC 373: Algorithm Design and Analysis Lecture 16

1 Definition of a Turing machine

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

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

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

Computational Models Lecture 8, Spring 2009

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

Chapter 7 Uncomputability

Theory of Computation Chapter 2: Turing Machines

CAs and Turing Machines. The Basis for Universal Computation

Introduction to Automata Theory. Reading: Chapter 1

Model 2.4 Faculty member + student

CS 301 Course Information

Lecture 7: NP-Complete Problems

C H A P T E R Regular Expressions regular expression

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

24 Uses of Turing Machines

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

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

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

Lecture 13 - Basic Number Theory.

Overview of E0222: Automata and Computability

MACM 101 Discrete Mathematics I

Deterministic Finite Automata

CS5236 Advanced Automata Theory

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Theoretical Computer Science (Bridging Course) Complexity

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Introduction to Algorithms. Part 3: P, NP Hard Problems

The Classes P and NP

Informatique Fondamentale IMA S8

Tutorial 8. NP-Complete Problems

CMPSCI611: Approximating MAX-CUT Lecture 20

Discrete Mathematics Problems

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

Course Manual Automata & Complexity 2015

Why? A central concept in Computer Science. Algorithms are ubiquitous.

CoNP and Function Problems

Complexity of Algorithms

6.080/6.089 GITCS Feb 12, Lecture 3

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

Complexity Classes P and NP

Regular Languages and Finite Automata

Introduction to computer science

Introduction to Turing Machines

CHAPTER 7 GENERAL PROOF SYSTEMS

Properties of Stabilizing Computations

Notes on Complexity Theory Last updated: August, Lecture 1

Universality in the theory of algorithms and computer science

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

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

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

Computational complexity theory

Midterm Practice Problems

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

Lecture summary for Theory of Computation

One last point: we started off this book by introducing another famously hard search problem:

THEORY of COMPUTATION

GENERIC COMPUTABILITY, TURING DEGREES, AND ASYMPTOTIC DENSITY

Mathematical Induction

Algebraic Computation Models. Algebraic Computation Models

SECTION 10-2 Mathematical Induction

Near Optimal Solutions

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

NP-Completeness and Cook s Theorem

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

P versus NP, and More

Gambling and Data Compression

Mathematical Induction. Lecture 10-11

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

Introduction to Logic in Computer Science: Autumn 2006

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

THE SEARCH FOR NATURAL DEFINABILITY IN THE TURING DEGREES

Full and Complete Binary Trees

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

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

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

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

Quantum and Non-deterministic computers facing NP-completeness

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

The Classes P and NP. mohamed@elwakil.net

Turing Machines, Part I

Chapter 1. Computation theory

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

Transcription:

THC Homework #1 Let Σ = {0, 1} for all exercises. 1. Give the state diagram of a DFA recognizing the following language: L 1 = {w the number of 1s in w is divisible by 2 and the number of 0s is divisible by 3}. 2. Give the state diagram of a NFA (or DFA) recognizing the following language: L 2 = {w w contains two 1s such that the number of 0s between them is divisible by 4}. (There may be some other 1s between the two 1s.) 3. For any word w = w 1 w 2... w n, the reverse of w, written w R, is the word in reverse order, w n w n 1... w 1. For a language A, let A R = {w R w A}. Show that if A is regular, so is A R. 4. Prove that the following language is regular: L 3 = {w if w is viewed as a binary number, then it is divisible by 3}. 1

THC Homework #2 1. Prove that any DFA that accepts the language (0 1) 0(0 1) n 1 has at least 2 n states. (Hint: Show that if it has less states, then it cannot distinguish two words, where one of the words should be accepted and the other should be rejected.) 2. Write a regular expression for the following language over the alphabet {0, 1}: The set of all strings with at most one pair of consecutive 0 s and at most one pair of consecutive 1 s. 3. Is the following language regular: The set of binary strings that are not palindromes. (w is a palindrome if w = w R where w R denotes the reverse of w.) 4. Prove that every language with nonempty complement is contained in a regular language with nonempty complement. 2

THC Homework #3 1. Give a pushdown automaton recognizing the following language: {w the length of w is odd and the middle symbol is a 0} (Σ = {0, 1}) 2. Prove the following language is context-free: {x#y x, y {a, b} and x y} (Σ = {a, b, #}) 3. Prove that the following language is not context-free: {x 1 #x 2 #... #x k k 2, each x i {a, b}, and for some i and j i, x i = x j } (Σ = {a, b, #}) 4. Give a language which is context-free, but its complement is not context-free. 3

THC Homework #4 1. Let M be the following 2-tape Turing Machine: M = (Q, Σ, Γ, δ, q 0, F ), where k = 2, Q = {q 0, q 1, q 2, q 3, q 4, q 5 }, Σ = {0, 1}, Γ = {X, 0, 1, }, F = {q 5 }, δ : reading writing state 1st tape 2nd tape 1st tape 2nd tape new state q 0 0 * 0 S X R q 1 1 * 1 S X R q 1 * * * S * S q 5 q 1 0 * 0 R 0 R q 1 1 * 1 R 1 R q 1 * * * S * L q 2 q 2 * 0 * S 0 L q 2 * 1 * S 1 L q 2 * X * L X R q 3 q 3 0 0 0 S 0 R q 4 1 1 1 S 1 R q 4 q 4 0 0 0 L 0 S q 3 0 1 0 L 1 S q 3 1 0 1 L 0 S q 3 1 1 1 L 1 S q 3 0 * 0 S * S q 5 1 * 1 S * S q 5 (If δ in not defined, and the current state is not in F, then we reject.) What is L M? (Which 0 1 sequences are accepted by M?) 2. Give the state diagram of a 1-tape TM which recognizes L = {w#w R w {0, 1} }, where w R is the reverse of w. 3. Describe a TM in words (you don t need to give all the state diagram, just a precise description), which computes the following function: x#y x + y, where x, y are considered as (multiple bit) binary numbers, and the output is the sum in binary form. 4. A Turing machine without a left move is like an ordinary TM except, that it can never move its head to the left (but the head can stay, or move to the right). Show that this variant is not equivalent to the original model. What class of languages do these machines recognize? 4

THC Homework #5 1. Prove that the language of all prime numbers (say in binary representation) is recursive (Turing-decidable). 2. Define the notion of a Turing machine with a two-dimensional tape. Show that a 2-tape ordinary Turing machine can simulate it. Estimate the efficiency of the above simulation. (Express the running time of the new machine with the running time function T M (n) of the original machine.) 3. Prove that if L 1, L 2 are recursive languages than L 1 L 2 := (L 1 \ L 2 ) (L 2 \ L 1 ) (the symmetric difference of the two languages) is also recursive. 4. Show that any infinite recursively enumerable language contains an infinite recursive language. 5

THC Homework #6 1. Let L be the language of all words w Σ for which M w (the TM described by w) exists and there exists a word s Σ such that M w stops in at most 100 steps started with input s. Is L recursive? 2. Show that the following problem is undecidable (the corresponding language is / R): Given two Turing machines, M 1 and M 2, is the intersection of the languages accepted by M 1 and M 2 empty? 3. Show that the following language is not recursively enumerable: L = {w M w exists and it accepts a word 0s iff it accepts 1s} 4. Show that L is Turing-decideable if and only if L m 0 1. 6

THC Homework #7 1. In the Silly Post Correspondence Problem, SPCP, in each pair the top string has the same length as the bottom string. Is the SPCP decidable? 2. In In the Binary Post Correspondence Problem, BPCP, the size of the alphabet is 2 (i. e. Σ = 2). Is the BPCP decidable? 3. Define the notion of the 3 dimensional domino problem and prove that it is undecidable. 4. Show that the following modification of the domino problem is also undecidable. We use tiles marked on the corners instead of the sides and all tiles meeting in a corner must have the same mark. 7

THC Homework #8 1. Let MODEXP = {(a, b, c, p) a, b, c and p are binary integers such that a b c mod p}. Show that MODEXP P. 2. Show that P is closed under the star operation. (Hint: Use dynamic programming) 3. Prove that if L SPACE(3 log n) then L P. 4. Let TRIPLE = {xxx x Σ }. Prove that TRIPLE SPACE(log(n)). 8

THC Homework #9 1. Let f be a length-preserving one-to-one function over binary strings, and suppose that f is computable in polynomial time. Let L = {y x(f(x) = y and the first bit of x is 1)}. Prove that L NP conp. computable in polynomial time.) (Note that we cannot assume that the inverse of f is 2. Suppose we have a polynomial algorithm to determine the size of the largest clique in a given graph. Describe a polynomial algorithm to find a maximum size clique. 3. Show that an algorithm that makes at most a constant number of calls to polynomial-time subroutines runs in polynomial time, but that a polynomial number of calls to polynomialtime subroutines may result in an exponential-time algorithm. 4. Show that, if P = NP then every language A P except A = and A = Σ is NPcomplete. (Hint: The proof is not good enough if it doesn t show why do we have the two exceptional languages.) 9

THC Sample Midterm 1. Give an NFA, that accepts the following language: The set of stings over the alphabet {0, 1,..., 9} such that the final digit has not appeared before. 2. Let Σ = {0, 1, +, =} and ADD = {x = y + z x, y, z are binary integers, and x is the sum of y and z}. Shaw that ADD is not regular. 3. Give a context-free grammar for the following language: (Σ = {a, b, c}). {a n b m c k k > n + m; n, m 0}. 4. Consider the language L = {s s contains twice as many 0s as 1s} over the alphabet {0, 1}. Design a TM (with full details) that recognises L. 5. A one-tape, 1-superhead Turing machine M s is an obvious extension of a one-tape machine. The superhead can read and write the k cells right from its actual position in one step, then jump at most k positions left or right. Prove that such a machine can be simulated by an ordinary one-tape, one-head Turing machine and estimate the efficiency of the simulation. (i.e. If M s makes T Ms (n) steps on an input of length n, how many steps the simulating machine needs to make?) 6. Show that any infinite recursively enumerable language contains an infinite recursive language. 10

THC Sample Final Solve 1. and 2. with closed books, closed notes. When you hand the solutions for these in, you can open your book and notes to solve the other questions. 1. Define the set of recursive and recursively enumerable languages. What is the relation of the two sets? Give a language which is contained in one of the sets but not in the other. 2. Prove that if L 1 P L 2 and L 2 P L 3 then L 1 P L 3. ( P denotes the polynomial (Karp)-reduction. You can use previously proved theorems without proof here.) 3. Let Σ = {1, 2, 3, 4} and C = {w Σ in w, the number of 1s equals the number of 2s, and the number of 3s equal the number of 4s}. Show that C is not a context free language. 4. Show that the class NP is closed under concatenation. 5. Let A be the language of properly nested parentheses. For example, (()) and (()(()))() are in A, but )( is not. Show that A DSP ACE(log(n)). 6. What is the complexity of the following language? (Is it in P? Is it NP-complete?) L 4 = {(G, k) G contains a spanning tree with maximum degree k } (k is a number given in binary form.) 11

List of theorems that may appear in the final Instructor: Gyula Y. Katona 1. NFA and DFA has equal computing power. (The idea, without the precise details.) 2. Regular languages are closed under regular operations. 3. If a language is decribed by a regular expression, then it is regular. 4. Pumping lemma for regular languages. (The idea, without the precise details.) 5. Pumping lemma for CFL. (The idea, without the precise details.) 6. One-way infinite 1-tape TM is equivalent to two-way infinite 1-tape TM. 7. A language is RE iff an enumerator enumerates all the words. 8. A language is R iff an enumerator enumerates all the words in inreasing order. 9. The diagonal language is not RE. 10. A TM RE \ R 11. L R iff L RE and L RE 12. HALT TM RE \ R 13. Witness theorem. 14. Karp-reduction is transitive. 15. 3-SAT is NP-complete. (Assuming that SAT is NP-complete.) 16. MAXSTABLE is NP-complete. (Assuming that 3-COLOR is NP-complete.) 17. MAXCLIQUE is NP-complete. (Assuming that MAXSTABLE is NP-complete.) 18. HAMCYCLE is NP-complete. (Assuming that HAMPATH is NP-complete.) 12