Computability and computational complexity

Lecture 12: On P vs NP

Ion Petre Computer Science, Åbo Akademi University

Fall 2015 http://users.abo.fi/ipetre/computability/

December 9, 2015 http://users.abo.fi/ipetre/computability/ 1 Content

n The map of NP n Oracle machines n Settling P vs NP through oracles n The P vs NP question

q some historical pointers

q significance

q possible answers

q possible strategies

q possible consequences

December 9, 2015 http://users.abo.fi/ipetre/computability/ 2 The map of NP

n The class of NP-complete problems is very useful in classifying problems in NP q Crucial in settling the question of whether or not P¹NP q There are problems that are not known to be in either P or NP-complete n GRAPH ISOMORPHISM is in NP but not known to be either NP-complete or in P q Laszlo Babai (2015): GI can be solved with a quasipolynomial algorithm running in 2O(logc(n))!! q SUBGRAPH ISOMORPHISM is NP-complete! (for graphs G and H, does G have a subgraph that is isomorphic to H?) n Question: are there problems that are neither in P nor NP-complete? q Three cases possible in principle: 1. NP contains three distinct subclasses: P, NP-complete, problems that are neither 2. NP contains only two classes: P and NP-complete 3. NP contains only one class, i.e. P=NP q In fact, the second case is not possible!

December 9, 2015 http://users.abo.fi/ipetre/computability/ 3 The map of NP

NP NP n Theorem. If P¹NP, then there is a language in NP which is neither P, nor is it NP-complete. NP-complete

q Proof – skip it. P=NP= ¹Æ NP-complete n Note the unary case:

q Theorem (Berman, 1978). If there exists P an NP-complete unary language UÍ{0}*, then P=NP. NP

NP-complete

P

December 9, 2015 http://users.abo.fi/ipetre/computability/ 4 Oracles

n Analogy is a favorite method of reasoning and of proving results

q Given a difficult problem, we look for a “similar” problem that has occurred elsewhere, in an “alternative universe” n Question: How would the problem P¹NP look in an “alternative universe”? n Additional questions: What is an “alternative universe” for computational complexity? What is “our universe” for computational complexity?

q Our universe: no computation is for free!

q Alternative universe: some (not all) computations are perhaps for free! n For example, at some point in a computation, the algorithm asks a question, such as whether a certain Boolean formula it currently considers is satisfiable, and it gets an instantaneous answer to it n This is the world of “oracles”, where an oracle for SAT can answer all our SAT questions for free (instantaneously) n Is P¹NP in the alternative universe?

q Surprising answer!

December 9, 2015 http://users.abo.fi/ipetre/computability/ 5 Oracles – continued

n Definition. A Turing machine M? with oracle is a multi-tape, deterministic TM that has a special tape called the query tape, and three special states:

q q? (query state) q qYES, qNO (answer states) Let AÍS* be an arbitrary language that will function as an oracle for M?. The computation of M? with oracle A proceeds like an ordinary TM, except for transitions from the query state: ? q from q?, M moves to either qYES or qNO depending on whether the current string on the query tape is in A or not q the answer thus allows the machine to change its computation The computation of M? with oracle A on input x is denoted MA(x). n Time complexity defined exactly as for ordinary TM – even the query steps only count as one, no matter how difficult the query is to decide n Nondeterministic TM with oracles defined exactly as before n If C is any (deterministic or nondeterministic) time , we can define CA to be the class of languages decided (or accepted) by machines of the same type and time bound as in C, only that they have access to oracle A

December 9, 2015 http://users.abo.fi/ipetre/computability/ 6 Deciding P vs. NP with oracles

n Theorem. There is an oracle A for which PA=NPA.

q Proof. The idea is to consider an oracle that either makes deterministic computations much more powerful, or renders nondeterminism powerless

q There is one complexity result that we discussed in Lecture 6 where nondeterminism makes no difference: PSPACE=NPSPACE

q Consider as an oracle A any PSPACE-complete language

q Then PSPACE Í PA Í NPA Í NPSPACE = PSPACE n First inclusion: since A is PSPACE-complete, any language in PSPACE can be decided by a polynomial-time deterministic machine that reduces it first to A and then uses the oracle once n Second inclusion: trivial n Third inclusion: any nondeterministic machine with oracle A can be simulated by a nondeterministic polynomial space-bounded machine where the query to A is replaced with the computation A(x) (which is polynomially space-bounded because A is in PSPACE) n Fourth equality: by Savitch’s theorem (see Lecture 6)

December 9, 2015 http://users.abo.fi/ipetre/computability/ 7 Deciding P vs NP with oracles – continued

n Theorem. There is an oracle B for which PB¹NPB.

q Proof. We skip it here.

q Only point out that we need an oracle B that greatly enhances the power of nondeterminism B B n q The language used in the proof with LÎ NP -P is L={0 : there is xÎB with |x|=n}

December 9, 2015 http://users.abo.fi/ipetre/computability/ 8 n Conclusions.

q Reasoning by analogy does not work for the P ¹ NP problem

q The question P¹NP will not be settled by a proof that can be carried over oracle machines, i.e., by proofs that “transcend” worlds n note that many of the techniques discussed in this course can be carried over verbatim from one world to another

q Using oracles can be useful as an exploratory proof technique. Proving that CA¹DA shows that it is quite possible that C¹D and that probably there is no trivial proof that C=D

December 9, 2015 http://users.abo.fi/ipetre/computability/ 9 The remaining of this lecture is based on R.J.Lipton – “The P=NP question and Gödel’s lost letter”, Springer 2010

THE P=NP QUESTION

December 9, 2015 http://users.abo.fi/ipetre/computability/ 10 History

n 1956: Gödel writes a letter to von Neumann where he formulates a problem very closely related to P vs NP

q Gödel’s “lost letter” n 1971: Stephen Cook formalizes the notion of reduction, defines NP-completeness, proves that SAT is NP-complete, formulates the question of whether P=NP (albeit not in this form)

q Very few pay attention

q Results formulated from the perspective of logic (similarly as Gödel)

q Same results/notions independently by Leonid Levin in USSR n 1972: Richard Karp writes a paper where he formulates the question of whether P=NP in the form that we now know, proves that 21 combinatorial problems are NP-complete

q Places Cook’s results in a central position in Computer Science

q Approaches the results from the point of view of practical computer science

q Shows that it has wider consequences than Cook and Gödel thought

q Helps galvanize the computer science community quickly n 1972: Michael Rabin quickly organizes a conference where Karp presents his work, publishes a book including Karp’s paper, giving it more visibility

December 9, 2015 http://users.abo.fi/ipetre/computability/ 11 Solving the problem

n Proving P=NP

q Direct method: Choose your favourite NP-complete problem and give it a polynomial algorithm

q Indirect method: contradict a result that holds if P=NP n Proving P¹NP

q Direct method: Choose your favourite NP-complete problem and prove that it cannot have a polynomial-time deterministic algorithm

q Indirect method: contradict a result that holds if P¹NP

December 9, 2015 http://users.abo.fi/ipetre/computability/ 12 Is P=NP well posed?

n Compare with the Riemann Hypothesis

q Prime number theorem: p(x), the number of primes less than x, is well x approximated by the logarithmic integral: p(x)=ò0 dt/log(t)+E(x) and E(x)=o(x/log x) is the error term 1/2 q RH implies that the error term is order x , ignoring logarithmic terms

q RH is “binary”: having even one single zero not on the “critical line” destroys the bound

December 9, 2015 http://users.abo.fi/ipetre/computability/ 13 Is P vs NP well posed? – continued

n P vs NP: very different type of behavior

q There might be an algorithm for SAT running in a reasonable time bound n This would be a great result, with extraordinary practical consequences

q There might be an algorithm for SAT that is polynomial but with a very high exponent, say O(n10) n It would solve the problem without much consequence for practical computer science (e.g. for cryptography)

q There might be an algorithm for SAT that is polynomial in a very weak sense, e.g. with a running time 100 n222 n No consequences for practical computer science c q There might be an algorithm for SAT running in time n , with an unknown constant c

December 9, 2015 http://users.abo.fi/ipetre/computability/ 14 So what if P¹NP?

n Possible proofs that P¹NP. What are their consequences? n q SAT might require exponential time. Perhaps something like 1.2 . Or how about 1.0000001n?

q SAT might have wild complexity For example, polynomial for an infinite number of n, exponential for an infinite number of n log log log n q SAT might have a barely super-polynomial complexity, say n n All of these would solve the problem, but the answer would not quite settle whether SAT is truly “intractable”

December 9, 2015 http://users.abo.fi/ipetre/computability/ 15 P vs NP: a problem with three possible answers?

n P=NP: there is a “practical” polynomial algorithm for SAT

q Question: would there be practical algorithms for all NP-complete problems? n P»NP: there is a “non-practical” polynomial algorithm for SAT

q The algorithm would be polynomial but with a huge exponent

q This would prove that P=NP but it would have little consequences in practice n P¹NP: there is no polynomial time algorithm for SAT (or any other NP- complete problem)

December 9, 2015 http://users.abo.fi/ipetre/computability/ 16 Why do people believe that P¹NP

1. P=NP would be “too good to be true”. q Some argue that this would end human creativity

2. P=NP would imply that thousands of NP-complete problems are in P. q Since among them are problems of very different nature, it would be surprising to find a universal method for all

3. P=NP might put an end to modern cryptography

4. P=NP would go against known results in automata theory where nondeterminism is known to be very powerful q exponential blow-up in state complexity from DFA to NFA; q it adds power to pushdown automata

5. …

December 9, 2015 http://users.abo.fi/ipetre/computability/ 17 SAT in practice

n On the practical side of the CS community, many claim that “in practice”, all instances of SAT that arise naturally are easily handled by existing SAT solvers

q Question: Why? Is this a sign that in fact P=NP? n On the theoretical side of the CS community, many believe that P¹NP

q This clearly contradicts the belief of the practical side of the community n Unclear what makes “real” SAT instances easy (when they are indeed easy) n Possibly a problem in the very definition of our complexity classes

q Worst-case complexity not fully relevant in practice

December 9, 2015 http://users.abo.fi/ipetre/computability/ 18 The worst case model for complexity

n Advantage

q It gives a guarantee of the behavior of the algorithm in all possible cases n Disadvantage

q Because it has to say something about ALL possible cases, it cannot say that the vast majority of the cases (or perhaps the “real-world” cases) can in fact have a much better behavior n Alternatives

q Average case complexity: complexity for inputs that come from random distributions

q How can we capture the “real-world” cases? This is perhaps one of the great challenges in complexity theory today.

December 9, 2015 http://users.abo.fi/ipetre/computability/ 19 What happens when P vs NP is resolved?

n Compare to the saga of Andrew Wiles’s proof of Fermat’s theorem n Periodically there are excited announcements of “proofs”

q Some are easily dismissed, especially when coming from hobbyists

q Some are actually serious attempts by professional mathematicians

q How to handle the excitement, the possible embarrassment n How many can check the proof? n Computer-based proofs n It is all in the details of the proof

q Recall the earlier argument on the possible solutions

q Having a simple, oracle-like answer to the problem is not quite satisfactory

December 9, 2015 http://users.abo.fi/ipetre/computability/ 20 Learning objectives

n Oracle machines n The status of P vs NP for oracle machines n Perspectives on the P=NP problem

q types of possible answers

q possible consequences

December 9, 2015 http://users.abo.fi/ipetre/computability/ 21