
What if P = NP? - caustic
http://cacm.acm.org/magazines/2009/9/38904-the-status-of-the-p-versus-np-problem/fulltext
======
arethuza
A nice wee Charlie Stross story that begins with news of someone finding a
proof of P=NP (Readability recommended):

[http://www.antipope.org/charlie/blog-
static/fiction/toast/to...](http://www.antipope.org/charlie/blog-
static/fiction/toast/toast.html#antibodies)

~~~
burgerbrain
Some people have zombie apocalypse plans.

Me? I have P=NP plans.

------
lkozma
There's a funny poll on P=?NP that William Gasarch conducted among computer
scientists: <http://www.cs.umd.edu/~gasarch/papers/poll.pdf>

Some argue that the question is not as important as it is widely believed to
be (see Sariel Har-Peled's opinion in the poll) - many NP hard problems have
practical approximations, many P problems are prohibitively costly to solve.

~~~
bdhe
> many NP hard problems have practical approximations, many P problems are
> prohibitively costly to solve.

I don't know if there is more to Sariel Har-Peleed's piece than the one
paragraph in the poll, but as of today, most P problems used in practice
actually have a very good running time O(n^3) or O(n^4). I don't know if there
are too many problems that are in P but only "theoretically".

Also, even though P=?NP might not have very practical ramifications, if one
believes in the notion of asymptotic complexity, it raises fundamental
philosophical questions -- is judging creativity as easy as being creative.

As usual Scott Aaronson has excellent material on this question:
<http://www.scottaaronson.com/blog/?p=459>

~~~
lkozma
Well, n^3 or n^4 might already be considered impractical in many situation and
even linear time algorithms might have huge constants that make them
impractical.

I agree about the philosophical questions, but don't they also rely on the
practical ramifications of the question?

"is judging creativity as easy as being creative" What if P=NP, and for some
problem there is a practical polynomial algorithm for checking a solution but
only an impractical polynomial algorithm for finding a solution? What I mean
is that the philosophical ramifications also depend on the assumption that
polynomial~easy.

~~~
timtadh
>n^3 or n^4 might already be considered impractical in many situation

You can always make these arguments for large enough N and short enough time
constraints. It is an argument that as an engineer I sympathize with, but as a
computer scientist I cannot endorse. The question of P=?NP is a mathematical
and philosophical question. The problem of O(N) algorithms being too slow for
situation X is an engineering question.

So while I recognize and even sympathize with you point, I do not think it
detracts from the fundamental importance of the question at stake.

~~~
lkozma
True, there is the engineering aspect, but I didn't mean that, I was talking
about the same fundamental philosophical question you were.

That is, "are there problems for which we can easily verify a solution but not
easily find one". P=?NP is only relevant to this philosophical question, if we
accept that "polynomial" is synonymous with "easy". That is a widely accepted
statement, but not entirely obvious. As it was said in the linked poll, even a
polynomial running time could hide _contants_ so large, that it is
prohibitively large not just today but anytime in the future until the
universe collapses upon itself. On the other hand there can be NP-hard
problems for which we can find arbitrarily close approximations in reasonable
time. The question is how well are our theoretical efforts capturing this
intuition.

------
simonsarris
There was some good discussion about a P/NP for dummies article a while back,
here:

<http://news.ycombinator.com/item?id=1605415>

And by the same author as the story above, a good list of reasons for
believing that P probably != NP:

<http://www.scottaaronson.com/blog/?p=122>

------
dexen
What if the equality (or inequality) of P and NP is unprovable in the general
case? Practical considerations aside, it would probably feel like a recursive
joke ;-)

~~~
presidentender
The year is 2230. The Nuclear Winter has passed, and the water wars have come.

One mathematician - the last of his kind - dares to spend precious time
puzzling through theorems, seeking out ancient tomes of knowledge written in
arcane symbols. He is searching for a proof which meant something to his
ancestors hundreds of years ago.

One day, in a dusty library in what used to be called New England, he finds
it. Not only through reading the works of others, no, he has proven many new
theorems, and his results would have held application to the software efforts
of centuries ago. God weeps that there is no software now.

But he has at last found it, the final proof: that it cannot be proven that it
cannot be proven ... that it cannot be proven conclusively whether P = NP.

~~~
shasta
Suppose we could resolve (conclusively prove one way or the other) whether
P=NP. Then we could also prove that we could resolve whether P=NP. Thus, if we
can prove that you cannot prove that you can resolve P=NP, then we have also
proven that we cannot resolve P=NP, a contradiction. Thus proving that we
cannot prove that we cannot prove that we cannot resolve whether P=NP. This
proves that we cannot prove that we cannot prove that we cannot prove that we
cannot resolve whether P=NP. etc.

~~~
vecter
Let A be the statement: "P=NP or P!=NP" (in other words, suppose P vs. NP is
decidable in some chosen axiomatic system, like Zermelo-Fraenkel set theory
with or without axiom of choice).

You first said:

Suppose we proved A. Then we could also prove that we proved A. This is
practically a tautology, since if we proved A, of course we can prove we
proved A. I'll just hand you the proof.

Next, you said:

Suppose we can prove ~A (in other words, suppose we can prove that P vs. NP is
undecidable in the given axiomatic system). Contradiction!

To sum it up, you said: "Suppose A and ~A. Contradiction!"

Or am I missing something here?

~~~
shasta
Ya, it looks like I bungled the logic. Let 'Pr X' means 'X is provable'. Let A
be your A. Really what I wanted to say is that:

Pr A -> (~Pr ~Pr A)

and thus, Pr a -> Pr ~Pr ~Pr A.

Hence, ~Pr ~Pr ~Pr A -> ~Pr A

Taking A to be ~Pr A, we get:

~Pr ~Pr ~Pr ~Pr A -> ~Pr ~Pr A

So you can peel off pairs of ~Pr until you get down to one or two. Not very
surprising, I guess, since Pr A == A in constructive logic, and you can do
similar negation collapsing there.

------
tibbon
Can someone explain the P=NP thing to me? I've tried looking at the Wikipedia
article, but I'm going to admit right not that my computer science/mathematics
skills aren't as amazing as I'd like them to be.

Wouldn't that mean that N == 1 and that P == P?

~~~
presidentender
We're not multiplying N by P. P and NP are complexity classes.

Essentially, a problem is in class P (for polynomial) if an optimal solution
can be _found_ in polynomial time (that is, if the number of steps required to
solve the problem is at most a polynomial function of the number of factors to
check). So if you have a problem, and you can always solve it in polynomial
time, it's in P.

A problem is in class NP (for nondeterministic polynomial) if the optimality
of any solution can be _checked_ in polynomial time. So if you have what you
think is a solution, and you can always verify that in polynomial time, the
problem is in NP.

We know trivially that NP is a superset of P: any P problem has to be an NP
problem, because determining the solution in polynomial time counts as
checking that solution in polynomial time. What we're not sure of is whether
NP is a _proper_ superset of P: the two could be equivalent, and we could just
be overlooking polynomial-time algorithmic solutions to the problems we
currently believe to be NP but not P.

~~~
tibbon
Thanks for the answer. I'm not sure why I was downvoted, because I have looked
it up before but just didn't understand. Not everyone gets everything the
first time or went to school for CS so I highly appreciate you taking the time
to explain.

I'm curious also why this problem is so near and dear to many people. I'm not
sure I understand the implications.

~~~
presidentender
The fact that you don't understand why it's dear to so many makes me
completely sure that you don't understand the implications. I say that with
respect and joviality.

Much of what we do - particularly much of our security - is based on the idea
that P != NP, and that those "really hard" problems actually are really hard.
For instance, cryptography is based on the fact that prime factorization is
NP-hard, so if you use big primes it takes a long time to crack our encrypted
information. If P = NP, and someone solves any NP-complete problem, all the
NP-complete problems crumble and our security is a thing of the past.

There're good things to come of a constructive P = NP proof, too. We'd have
perfect network routing, for one thing. Shipping would be much more efficient.
And that damn salesman would finally know that he's getting from New York to
San Fransisco and back by way of hundreds of other cities as quickly as
possible.

~~~
dcosson
Factorization is NOT NP-hard. There has never been a proof that guarantees I
can't wake up tomorrow and factor any public key on the internet in polynomial
time. It just so happens that nobody has figured out how to do it in the
history of number theory (or to prove that it's impossible).

Shor's Algorithm factors primes. If prime factorization were NP-hard, that
would imply BQP=NP (BQP is Bounded-error Quantum Polynomial time), or at least
that BQP contains a subset of NP. Scott Aaronson, who has been linked to here
a few times, is firmly convinced that is not true. And the implications of it
are nearly as huge as the implications of P=NP! (with the small drawback that
we can't actually build quantum computers yet :)

~~~
presidentender
Factorization is indeed in NP. It might also be in P. I should've said "based
on the _idea_ that" instead of "the _fact_ that."

"Hello World" is NP. It's just not useful to talk about that fact.

~~~
bdhe
> Factorization is indeed in NP. It might also be in P. I should've said
> "based on the idea that" instead of "the fact that."

I'll reiterate. It is unknown if factorization is currently NP-hard. UKNOWN.
It is most likely NOT NP-hard otherwise there would be huge implications in
Complexity Theory.

It suffices for crypto for problems to be hard on an average. Factoring a
random product of two large primes is hard. Factoring is probably not NP hard
because no one knows if a factoring algorithm will help solve SAT.

~~~
presidentender
NP is a superset of P.

~~~
bdhe
I think I was mistaken in understanding what you said. Yes, factoring is in
NP, but it is not known to be NP-hard. Being in NP doesn't automatically imply
its usefulness in Crypto (because, as you say, P is a subset of NP). Neither
does the NP-hardness of a problem automatically imply its usefulness. Crypto
seems to need these weird problems that are not always NP-hard, yet, in some
sense, harder than NP-hard problems. You can think of it as: crypto => P !=
NP, but not vice-versa.

------
anorwell
Anyone who finds this speculation about "What if P = NP?" interesting should
try Impaggliazzo's excellent paper (it's very readable):

<http://cseweb.ucsd.edu/~russell/average.ps>

~~~
bdhe
This is a followup, 15 yrs later from the rest of the TCS community:

[http://cstheory.stackexchange.com/questions/1026/status-
of-i...](http://cstheory.stackexchange.com/questions/1026/status-of-
impagliazzos-worlds)

------
lyudmil
It would be a boon for laissez-faire capitalism, as it would prove that
markets are at least weak-form efficient.

Reference: <http://arxiv.org/abs/1002.2284>

~~~
randallsquared
Support for laissez-faire capitalism doesn't require that markets are
efficient in any absolute sense, but only that using force will not produce a
more efficient outcome in real-time. But I don't think people argue for
markets to be supplanted by force for efficiency reasons, as its already clear
that such a solution is intractable unless actor choices are restricted
significantly.

~~~
Tycho
Why did you add the phrase 'in real time' there? I don't follow (sincere
question)

~~~
randallsquared
Because given enough information about preferences and enough time to think
about it, coming up with a more efficient solution to a particular
distribution problem than the market did seems possible in principle.

~~~
Tycho
Ah, I'm with you now, thanks.

------
scythe
What would really be interesting is someone finding a _nonconstructive_ proof
that P = NP. It would be quite a scramble to find the missing algorithms...

~~~
bdhe
We already have algorithms for all NP problems, by Levin. See:
[http://en.wikipedia.org/wiki/P_versus_NP_problem#Polynomial-...](http://en.wikipedia.org/wiki/P_versus_NP_problem#Polynomial-
time_algorithms)

No one knows whether it runs in polynomial time though! It runs in polytime if
P=NP.

~~~
smallblacksun
"// "Polynomial-time" means it returns "yes" in polynomial time when // the
answer should be "yes", and runs forever when it is "no"."

That's an odd definition of polynomial time.

~~~
bdhe
It is just a technicality. If you know an upper bound on the running time you
can simply run it for that many time steps and then return "no" if it doesn't
halt by then (because it could never thereon answer "yes"). This only works
with concrete upper bounds on running time (and not for general decidability).

------
efnx
From the beginning of the article: "We know which students are compatible with
each other and we want to put them in compatible groups of two. We could
search all possible pairings but even for 40 students we would have more than
300 billion trillion possible pairings."

Can someone explain why there are 300 billion trillion pairings instead of
40^2 pairings - 40 repeat pairings - incompatible pairings ?

~~~
wnoise
Pairings involve matching everybody. There are indeed O(n^2) (well n*(n-1)/2)
ways of constructing the first match. But then the other n-2 people still need
to be paired up.

The exact number is n!/((n/2)!(2^(n/2))). There are n! ways to order them.
Pair each with his neighbor. The order of the pairs doesn't matter (divide by
(n/2)!). The order within each pair doesn't matter (divide by 2^(n/2)).

Using Stirling's approximation, the log of this is about n log n - (n/2) log
(n/2) - (n/2) log 2 = (n/2) log n. The exponential is then n^(n/2). 40^20 is
rather large at 109 nonillion. Because we approximated the log, this
significantly off. The right answer is 319 sextillion.

~~~
27182818284
Thanks for this! I was confused myself.

[http://www.wolframalpha.com/input/?i=n%21%2F%28%28n%2F2%29%2...](http://www.wolframalpha.com/input/?i=n%21%2F%28%28n%2F2%29%21%282^%28n%2F2%29%29%29%2C+n%3D40)

seems to give 319830986772877770815625

It can also be done by thinking 39 * 37 * 35 * ... * 1 which also yields the
same number. In that way, it is like selecting 1 person, who then has 39
people remaining, then selecting another, who has 37 left to choose from and
so on.

I was super confused at first why it wasn't just 40 choose 2.

------
Tycho
If aliens arrived and told us P is not NP, would it still be worth trying to
prove? What do you gain from the negative (except freed time to tackle other
problems)?

------
timinman
Thanks, that's the first of these P = NP posts that explained it for someone
uninitiated to the discussion!

------
NY_USA_Hacker
Okay, the question of P versus NP is important. Now keep in mind that I
admitted this when read the rest below:

Contention: In this research question of P versus NP and in the paper, we are
looking at:

(1) A Lot of Hype.

(2) A Search for a Very Long Term Academic Job.

(3) Significant Amounts of Nonsense.

Details:

(1) A Lot of Hype.

(1.A) Nowhere in the article are there any very good explanations that a
polynomial algorithm that shows that P = NP would be fast in any practical
sense.

Indeed, the article has:

"Technically we could have P = NP, but not have practical algorithms for most
NP-complete problems. But suppose in fact we do have very quick algorithms for
all these problems."

So, to make such a polynomial algorithm of practical interest, we have to just
"suppose" that it will be fast in practical terms.

(1.B) With the "suppose" above, the article has:

"Since all the NP-complete optimization problems become easy, everything will
be much more efficient. Transportation of all forms will be scheduled
optimally to move people and goods around quicker and cheaper. Manufacturers
can improve their production to increase speed and create less waste. And I'm
just scratching the surface."

No, it's just "scratching" and not "just scratching the surface."

I can absolutely, positively assure all readers that there are plenty of
reasonably efficient and powerful means to attack such problems in practice
now. In fact, the people flying airplanes, running manufacturing plants,
designing large telecommunications networks, etc. are not much interested in
attacking these problems with optimization. The main reason is: They just
don't want to be bothered. In particular, these problems have long been part
of the field of 'operations research', that has long been a dead field, a
"late parrot", a dead duck.

Just what is it about people don't want to be bothered that is so difficult
for the author of the paper to understand?

(1.C) Solve It All.

The suggestion in the article is that the question of P versus NP is the grand
question and, thus, the last big problem in computational complexity.

Let's see: For many of the optimization problems in, say, airline scheduling,
manufacturing scheduling, telecommunications network design, given an optimal
solution, over the coming few hours, days, or weeks, real world uncertainty
commonly will make that solution out of date and far from 'optimal'. So, the
real problem that needs to be attacked in practice is optimization over time
under uncertainty, and there was no hint of such problems in the paper or that
showing that P = NP would provide solutions. Net, it is not clear from the
paper that the NP-complete problems cover all the challenges that remain.

A lot of hype.

(2) A Search for a Very Long Term Academic Job.

The paper ends with:

"Perhaps we will see a resolution of the P versus NP problem in the near
future but I almost hope not."

Of course he hopes not: As long as the problem is not solved, a lot of
researchers chipping away on apparently quite distant parts continue to have a
very stable career!

(3) Significant Amounts of Nonsense.

The article has:

"everything will be much more efficient. Transportation of all forms will be
scheduled optimally to move people and goods around quicker and cheaper.
Manufacturers can improve their production to increase speed and create less
waste."

Glad he's interested in "less waste". But, let's see on three points:

(3.A) Approximately Optimal

Commonly in such cost minimization optimization problems now, we report two
numbers: First we report the cost of the feasible, but perhaps not optimal,
solution we did find. Second we report a lower bound on the cost of an optimal
solution. When these two numbers are close for our practical problem, we quit
and accept the feasible and approximately optimal solution.

The last time I did this, I had a 0-1 integer linear program with 600,000
variables and 40,013 constraints and found a feasible solution with cost only
0.025% higher than the lower bound, in 905 seconds on a 90 mHz PC.

So, the practical problem is, can we find techniques that get a feasible
solution and a lower bound close enough for practice nearly always on the
practical problems we face?

Nowhere did the paper recognize this problem or indicate a close connection
with the challenge of P versus NP.

Yes, we can ask, given the optimization problem and a cost c, is there a
feasible solution with cost less than c? So, since we can check a proposed
solution quickly, this is a problem in NP. Then on this problem we can do a
binary search on c and converge to optimality. So if this NP problem is in P,
then with the binary search our optimal algorithm is also in P.

But it is not clear if this is the same problem as, can we get a feasible
solution (in reasonable time, nearly always, on our practical problems) with
cost c only 1% higher than a lower bound u? Or only 1% above the cost of an
optimal solution (we don't know the cost of an optimal solution).

So, the question P versus NP is much more difficult than demanded by practice.

(3.B) The Big Savings.

The paper has,

"everything will be much more efficient."

This conclusion is unsupported, wildly unjustified, and from experience
nonsense. It is not the least bit clear that optimal solutions will on average
cost significantly less than the approximately optimal solutions commonly
available now.

(3.C) The Cartoon.

Early in the reference,

Michael R. Garey and David S. Johnson, 'Computers and Intractability: A Guide
to the Theory of NP-Completeness', ISBN 0-7167-1045-5, W. H. Freeman, San
Francisco, 1979.

and praised in the paper, is a cartoon with an executive sitting behind a
desk, a researcher standing just in front of the desk and stretching behind
him over the horizon a long line of researchers, and the researcher explaining
to the executive that he, the researcher, can't solve the executive's problem
but neither can any of the researchers in the long line because none of them
could settle P versus NP.

Nonsense. Made up, junk-think, make-work, prof-scam, busy-work nonsense: The
executive's problem was just to save nearly all the money nearly all the time
on the real problems, or at least to save some significant money sometimes,
and not to guarantee to save all the money, down to the last tiny fraction of
one penny, with polynomial computer time, on worst case problems, the worst
that can exist even in theory.

Instead the researcher deliberately bamboozled the executive by converting his
problem into one the researcher could have an excuse to work on for the rest
of his career without getting a solution.

There is one more curious point.

The paper mentioned:

"Consider the traveling salesperson problem again with distances between
cities given as the crow flies (Euclidean distance). This problem remains NP-
complete but Arora4 gives an efficient algorithm that gets very close to the
best possible route."

where his reference is

Arora, S. Polynomial time approximation schemes for Euclidean traveling
salesman and other geometric problems. J. ACM 45, 5 (Sept. 1998), 753–782.

While I don't know this paper, there is the highly curious,

Richard M. Karp, "The Probabilistic Analysis of Some Combinatorial Search
Algorithms," pages 1-19, 'Algorithms and Complexity: New Directions and Recent
Results', edited by J. F. Traub, Academic Press, New York, 1976.

So, here's what to do: Given a traveling salesman problem in the plane (or any
finite dimensional space) with just Euclidean distances, pick a city, from
that city build a minimum spanning tree connecting all the cities (well-known
to be polynomial and fast). Then for the traveling salesman tour, just do a
depth-first traversal of that tree except do not 'backtrack' in the tree and
revisit cities and, instead, just take the direct link to the next city to be
visited in the traversal.

Then for cities selected randomly with meager and reasonable assumptions, and
as the number of cities n grows, the solutions have distance as close as we
please to optimality with probability as high as we please less than 1.

So, for big problems, as long as all we are trying to do is save some travel
distance, no problem. For small problems, enumerate!

Broadly, the question of P versus NP does not connect very well with the real
needs of optimization in practice.

Ah, never let the real facts get in the way of an exciting story!

~~~
possibilistic
I want to live in a P = NP world. Perhaps airline scheduling isn't something
to get excited over, but in my field a P = NP world would be the holy grail.

Imagine being able to engineer proteins. _ENGINEER PROTEINS_. Not just study
them or do domain fusions, but to actually be able to design structures to
fill a particular need. We could plug into existing metabolic pathways or we
could develop entirely novel ones, complete with complex logic circuitry that
models interaction with the physical world.

Pollution would be solved. Energy would be solved. Cells would become a new
and quite novel form of both computer and machine. A kind that can self-
replicate. A kind that we could now feasibly have _a compiler for._

Slightly tangent to biotech, consider the computational investigation of all
of chemical space. We could quickly and easily discover novel molecular
structures and automate their design. We could develop new synthesis reactions
and optimize chemical engineering. The products we buy today--think "mundane"
things like plastics, or shampoo--could become space age in a matter of years
if P = NP.

Too bad this appears to be a different universe I'm describing. In that world
all of the "magic" of the computer industry is essentially ported to all of
the science fields.

~~~
NY_USA_Hacker
I have some good news for you: For your goals, likely you do not have to wait
for P = NP, even if it is true.

Or, for your goals, you do not need the extreme guarantees of P = NP, that is,
guaranteed polynomial solutions for ALL your problems in NP, even the worst
case that can exist.

Instead, likely you can make nearly all the progress you have in mind with
some techniques that just happen to work well for your class of problems. This
is what the history shows. That is, people have been doing well solving NP-
complete problems well enough for decades without worrying about P versus NP.
So, learn some of what has been done, as I outlined and more, and then add to
that material in ways important for your problems.

Just MUST realize that the question of P versus NP has been formulated in a
way that makes it often shockingly far from getting valuable results in
practice. How can this be? Heavily because the P versus NP question
concentrates on the worst cases that can exist, and the average cases in
practice can be much, MUCH easier.

For more, pay close attention to the Department of Combinatorics and
Optimization at Waterloo and Nemhauser's department at Georgia Tech.

Generally it will be tough for me to believe that the field of DNA biology has
much knowledge of that material if only because very few people do. Indeed,
your desire for P = NP does indicate that your field lets the P versus NP
question keep it from going after the field's holy grail, likely for no good
reason. Each protein you can correctly fold, each valuable molecule you can
create, can be a big step ahead, even without P = NP. Net, f'get about P
versus NP.

Next, as I outlined, even if tomorrow someone shows an algorithm that shows P
= NP, there is no guarantee that that algorithm will be 'fast'. Instead,
something with integer linear programming, touched up with various techniques,
might solve nearly all your problems plenty well and be much faster.

Indeed, as in the classic Klee and Minty paper, the simplex algorithm is not
polynomial but in practice it totally knocks the socks off the polynomial
interior point algorithms. To be more clear, classic simplex runs in 3m where
m is the number of constraints and we get to ignore the number of columns. So,
classic simplex runs, in practice, faster than a polynomial of degree 1 in the
size of the input data. Still, it's 'exponential' in worst case. There are
more details on why in a classic paper by K. Borgward.

The polynomial algorithms for linear programming are way too slow for
practice.

So, I'm not just blowing smoke here: DO work on your problems but F'GET about
P versus NP.

------
williamdix
It makes me feel good about the $200,000 spent on my education that I got to
take classes with two of the people mentioned with important results. One of
them, Mulmuley, was the most intimidating professor I ever had, and I felt
very lucky to get out of that class with a C.

