Review of unsolvability

Similar documents
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 25: Cook s Theorem (1997) Steven Skiena. skiena

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

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

Introduction to Complexity Theory

Turing Machines and Time Complexity

CS151 Complexity Theory. Lecture 1 April 3, 2017

Spring Lecture 21 NP-Complete Problems

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

CMSC 441: Algorithms. NP Completeness

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

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

CS154, Lecture 13: P vs NP

NP Complete Problems. COMP 215 Lecture 20

CSE 135: Introduction to Theory of Computation NP-completeness

Comparison of several polynomial and exponential time complexity functions. Size n

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Essential facts about NP-completeness:

Computability and Complexity Theory: An Introduction

CS154, Lecture 13: P vs NP

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

Complexity, P and NP

Design and Analysis of Algorithms

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

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

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?

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

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

1 Computational problems

NP-Completeness and Boolean Satisfiability

Advanced Topics in Theoretical Computer Science

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

1.1 P, NP, and NP-complete

Limitations of Algorithm Power

Theory of Computation Time Complexity

Computational Complexity

Average case Complexity

Introduction to Computational Complexity

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

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

Complexity: moving from qualitative to quantitative considerations

Correctness of Dijkstra s algorithm

conp, Oracles, Space Complexity

Definition: conp = { L L NP } What does a conp computation look like?

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

Intro to Theory of Computation

Lecture 3: Nondeterminism, NP, and NP-completeness

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

BBM402-Lecture 11: The Class NP

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

NP Completeness and Approximation Algorithms

1. Introduction Recap

SAT, NP, NP-Completeness

NP-problems continued

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

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

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

Lecture 3: Reductions and Completeness

Formal definition of P

Principles of Knowledge Representation and Reasoning

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Lecture 16: Time Complexity and P vs NP

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

Notes for Lecture 21

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

Umans Complexity Theory Lectures

Space Complexity. The space complexity of a program is how much memory it uses.

Intractable Problems. Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions

CSE 105 THEORY OF COMPUTATION

Computational Complexity

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

Introduction. Pvs.NPExample

Problems, and How Computer Scientists Solve Them Manas Thakur

Time Complexity. CS60001: Foundations of Computing Science

NP-Completeness Theory

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Automata Theory CS Complexity Theory I: Polynomial Time

Review of Complexity Theory

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

The Cook-Levin Theorem

The P versus NP Problem. Dean Casalena University of Cape Town CSLDEA001

NP-Completeness. Subhash Suri. May 15, 2018

NP-Complete problems

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

NP and NP Completeness

Notes on Complexity Theory Last updated: October, Lecture 6

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

About the impossibility to prove P NP or P = NP and the pseudo-randomness in NP

6-1 Computational Complexity

M is a TM with start state s defined over the alphabet {#,(,),0,1,a,q,,}:

CSE 105 THEORY OF COMPUTATION

CS 6505, Complexity and Algorithms Week 7: NP Completeness

Transcription:

Review of unsolvability L L H To prove unsolvability: show a reduction. To prove solvability: show an algorithm. Unsolvable problems (main insight) Turing machine (algorithm) properties Pattern matching and replacement (tiles, formal systems, proofs etc.) Autumn 2008 1 of 24

Complexity Unsolvable Horrible (intractable) Nice (tractable) Horrible problems are solvable by algorithms that take billions of years to produce a solution. Nice problems are solvable by proper algorithms. We want techniques and insights Complexity resources: time, space complexity classes: P(olynomial time), NP-complete, Co-NP-complete, Exponential time, PSPACE,... Autumn 2008 2 of 24

Goal... EXP TIME PSPACE Co NP NP P Map of classes = complete or "hardest" problems in a class Autumn 2008 3 of 24

Complexity: techniques Impossible Horrible (intractable) Nice (tractable) Intractable, best algorithms are infeasible Tractable, solved by feasible algorithms Problems Complexity classes Horrible N P-complete, N P-hard, PSPACE-complete, EXP-complete,... Nice P (Polynomial time) Goal of complexity theory Organize problems into complexity classes. Put problems of a similiar complexity into the same class. Complexity reveals what approaches to solution should be taken. Complexity theory will give us an organized view of both problems and algorithms. Autumn 2008 4 of 24

Time complexity and the class P We say that Turing machine M recognizes language L in time t(n) if given any x as input M halts after at most t( x ) steps scanning Y or N on its tape, scanning Y if and only if x L. ( x is the input length the number of TM tape squares containing the characters of x) Note: We are measuring worst-case behavior of M, i.e. the number of steps used for the most difficult input. We say that language L has time complexity t(n) and write L TIME ( t(n) ) if there is a Turing machine M which recognizes L in time O (t(n)). Polynomial time P= k TIME (n k ) Note: P (as well as every other complexity class) is a class (a set) of formal languages. Autumn 2008 5 of 24

Nice or tractable P Real time on a PC/Mac/Cray/ Hypercube/... Turing machine time (number of steps) Computation Complexity Thesis All reasonable computer models are polynomial-time equivalent (i.e. they can simulate each other in polynomial time). Consequence: P is robust (i.e. machine independent). Worst-case Real-world complexity difficulty Feasible Polynomial-time solution algorithm t(n) O (t(n)) Argument: for large-enough n... n 100 n log n. Yes, but only for n > 2 100. Argument: Functions like n 100 or n log n don t tend to arrise in practice. n 2 2 n already for small or medium-sized inputs: 2 n n 2 Autumn 2008 6 of 24

Polynomial-time simulations & reductions We say that Turing machine M computes function f(x) in time t(n) if, when given x as input, M halts after t( x ) = t(n) steps with f(x) as output on its tape. Function f(x) is computable in time t(n) if there is a TM that computes f(x) in time O (t(n)). For constructing the complexity theory we need a suitable notion of an efficient reduction : M M L R 2 M L1 We say that L 1 is polynomial-time reducible to L 2 and write L 1 L 2 if there is a polynomial-time computable reduction from L 1 to L 2. Autumn 2008 7 of 24

For arguments of the type L 1 is hard/complex L 2 is hard/complex we need the following lemma: Lemma 1 A composition of polynomial-time computable functions is polynomial-time computable. Proof: x M f 1 (x) M f 1 f 2 t 1 t 2 t f ( f 1 (x)) 2 f 1 (x) t 1 ( x ) because a Turing machine can only write one symbol in each step. polynomial polynomial = polynomial or ( n k ) l = n k l t 2 ( f1 (x) ) is a polynomial. TIME (t) = t 1 ( x ) + t 2 ( f1 (x) ) is a polynomial because the sum of two polynomials is a polynomial. Autumn 2008 8 of 24

all solvable problems (computationally) hard easy We want to make a cut! Strategy It is the same as before (in uncomputability): Prove that a problem L is easy by showing an efficient (polynomial-time) algorithm for L. Prove that a problem L is hard by showing an efficient (polynomial-time) reduction (L 1 L) from a known hard problem L 1 to L. Difficulty Finding the first truly/provably hard problem. Way out Completeness & Hardness Autumn 2008 9 of 24

N P-completeness How to prove that a problem is hard? Completeness We say that language L is hard for class C with respect to polynomial-time reductions, or C-hard, if every language in C is polynomial-time reducible to L. We say that language L is complete for class C with respect to polynomial-time reductions, or C-complete, if L C and L is C-hard. Other kinds of reductions may be used Note: If L is C-complete/C-hard and L is easy (L P) then every language in C is easy. L is C-complete means that L is hardest in C or that L characterizes C. Autumn 2008 10 of 24

N P (non-deterministic polynomial time) A non-deterministic Turing machine (NTM) is defined as deterministic TM with the following modifications: NTM has a transition relation instead of transition function δ { ((s, : 0), (q1, b, R) ), ( (s, 0), (q 2, 1, L) ) },... NTM says Yes (accepts) by halting Note: A NTM has many possible computations for a given input. That is why it is non-deterministic. initial config. time accept t (n) Mathematician doing a proof NTM The original TM was a NTM Autumn 2008 11 of 24

We say that a non-deterministic Turing machine M accepts language L if there exists a halting computation of M on input x if and only if x L. Note: This implies that NTM M never stops if x / L (all paths in the tree of computations have infinite lengths). We say that a NTM M accepts language L in (non-deterministic) time t(n) if M accepts L and for every x L there is at least one accepting computation of M on x that has t( x ) or fewer steps. We say that L NTIME ( t(n) ) if L is accepted by some non-deterministic Turing machine M in time O (t(n)). NP = k NTIME (n k ) Note: All problems in N P are decision problems since a NTM can answer only Yes (there exists a halting computation) or No (all computations run forever). Autumn 2008 12 of 24

The meaning of L is N P-complete Complexity Many people have tried to solve N P-complete problems efficiently without succeeding, so most people believe N P =P, but nobody has proven yet that N PCproblems need exponential time to be solved. L is computationally hard (L N P-complete): L P N P = P Physiognomy Checking if x L is easy, given a certificate. Autumn 2008 13 of 24

Example: HAMILTONICITY v 5 v 4 v 1 v 2 v 3 A deterministic algorithm must do exhaustive search: v 1 v 4 v 3 v 2 backtrack ց v2 n! possibilities (exponentially many!) A non-deterministic algorithm can guess the solution/certificate and verify it in polynomial time. time v 3 1 v 4 1 v 5 1 v1 1 v Certificate: (1,1,1,1,1) 2 2 1 v 1 3 v 5 Autumn 2008 14 of 24 2 v 4 v 3 v2 bactracking v1 to v 1 v 2 Note: A certificate is like a ticket or an ID.

Proving N P-completeness 1. L N P Prove that L has a short certificate of membership. Ex.: HAMILTONICITY certificate = Hamiltonian path itself. 2. L N P-hard Show that a known N P-complete language (problem) is polynomial-time reducible to L, the language we want to show N P-hard. L First NP-complete language L L np L 1 L 2 L 3 Autumn 2008 15 of 24

Skills to learn Transforming problems into each other. Insight to gain Seeing unity in the midst of diversity: A variety of graph-theoretical, numerical, set & other problems are just variants of one another. But before we can use reductions we need the first NP-hard problem. L 0 L n L 1 L 2 NP Strategy As before: Cook up a complete Turing machine problem Turn it into / reduce it to a natural/known real-world problem (by using the familiar techniques). Autumn 2008 16 of 24

BOUNDED HALTING problem L BH = { (M, x, 1 k ) NTM M accepts string x in k steps or less } Note: 1 k means k written in unary, i.e. as a sequence of k 1 s. Theorem 1 L BH is N P-complete. Proof: L BH N P k=4 C 0 (initial config.) 2 3 1 4 1 2 3 1 1 2 time (steps) accept Certificate: (4, 2, 1, 2). The certificate, which consists of k numbers, is short enough (polynomial) compared to the length of the input because k is given in unary in the input! Autumn 2008 17 of 24

L BH N P-hard x (M,x,1 P M ( x ) ) YES YES M R M BH NO M L NO For every L N P there exists by definition a pair (M, P M ) such that NTM M accepts every string x that is in L (and only those strings) in P M ( x ) steps or less. Given an instance x of L the reduction module M R computes (M, x, 1 P M( x ) ) and feeds it to M BH. This can be done in time polynomial in the length of x. If M BH says YES, M L answers YES. If M BH says NO, M L answers NO. Autumn 2008 18 of 24

SATISFIABILITY (SAT) The first real-world problem shown to be N P-complete. Instance: A set C = {C 1,..., C m } of clauses. A clause consists of a number of literals over a finite set U of Boolean variables. (If u is a variable in U, then u and u are literals over U.) Question: A clause is satisfied if at least one of its literals is TRUE. Is there a truth assignment T, T : U {TRUE, FALSE}, which satisfies all the clauses? Example I = C U C = { (x 1 x 2 ), ( x 1 x 2 ), (x 1 x 2 ) } U = {x 1, x 2 } T = x 1 TRUE, x 2 FALSE is a satisfying truth assignment. Hence the given instance I is satisfiable, i.e. I SAT. {C = { (x 1 x 2 ), (x 1 x 2 ), ( x 1 ) } I = U = {x 1, x 2 } is not satisfiable. Autumn 2008 19 of 24

Theorem 2 (Cook 1971) SATISFIABILITY is N P-complete. Proof main ideas: BOUNDED HALTING There is a computation SATISFIABILITY There is a truth assignment computation (computation) matrix Example: input (M, 010, 1 4 ) k b b b b b b b b b b b k b b b b b b b b b b b b b b b b b b q 1 b b b 0 b b b s 0 1 q 0 2 Y h q 3 b 1 0 b k b Computation matrix A is polynomial-sized (in length of input) because a TM moves only one square per time step and k is given in unary. Autumn 2008 20 of 24

tape squares boolean variables Ex. Square A(2, 6) gives variables B(2, 6, 0), B(2, 6, b), B(2, 6, q 0 0 ), etc. but only polynomially many. input symbols single-variable clauses Ex. A(1, 5) = s 0 gives clause ( B(1, 5, s 0 )) C. Note that any satisfying truth assignment must map B(1, 5, 0 s ) to TRUE. rules/templates if-then clauses d ( (B(i Ex. a b c gives 1, j, a) B(i, j, b) B(i + 1, j, c) ) ) B(i, j + 1, d) C. Note: (u v w) z u v w z Since the tile can be anywhere in the matrix, we must create clauses for all 2 i 2k and 1 j k, but only polynomially many. Autumn 2008 21 of 24

non-determinism choice variables Ex. G(1) F T k=4 G(2) F T F T... G(t) tells us what non-deterministic choice was taken by the machine at step t. We extend the if-then clauses with k choice variables: ( G(t) a b c d ) ( G(t) ) Note: We assume a canonical NTM which has exactly 2 choices for each (state,scanned symbol)-pair. halts (if it does) after exactly k steps. Autumn 2008 22 of 24

Further (basic) reductions BOUNDED HALTING SATISFIABILITY (SAT) 3SAT 3-DIMENSIONAL MATCHING (3DM) VERTEX COVER (VC) PARTITION HAMILTONICITY CLIQUE Polynomial-time reductions (review) L 1 L 2 means that R : such that x L 1 f R (x) L 2 and x L 1 f R (x) L 2 L 1 L 2 Σ * Σ * R P f, i.e. R(x) is polynomial computable Autumn 2008 23 of 24

SATISFIABILITY 3-SATISFIABILITY SAT 3SAT Clauses with any Clauses with number of literals exactly 3 literals C j is the j th SAT-clause, and C j corresponding 3SAT-clauses. is the y j are new, fresh variables, only used in C j. C j C j (x 1 x 2 x 3 ) (x 1 x 2 x 3 ) (x 1 x 2 ) (x 1 x 2 y j ), (x 1 x 2 y j ) (x 1 ) (x 1 yj 1 y2 j ), (x 1 yj 1 y2 j ), (x 1 yj 1 y2 j ), (x 1 yj 1 y2 j ) (x 1 x 8 ) (x 1 x 2 y 1 j ), ( y1 j x 3 y 2 j ), ( y 2 j x 4 y 3 j ), ( y3 j x 5 y 4 j ), ( y 4 j x 6 y 5 j ), ( y5 j x 7 x 8 ) Question: Why is this a proper reduction? Autumn 2008 24 of 24