Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Similar documents
Computational Complexity: A Modern Approach. Draft of a book: Dated January 2007 Comments welcome!

DRAFT. Diagonalization. Chapter 4

Lecture 3 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Essential facts about NP-completeness:

The Cook-Levin Theorem

On the Computational Hardness of Graph Coloring

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

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

SAT, NP, NP-Completeness

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?

Lecture 8 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

2 Natural Proofs: a barrier for proving circuit lower bounds

Lecture 3: Nondeterminism, NP, and NP-completeness

2 Evidence that Graph Isomorphism is not NP-complete

MTAT Complexity Theory October 13th-14th, Lecture 6

Intro to Theory of Computation

The Polynomial Hierarchy

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

NP and NP Completeness

MTAT Complexity Theory October 20th-21st, Lecture 7

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

Lecture 16: Time Complexity and P vs NP

CS154, Lecture 13: P vs NP

ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

NP-completeness was introduced by Stephen Cook in 1971 in a foundational paper.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Introduction to Complexity Theory

1 PSPACE-Completeness

Finish K-Complexity, Start Time Complexity

Lecture 20: conp and Friends, Oracles in Complexity Theory

CS154, Lecture 13: P vs NP

1 Computational Problems

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

Lecture 3: Reductions and Completeness

Notes for Lecture Notes 2

Lecture 7: Polynomial time hierarchy

Chapter 7: Time Complexity

Lecture 18: PCP Theorem and Hardness of Approximation I

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

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

CSE 135: Introduction to Theory of Computation NP-completeness

Lecture 4 : Quest for Structure in Counting Problems

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

NP, polynomial-time mapping reductions, and NP-completeness

Computational complexity

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

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

Complexity Classes V. More PCPs. Eric Rachlin

Non-Deterministic Time

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

NP Completeness. Richard Karp, 1972.

Ma/CS 117c Handout # 5 P vs. NP

Show that the following problems are NP-complete

NP Complete Problems. COMP 215 Lecture 20

The Complexity of Optimization Problems

NP Completeness and Approximation Algorithms

: Computational Complexity Lecture 3 ITCS, Tsinghua Univesity, Fall October 2007

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

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

Lecture 1: Introduction

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

Lecture 19: Finish NP-Completeness, conp and Friends

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

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

Lecture 2: Relativization

Design and Analysis of Algorithms

: On the P vs. BPP problem. 30/12/2016 Lecture 12

DRAFT. PCP and Hardness of Approximation. Chapter 19

Correctness of Dijkstra s algorithm

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

Week 3: Reductions and Completeness

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

1 Non-deterministic Turing Machine

CS 151 Complexity Theory Spring Solution Set 5

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

CSCI3390-Lecture 16: NP-completeness

Technische Universität München Summer term 2010 Theoretische Informatik August 2, 2010 Dr. J. Kreiker / Dr. M. Luttenberger, J. Kretinsky SOLUTION

Chapter 2 : Time complexity

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Time-Space Tradeoffs for SAT

BBM402-Lecture 11: The Class NP

Time-bounded computations

NP-Complete Reductions 1

CISC 4090 Theory of Computation

Notes on Complexity Theory Last updated: October, Lecture 6

A An Overview of Complexity Theory for the Algorithm Designer

NP-Completeness and Boolean Satisfiability

Theory of Computation Time Complexity

About the relationship between formal logic and complexity classes

CSE 105 THEORY OF COMPUTATION

COS 522: Computational Complexity Princeton University, Spring 2001 Lecturer: Sanjeev Arora

Notes for Lecture 2. Statement of the PCP Theorem and Constraint Satisfaction

1.1 P, NP, and NP-complete

Advanced Topics in Theoretical Computer Science

Transcription:

Topics in Theoretical Computer Science February 29, 2016 Lecturer: Ola Svensson Lecture 2 (Notes) Scribes: Ola Svensson Disclaimer: These notes were written for the lecturer only and may contain inconsistent notation, typos, and they do not cite relevant works. They also contain extracts from the two main inspirations of this course: 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak; 2. The course http://theory.stanford.edu/ trevisan/cs254-14/index.html by Luca Trevisan. 1 Introduction Recall last lecture TM and Diagonalization (Cantor, Halting, and Time Hierarchy) Today Non-determinism and why diagonalization alone will not solve P vs NP question. 2 Nondeterminism 2.1 Nondeterministic Turing machines The original definition of NP was in using a variant of Turing machines called nondeterministic Turing machines (abbreviated NDTM): the only differences between NDTM and TM are NDTM has two transition functions δ 0 and δ 1, and a special state called q accept When NDTM computes a function, we envision that at each computational step M makes an arbitrary choice as to which of its two transition functions to apply. For every input x, we say that M(x) = 1 if there exists some sequence of these choices (which we call nondeterministic choices) of M) that would make M reach q accept on input x. Otherwise, if every sequence of choices makes M halt without reaching q accept then we say M(x) = 0. We say that M runs in T (n)-time if for every input x {0, 1} and every sequence of nondeterministic choices, M reaches either the halting state or q accept within T ( x ) steps Definition 1 For every function T : N N and L {0, 1} we say that L NTIME(T (n)) if there is a constant c > 0 and a c T (n)-time NDTM M such that for every x 0, 1, x L M(x) = 1. Example 1 An efficient NDTM to check whether an input n is a composite integer: nondeterminism) an integer p n, and check whether p divides n. guess (using Theorem 2 (Nondetermistic time hierarchy) If f, g are time constructible functions satisfying f(n+ 1) log(f(n + 1)) = o(g(n)), then NTIME(f(n)) NTIME(g(n)). More complex proof than deterministic time hierarchy theorem because we do not know how to simulate NDTM efficiently and flip the answer. 1

2.2 Definition of the class NP Two definitions of NP: (i) as a polytime verifier and (ii) as a nondeterministic polynomial time Turing machine. Definition 3 A language L {0, 1} is in NP if there exists a polynomial p : N N and a polynomialtime TM M (called the verifier for L) such that for every x {0, 1}, x L u {0, 1} p( x ) s.t. M(x, u) = 1. If x L and u {0, 1} p( x ) satisfy M(x, u) = 1, then we call u a certificate/proof for x. Examples: Graph Coloring, 3-SAT, Hamiltonian Cycle Theorem 4 NP = c 1 NTIME(n c ). Proof Main idea: sequences of nondeterministic choices can be viewed as a certificate and vice versa. Suppose p : N N is a polynomial and L is decided by a NDTM N that runs in time p(n). For every x L, there is a sequence of nondeterministic choices and that makes N reach q accept on input x. We can use this sequence as a certificate for x. This certificate has length p( x ) and can be verified in polynomial time by a deterministic TM by simulating N using these choices. Hence L NP. Conversely, if L NP then we describe a polytime NDTM N that decides L. On input x, it uses the ability to make nondeterministic choices to write down a string u of length p( x ). Then it runs the deterministic verifier M to verify that u is a valid certificate for x and if so enters q accept. Since p(n) = O(n c ) for some c > 1, we conclude that L NTIME(n c ). 3 Reducibility and NP-Completeness It turns out that the Independent Set problem is at leas as hard as any other problem in NP: if it has a polynomial algorithm then so do all the problems in NP! How can we prove that a language C is at least as hard as some other language B? The crucial tool we use is the notion of reduction. Definition 5 (Reductions) A language L {0, 1} is polynomial-time Karp reducible to a language L {0, 1} (often shortened to polynomial-time reducible ), denoted by L p L, if there is a polynomial-time computable function f : {0, 1} {0, 1} such that for every x {0, 1}, x L if and only if f(x) L. Definition 6 (NP-hardness and NP-Completeness) We say that L is NP-hard if if L p L for every L NP. We say that L is NP-complete if L is NP-hard and L NP. Examples of NP-complete problems are 3-SAT, Hamiltonicity, Graph Coloring,... 2

3.1 Showing NP-Completeness of Independent Set We assume that 3SAT is NP-complete (Cook and Levin Theorem that we will show later in course). Recall the definition of 3SAT and INDSET: 3SAT is the language containing all satisfiable 3CNF formulas. formula if it is the ANDs of ORs of 3 literals: A boolean formula is a 3CNF (x y z) (u v z)... INDSET is the language containing all pairs G, k such that the graph G has a subgraph of at least k vertices with no edges between them. To prove that INDSET is NP-complete we need to prove that 1. INDSET NP 2. L p INDSET for all L NP (but since 3SAT is NP-complete it suffices to show 3SAT p INDSET; one of the beauties of the concept of completeness). Lemma 7 INDSET NP Proof Consider the following polynomial-time algorithm M: Given a pair G, k and a string u {0, 1}, output 1 if and only if u encodes a list of k vertices of G such that there is no edge between any two members of that list. This can clearly be done in polynomial-time. Moreover, by definition, G, k is in INDSET if and only if there exists a string u such that M( G, k, u) = 1 and hence INDSET is in NP. Note that the length of u is O(k log n), i.e., polynomial, where n is the number of vertices. Lemma 8 3SAT p INDSET Proof We show how to transform in polynomial-time every m-clause 3CNF formula ϕ into a 7mvertex graph G such that ϕ is satisfiable if and only if G has an independent set of size at least m. The graph G is defined as follows: We associate a cluster of 7 vertices in G with each clause of ϕ. The vertices in a cluster associated with a clause C correspond to the seven possible satisfying partial assignments to the three variables on which C depends. We put an edge between two vertices of G if they correspond to inconsistent partial assignments. (Two partial assignments are consistent if they give the same value to all the variables they share.) Example of the transformation (each cluster forms a clique and those edges are not depicted for clarity): 3

x = T y = F x = T v = T x = T y = F (x y z) (u v z) x = T v = T x = F y = F u = F x = F u = F x = F u = F v = T Clearly transforming ϕ into G can be done in polynomial time and so all that remains to show is that ϕ is satisfiable iff G has an independent set of size m: Suppose that ϕ has a satisfying assignment u. Define a set S of cardinality m of G s vertices as follows: for every clause C of ϕ put in S the vertex in the cluster associated with C (note that such a clause exists since u satisfies all clauses). Because we only choose vertices that correspond to assignment u there are no vertices in S that correspond to inconsistent assignments. Hence S is an independent set of size m. Suppose G has an independent set S of size m. We will use S to construct a satisfying assignment u for ϕ. We define u as follows: for every i [n], if there is a vertex u S that gives a value a to u i, then set u i = a; otherwise, set u i = 0. This is well defined because S is an independent set and hence does not contain any inconsistent assignments. Moreover, since S contains exactly one vertex per cluster, our assignment will satisfy each clause. 3.2 Some comments One of the beauty of NP-completeness is that to prove a problem to be NP-complete we only need to show a reduction from an already known NP-complete problems. Since the Cook-Levin Theorem, there has been an explosion of NP-completeness results: 6000 paper/year with NP-completeness in title, keyword, or abstract. 4

Almost complete classification of problems in NP into P or NP-complete. Notable exceptions are Graph Isomorphism (recent quasi-poly algorithm), factoring, 3 machine scheduling. One may wonder if all problems in NP are either complete or in P? The answer is NO assuming P NP (Ladner s theorem) and we will prove it today if we have time. The P vs NP question is today one of the most important problems in science; a solution is rewarded with eternal fame (and one million dollars :)). Today we will show that diagonalization alone will not resolve it but first exercises. 4 Exercises Exercise 1 Let EXP = c>1 DTIME(2 nc ). Prove P NP EXP. (Embarrassingly, we do not know of any stronger relation between NP and deterministic time classes.) Exercise 2 If L p L and L p L then L p L. If language L is NP-hard and L P then P = NP. If language L is NP-complete then L P if and only if P = NP. Exercise 3 Vertex Cover is the language that contains all pairs G, k such that the graph G has a subset S of at most k vertices so that every edge e = {u, v} of G has at least one endpoint in S, i.e., S e. Show that Vertex Cover is NP-complete. 5 Diagonalization alone is not sufficient to resolve P vs N P The result covered in this section is originally due to Baker, Gill and Solovay 75. The diagonalization proofs that we saw use two facts about TM: 1. The existence of an effective representation of Turing machines by strings. 2. The ability of one TM to simulate any other without much overhead in running time or space. Any argument that only uses these facts is treating machines as black boxes: The machine s internal workings do not matter. We will define on variant of TM s for which P = NP and another variant where P NP. We conclude that to resolve P vs NP we need to use some other property in addition to the two above. To define our variants we will use the notion of oracle Turing machines that we define in the next subsection. We then continue to prove the result. 5.1 Oracle Turing Machines Oracle Turing machines are TMs that are given access to a black box or oracle that can magically solve the decision problem for some language O {0, 1}. (Think of a magic constant time function in your favorite programming language.) Specifically, an oracle Turing machine is a TM that has a special oracle tape on which it can write a string q {0, 1} and in one step execute the oracle to get an answer to the query is q in O?. This can be repeated arbitrary often with different queries. If O is a difficult language (e.g. Halt) then this oracle gives added power to the TM. 5

Oracle NDTMs are defined similarly. Definition 9 For every O {0, 1}, P O is the set containing every language that can be decided by a polynomial-time deterministic TM with oracle access to O. Similarly NP O is the set containing every language that can be decided by a polynomial-time nondeterministic TM with oracle access to O. Example 2 Let SAT denote the language of unsatisfiable formulas. Then SAT P SAT. (Just query the oracle if input ϕ is satisfiable and output the opposite answer.) Another example is that P = P O for any O P. (Any query to the oracle can be replaced by a polynomial time execution. As the number of queries are polynomial, the total running time is still polynomial.) 5.2 An oracle EXP COM for which P EXP COM EXP COM = NP Let EXP COM be the following language { M, x, 1 n : M outputs 1 on x within 2 n steps}. Lemma 10 P EXP COM = NP EXP COM = EXP := c DTIME(2 nc ). Proof An oracle query to EXPCOM allows one to perform an exponential-time computation. So EXP P EXP COM. If M is a poly-time nondeterministic oracle TM, we can simulate its execution with a EXP COM oracle in exponential time: Such time suffices both to enumerate all of M s nondeterministic choices and to answer the EXP COM queries. It follows that EXP P EXP COM NP EXCOM EXP. 5.3 An oracle B for which P B NP B For any language B, let U B be the unary language U B = {1 n : some string of length n is in B}. For every oracle B, the language U B is in NP B : a nondeterministic TM can make a nondeterministic guess for the string x {0, 1} n such that x B. We now construct an oracle B such that U B P B, implying that P B NP B. For every i, we let M i denote the oracle TM represented by the binary expansion of i. We construct B in stages where stage i ensures that Mi B does not decide U B in time 2 n/10. Each stage determines the status of a finite number of strings (i.e., whether or not these strings will ultimately be in B). 6

Stage i: So far we decided on a finite number of strings (whether or not they are in B). Select n large enough so that it exceeds the length of any such string, and run M i on input 1 n for 2 n /10 steps. Whenever M i queries the oracle about strings whose status has been determined, we answer consistently. When M i queries the oracle about strings whose status has been undetermined, we declare that the string is not in B. After M i finishes computation, we want to make sure that its answer on input 1 n (whatever it was) is incorrect. The main point is that we have only decided the fate on at most 2 n /10 strings in {0, 1} n, and all of them were decided to not be in B. So if M i accepts 1 n we declare all the remaining strings of length n are also not in B, thus ensuring 1 n U B. Conversely if M i rejects, we pick any string x {0, 1} n that M i has not queried and add it to B, thus ensuring that 1 n U B. Since every polynomial p(n) is smaller than 2 n /10 for large enough n, and every TM M is represented by infinitely many strings, our construction ensures that M does not decide U B if it runs in time p(n). Thus we have shown that U B P B. In fact we have shown that it is not in DTIME B (f(n)) for every f(n) = o(2 n ). 5.4 Some comments It can be shown that for a random oracle O, P O NP O with high probability. A proof technique that holds for all oracle Turing machines are said to relativize. An example of a nonrelativizing result is the Cook-Levin Theorem (establishing NP-completeness) that heavily relies on computation being local on a standard TM. 7