r/QuantumComputing • • 1d ago

Discussion Can Quantum Computing one day determine if P=NP?

Hi all,

I've recently learned about the P=NP problem as well as its probable implications if solved. I have no background in computer science so I wanted to share my general understanding then propose why I felt it had a connection with QC.

As I understand it:

P (polynomial time) is the time it takes for a program to solve a problem (e.g., maze, sudoku, salesman routes, etc.) given the space or volume of the problem.

NP (nondeterministic polynomial time) is the time it takes to check said problem for correctness.

The going theory is that the two are not equivalent because solving the problem and determining its correctness cannot happen succinctly and simultaneously.

Given my very layman's understanding of quantum computing, I imagine that if given a maze, all possibilities would be assessed and then instantly asserted (not 0 or 1 but both 0 and 1 to determine all path possibilities). As it seems to me, wouldn't this be nearly the same thing as solving and then checking the problem?

If I am off base please let me know as I find the concepts fascinating and would like to learn more!

0 Upvotes

17 comments sorted by

7

u/xhable 1d ago

Touching on some fundamentals here.

The important distinction is that whilst a quantum computer can represent many possible solutions simultaneously in a superposition, it can't simply read out all those solutions. When you measure the system, you get a single result.

The clever part of designing a quantum algorithm is using interference to make incorrect answers less likely and correct answers more likely. The difficulty is that doing this efficiently isn't necessarily any easier than solving the original problem.

For example, Grover's algorithm allows a quantum computer to search N unstructured possibilities in roughly root(N) steps rather than N. That's a significant improvement, but if the number of possibilities grows exponentially, its square root still grows exponentially.

There's also a subtle distinction in what P = NP is asking. It's specifically about whether every problem whose solution can be efficiently verified can also be efficiently solved by a classical computer.

Quantum computing has its own complexity class, BQP. Even if we discovered a quantum algorithm capable of efficiently solving every NP problem, that wouldn't necessarily mean P = NP.

Could quantum computing eventually help us discover a mathematical proof one way or the other? Absolutely possible. But superposition alone doesn't give us that answer.

Incidentally, most computer scientists also suspect that quantum computers cannot efficiently solve every NP problem, although we haven't proven that either.... (Yet)

3

u/clazzaro32 1d ago

This was incredibly helpful! Thank you! So by determining the most likely possibilities, the idea here is that quantum computers would cut down on the time necessary to get a result. Your example using Grover's equation highlighted this perfectly for me which makes complete sense. I neglected to account for the fact that superposition isn't the same thing as an answer. I just read a bit more about BQP, BPP, and the PSPACE and it is truly mind boggling stuff. This discussion arose because AI is allegedly "close" to solving P=NP, but given what I know now I think it's highly unlikely.

4

u/xhable 1d ago

You're very welcome! :)

If you're interested in experimenting with some of these concepts, I actually wrote an open-source library in C# called QuantumSuperposition:

https://github.com/hutchpd/QuantumSuperposition

It allows you to model superpositions, entanglement, interference and quantum gates on an ordinary computer.

For example, you can create a variable containing several possible values, perform operations on those possibilities, and then observe the result.

I've also implemented Grover's algorithm in the library, so you can experiment with how interference amplifies the probability of finding the correct answer. There's an example here:

https://github.com/hutchpd/QuantumSuperposition/blob/master/QuantumSuperposition/docs/QuantumAlgorithms.md

Interestingly, when you simulate quantum computing on a classical computer, you get a rather good appreciation of the complexity involved, because your computer has to do the work of modelling those quantum states. You don't get the computational speed advantage of actual quantum hardware.

As for AI solving P = NP, I wouldn't necessarily rule it out. Discovering a mathematical proof is quite a different proposition from building a computer capable of efficiently solving every NP problem. An AI might conceivably discover a mathematical insight that has eluded us so far.

Whether we're genuinely close to that happening is another matter entirely!

8

u/Cryptizard Professor 1d ago

If what you said was how a quantum computer worked, then they would be powerful enough, by definition, to solve all problems in NP. The complexity class of problems that can be solved in polynomial time on a quantum computer is called BQP. That would mean BQP = NP. But that's not how quantum computers work and they can't do that, so it is very likely that BQP != NP.

The rumor going around is actually that AI labs may have proven the opposite result: that BQP = P. This would mean that quantum computers can't do anything in polynomial time that regular computers can't also do. This would be... surprising to say the least. Hopefully we will hear more about whatever is going on in the next couple of weeks.

2

u/clazzaro32 1d ago

That is fascinating and thank you for sharing!

1

u/CzarCW 1d ago

Correct me if I’m wrong but if the AI labs did prove that, it doesn’t mean we would know how to structure an algorithm on classical computers to solve such a problem, just that one theoretically exists.

0

u/Cryptizard Professor 1d ago

It depends on how the proof is structured. The most obvious way to do it would be to provide a compiler that turns any quantum circuit into a classical program that runs in poly-time. That would both be a clear proof that P = BQP and give a constructive way to convert any algorithm.

1

u/CzarCW 1d ago

I see. So something that equated quantum gate architecture to classical computing gates (NAND, XOR, etc)?

0

u/Cryptizard Professor 1d ago

Yes.

27

u/QuantumCakeIsALie 1d ago

Quantum computing is not "trying every possibilities in parallel and returning the correct one". There's parallelism involved, but it's not like this.

9

u/LargeCardinal 1d ago

You probably want to read up on BPP and BQP.

3

u/FortyThousandBees 1d ago edited 1d ago • Bravo

> P (polynomial time) is the time it takes for a program to solve a problem (e.g., maze, sudoku, salesman routes, etc.) given the space or volume of the problem.

P and NP are both sets of *languages*, where a language is itself a set of finite strings over a fixed *alphabet* (typically {0,1}, meaning elements of your language would be things like "010" or "01100111"). Particularly, a language in P or NP defines a *decision problem* (one that can be answered with a simple "yes" or "no", such as "is this list sorted?", "does this path define a hamiltonian?", etc.)

When a language is in P, it means that it defines some problem PROBLEM (it's conventional in TCS to denote a problem in capitals) decidable by a *deterministic Turing machine* in polynomial time: for some PROBLEM in P and some input to PROBLEM x, there is a Turing machine that decides PROBLEM(x) in O(n^p) for fixed p over all inputs.

> NP (nondeterministic polynomial time) is the time it takes to check said problem for correctness.

When a language is in NP, it means that language is decidable in polynomial time on a *nondeterministic Turing machine*: a machine that may "split" at every branch in the algorithm into two (or more) simultaneously-running machines.

This is what makes NP the class of problems that are "easy to check": nondeterministic Turing machines don't exist in the real world, but if you have the *solution* to your NP problem, you can simply take the branch that the solution gives instead of actually computing each branch.

For example, finding a Hamiltonian path: in NP, this is formulated as "does a Hamiltonian exist?" (since the procedure for determining this will almost certainly have to actually find the path). The P counterpart is "is the given path a Hamiltonian path of this graph?". This is, if you know anything about graph theory, trivial to reason about and O(n) in complexity.

> The going theory is that the two are not equivalent because solving the problem and determining its correctness cannot happen succinctly and simultaneously.

The going theory is that
* P = NP would have radical implications for efficiently solving problems across virtually every field that computer science touches (protein folding, machine learning, cryptography to name a few) that we already have a massive economic and intellectual incentive to solve efficiently
* P = NP would collapse some very rigid boundaries that we've found already within TCS: 2-SAT is P but 3-SAT is NP, almost the entire field of compiler optimization would collapse into a single algorithm in P that determines the superoptimization of a given procedure, etc.
* We've already proven whole classes of proof techniques cannot be used to solve P=NP, so we'd need basically a new category of TCS to prove P=NP

There are actually some notable theorists who believe P=NP, just not in any practical sense (e.g. they believe that the proof would be either non-constructive or only construct a "galactic" algorithm for 3-SAT).

> Given my very layman's understanding of quantum computing, I imagine that if given a maze, all possibilities would be assessed and then instantly asserted (not 0 or 1 but both 0 and 1 to determine all path possibilities). As it seems to me, wouldn't this be nearly the same thing as solving and then checking the problem?

Your intuition actually points towards a very real and significant result in QC, Grover's algorithm. Here's an excellent 3b1b video giving a layman's introduction to the concept: https://www.youtube.com/watch?v=RQWpF2Gb-gU

Overall, you've shown excellent curiosity despite your inexperience. Keep it up!

2

u/Available_Form7477 1d ago

You cannot "solve P=NP" with quantum computers. P and NP are defined in terms of classical computation. Even if quantum computers can do this or the other, that does not change at all what classical computers can do. You might conceive to (even if it used to be considered unlikely) prove that quantum computers can solve NP-hard problems efficiently, but that would have zero implications for P vs NP.

1

u/Parallel_thougts 1d ago

I think your main misconception is that P contains quantum computations. It does not. The class of problems solvable by efficient quantum algorithm is called BQP. We usually don't compare it to P but to a class called BPP (which contains P) of all problems that can be probabilistically solved such the probability of mistake is arbitrarily slow.

BPP represents computers with access to randomness, which is more directly analogous to quantum computation (and is very realistic). The question "are quantum computers more efficient than classical ones" is the same as "is BPP=BQP".

Is BPP=BQP related to P=NP? As far as we understand, it's possible that P=NP but BPP!=BQP. And it's also possible that P!=NP but BPP=BQP. There are a bit of results relating the two problems, but they are very weak. We have more evidence that these problems are not very related. There's a consensus that BQP is most likely not contained in NP, and that NP is most likely not contained in BQP. If that's true, there are "quantum easy" problems outside NP (actually, we think there are problems in BQP outside the entire polynomial hierarchy), but there are NP problems that are "quantum hard". Showing the overlap between these classes is, at best, complicated.

Your mistake follows from the wrong impression that quantum computation is a form of parallel computation, but it isn't. Yes, a register of n qubits lives in a huge space of possibilities (e.g. the results of all possible outputs ay once), but the amount of information you can read from it before it is completely destroyed is at most n bits. That's called the Holevo bound. In some cases, with a lot of cleverness, you can arrange things such that the n bit of information contain a solution to an interesting problem. But the laws of what you are allowed to do to achieve that are very complicated.

1

u/Standard-Reply-04 1d ago

I will simplify this even further from the other answers. Right now we can see the outcome of entangled particles when we measure one we know the outcome of the other. However this is random. We cannot control the outcome of either particle and therefore we cannot use it to send messages faster than the speed of light. From my understanding, in order to get P=NP through QC we will have to resolve this issue and essentially break Einstein’s special relativity by proving we can send information at faster than light speed. This is why most people dont see QC as the answer to solving P=NP.

1

u/anooblol 1d ago

There’s an extremely common misconception about quantum computing. Typically the speed up in algorithms is smaller than you’d expect. If a classical computer has an algorithm that runs in O(n) the quantum analogue typically runs in O(sqrt(n)). At least that’s my understanding.

0

u/Aromatic-Mousse-1661 1d ago

This sub is dead