ENEE 459E/CMSC 498R In-class exercise February 10, 2015

Similar documents
Theory of Computation (IX) Yijia Chen Fudan University

Computational Models Lecture 7, Spring 2009

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

CSCE 551: Chin-Tser Huang. University of South Carolina

Decidability and Undecidability

Design and Analysis of Algorithms

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

CST Part IB. Computation Theory. Andrew Pitts

CS154, Lecture 13: P vs NP

CS151 Complexity Theory. Lecture 1 April 3, 2017

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

The Church-Turing Thesis

NP-Completeness Part II

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

CS154, Lecture 13: P vs NP

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Lecture 16: Time Complexity and P vs NP

Decidable Languages - relationship with other classes.

1 Reals are Uncountable

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Undecibability. Hilbert's 10th Problem: Give an algorithm that given a polynomial decides if the polynomial has integer roots or not.

NP Complete Problems. COMP 215 Lecture 20

Theory of Computation

Computational Models - Lecture 6

Show that the following problems are NP-complete

Introduction. Pvs.NPExample

CSE 135: Introduction to Theory of Computation NP-completeness

Handouts. CS701 Theory of Computation

Week 3: Reductions and Completeness

NP-Complete Problems. More reductions

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Foundations of

Introduction to Turing Machines

Principles of Computing, Carnegie Mellon University. The Limits of Computing

Finish K-Complexity, Start Time Complexity

1 Computational problems

Turing Machines Part III

Correctness of Dijkstra s algorithm

Computational Models Lecture 8 1

P, NP, NP-Complete, and NPhard

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

NP-Completeness and Boolean Satisfiability

Computational Models Lecture 8 1

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

NP-Completeness Part II

Lecture 20: conp and Friends, Oracles in Complexity Theory

Advanced Topics in Theoretical Computer Science

Complexity and NP-completeness

Decidability: Church-Turing Thesis

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Review of unsolvability

Polynomial-time Reductions

CS 275 Automata and Formal Language Theory

Fundamentals of Computer Science

Midterm II : Formal Languages, Automata, and Computability

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

On the Computational Hardness of Graph Coloring

SAT, NP, NP-Completeness

CPSC 421: Tutorial #1

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.

CS6901: review of Theory of Computation and Algorithms

NP and NP Completeness

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

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

NP-Complete Reductions 2

NP-Completeness. Subhash Suri. May 15, 2018

CS 275 Automata and Formal Language Theory

UNRESTRICTED GRAMMARS

Essential facts about NP-completeness:

CS3719 Theory of Computation and Algorithms

1 More finite deterministic automata

Turing Machine Recap

Lecture 1: The arithmetic hierarchy

Computational Models Lecture 8 1

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

NP-Completeness. Until now we have been designing algorithms for specific problems

Lecture 24 : Even more reductions

CSCI3390-Second Test with Solutions

Introduction to Computational Complexity

Keith Fligg. 03-April-07

CS154, Lecture 17: conp, Oracles again, Space Complexity

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 1 : Introduction

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

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

Turing Machines, diagonalization, the halting problem, reducibility

258 Handbook of Discrete and Combinatorial Mathematics

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Lecture 15: A Brief Look at PCP

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Computability and Complexity Theory: An Introduction

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

Branching. Teppo Niinimäki. Helsinki October 14, 2011 Seminar: Exact Exponential Algorithms UNIVERSITY OF HELSINKI Department of Computer Science

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Algebraic Dynamic Programming. Solving Satisfiability with ADP

3130CIT Theory of Computation

Theory of Computation Time Complexity

Transcription:

ENEE 459E/CMSC 498R In-class exercise February 10, 2015 In this in-class exercise, we will explore what it means for a problem to be intractable (i.e. it cannot be solved by an efficient algorithm). There are two parts: 1. In the first part, we will look at problems that have no algorithmic solution. This means that any computer program that we write for solving this problem will have some inputs on which it will never terminate. Such problems are called undecidable. As we will see, the fact that such problems even exist was a big surprise for mathematicians. 2. In the second part, we will look at problems which are decidable, that is, there is a computer program that will solve the problem, given enough time. However, we will see that for some fundamental problems, there is strong evidence that these problems require extremely large amounts of time to solve. Indeed, the problems that we will look at in this exercise are known as NP-complete. Much of the text in the following is taken from Introduction to the Theory of Computation by Sipser. Thomson Brooks/Cole, 1997.

1. In 1900, mathematician David Hilbert delivered a now-famous address at the International Congress of Mathematicians in Paris. In his lecture, he identified 23 mathematical problems and posed them as a challenge for the coming century. Hilbert s tenth problem was to devise an algorithm that tests whether a polynomial has an integral root. He did not use the term algorithm but rather a process according to which it can be determined by a finite number of operations. Interestingly, in the way he phrased this problem, Hilbert explicitly asked that an algorithm be devised. Thus he apparently assumed that such an algorithm must exist someone need only find it. As we now know, no algorithm exists for this task; it is algorithmically unsolvable. For mathematicians of that period to come to this conclusion with their intuitive concept of algorithm would have been virtually impossible. The intuitive concept may have been adequate for giving algorithms for certain tasks, but it was useless for showing that no algorithm exists for a particular task. Proving that an algorithm does not exist requires having a clear definition of algorithm. Progress on the tenth problem had to wait for that definition. The definition came in the 1936 papers of Alonzo Church and Alan Turing. Church used a notational system called the λ-calculus to define algorithms. Turing did it with his machines. These two definitions were shown to be equivalent. This connection between the informal notion of algorithm and the precise definition has come to be called the Church-Turing thesis. The Church-Turing thesis provides the definition of algorithm necessary to resolve Hilbert s tenth problem. In 1970, Yuri Matijasevic, building on work of Martin Davis, Hilary Putnam, and Julia Robinson, showed that no algorithm exists for testing whether a polynomial has integral roots. In the following, we will consider the famous undecidable problem known as the Halting problem. Informally, the Halting problem asks, given a program M and input w, to determine whether the program M halts on input x or whether it enters an infinite loop. Formally, to solve the Halting problem, we must design an algorithm O, which takes as input a sequence of characters M, w, where M is interpreted as a program and w is interpreted as the input to the program, and does the following: O( M, w ) outputs 1 in the case that M(w) outputs 1. Otherwise, O( M, w ) outputs 0. We will prove that there is no algorithm for the Halting problem via a proof by contradiction. In other words, we assume that an algorithm O exists for the Halting problem and obtain a contradiction. This implies that an algorithm for O cannot exist. To prove this, we will use the diagonalization method, which is also used to prove that the set of real numbers is uncountable. We assume that algorithm O solves the Halting problem. This means that on input M, w, O( M, w ) outputs 1 in the case that M(w) outputs 1 and O( M, w ) outputs 0 otherwise. Consider a new algorithm D which uses O as a subroutine. This new algorithm D gets input M (interpreted as a program). D runs O( M, M ) and outputs the opposite of what O Page 2 of 6

outputs. I.e. it runs O to determine the output of the program M on input M (so M is being run on its own description) and outputs the opposite. We will examine tables of behaviors for O and D. We list all programs down the rows, M 1, M 2, and all their descriptions across the columns, M 1, M 2,. The entries tell whether the program in a given row outputs 1 in a given column. The entry is 1 if the program outputs 1 but is blank if it outputs some other value or enters an infinite loop. We made up the entries in the following table to illustrate the idea. M 1 M 2 M 3 M 4 M 1 1 1 M 2 1 1 1 1 M 3 M 4 1 1 Figure 1: Behaviors of machines M 1, M 2,. (a) For each row M i and column M j of Figure 2, consider the output of algorithm O( M i, M j ) on that pair. Use Figure 1 to fill in the following table where each entry now contains the output of O (either 0 or 1) on the corresponding pair. M 1 M 2 M 3 M 4 M 1 M 2 M 3 M 4 Figure 2: Behavior of machine O. (b) In the following table, we add a row and column corresponding to the algorithm D defined above. By our assumption, O is an algorithm and so is D. Therefore it must occur on the list M 1, M 2, of all algorithms. Use Figure 2 to fill in the following table where each entry again contains the output of O on the corresponding pair. What happens when you get to the entry corresponding to row D and column D? Page 3 of 6

M 1 M 2 M 3 M 4 D M 1 M 2 M 3 M 4 D Figure 3: Behavior of machine O with input D, included. 2. A literal is a Boolean variable or a negated Boolean variable, as in x or x. A clause is several literals connected with s, as in (x 1 x 2 x 3 x 4 ). A Boolean formula is in conjunctive normal form, called a cnf-formula, if it comprises several clauses connected with s, as in (x 1 x 2 x 3 x 4 ) (x 3 x 5 x 6 ) (x 3 x 6 ) It is a 3cnf formula if all the clauses have three literals. A Boolean formula is satisfiable if some assignment of 0s and 1s to the variables makes the formula evaluate to 1. The 3SAT problem asks, given a 3cnf formula, to determine whether the formula is satisfiable. It turns out that determining whether a 3cnf formula is satisfiable is believed to be a hard problem. Specifically, for 3cnf formula on n variables, the best algorithms (that correctly solve the problem on all inputs) run in time 2 c n for constant c < 1. Since the problem can always be solved using exhaustive search in time 2 n, the best algorithms we have are not much better than exhaustive search. Additional evidence for the fact that 3SAT is a hard problem is that 3SAT is a type of problem that is called NP-complete. We won t get into the specifics of the definition here, but intuitively what this means is that if you had an efficient algorithm for solving 3SAT, then there would be very many other hard problems that you could immediately solve efficiently. (a) Determine if the following 3cnf formula is satisfiable: Φ 1 = (x 1 x 2 x 3 ) (x 1 x 2 x 4 ) (x 1 x 3 x 4 ) (x 2 x 3 x 4 ). (1) Note that in order for the formula to be satisfiable it is necessary and sufficient to have an assignment to the literals x 1, x 1, x 2, x 2, x 3, x 3, x 4, x 4 such that Each clause contains at least one literal set to 1. Two literals of the form x i, x i are set to opposite values. Page 4 of 6

(b) Specify an algorithm that solves 3SAT in time 2 n using exhaustive search (where n is the number of variables). (c) In the following, we will see another hard problem known as the graph clique problem. We will show that if there is a polynomial-time algorithm that solves the graph clique problem, then can use it to construct a polynomial-time algorithm solving 3SAT. This means that if we believe there is no polynomial-time algorithm for 3SAT then there must also be no polynomial-time algorithm for graph clique. The graph clique problem. A clique in an undirected graph is a subgraph, wherein every two nodes are connected by an edge (i.e. a subgraph which is a complete graph). A k-clique is a clique that contains k nodes. Figure 4 illustrates a graph having a 5-clique. Figure 4: A graph with a 5-clique. The graph clique problem is to determine whether a graph contains a clique of a specified size. Constructing an Algorithm A for solving 3SAT. Assume that B is an algorithm solving the graph clique problem. We will use it as a subroutine to construct an algorithm A for solving 3SAT. On input a 3CNF formula Φ with k clauses such as Φ = (a 1 b 1 c 1 ) (a 2 b 2 c 2 ) (a k b k c k ), A will construct a graph G that is related to this 3CNF formula in the following ways: The nodes in graph G are organized into k groups of three nodes called triples. Each triple corresponds to one of the clauses in Φ, and each node in a triple corresponds to a literal in the associated clause. Label each node of G with its corresponding literal in Φ. Page 5 of 6

The edges (i.e. the connections between the nodes) in G must also be chosen by A. It will be your task to specify how A chooses these edges. The graph G will have a k-clique if and only if the original 3SAT formula (which has k clauses) was satisfiable. A will then run B on input G, k to determine whether G contains a k-clique. If B determines that G contains a k-clique, then A concludes that Φ is satisfiable. If B determines that G does not contain a k-clique, then A concludes that Φ is not satisfiable. Specify how the algorithm A chooses the edges of G: Hint 1: Whether or not there is an edge between two nodes in the constructed graph G will depend on whether the literals are (1) in the same triple (2) are labeled with literals of the form x i, x i. Hint 2: Assume that Φ is satisfiable. Then there is some assignment of variables which sets at least one literal in each clause to 1. For each clause, pick one of the literals set to 1, to yield a multi-set which contains k literals. The graph you construct will have a k-clique that consists of the nodes corresponding to these literals. Page 6 of 6