less_retarded_wiki/p_vs_np.md

18 lines
2.6 KiB
Markdown
Raw Normal View History

2022-03-29 19:46:06 +02:00
# P vs NP
*P vs NP* is one of the greatest and most important yet unsolved problems in [computer science](computer_science.md): it is the question of whether the [computational class](computational_complexity.md) [P](p.md) is equal to class [NP](np.md) or, in simple terms, whether certain problems for which no "fast" solution exists can in fact be solved "fast". This is very important e.g. for algorithms used in [cryptography](cryptography.md).
It is believed and sometimes relied on that P != NP (in which case P would be a proper subset of NP), but a mathematical proof doesn't exist yet. If it was surprisingly proven that P = NP, there might be practical consequences for cryptography in which most algorithms rely on the problems in question being difficult (slow) to solve -- a proof of P = NP could lead to fast algorithms for breaking encryption, but that is not a certainty, only one of possible scenarios.
## Explanation
In the context of [computational complexity](computational_complexity.md) of algorithms we talk about different classes of algorithm time complexities, i.e. different algorithm "speeds". This "speed" doesn't mean actual running time of the algorithm but rather how quickly the running time grows depending on the amount of input data to it; the classes are named after mathematical functions that basically grow as quickly as this dependence, so we have a *constant* time complexity, *logarithmic* time complexity, *linear* time complexity etc.
The class P stands for **polynomial** and is defined as all problems that can be solved by an algorithm run by a **deterministic [Turing machine](turing_machine.md)** (a theoretical computer) with a *polynomial* time complexity.
The class NP stands for **non-deterministic polynomial** and is defined as all problem that can be solved by an algorithm run by a **non-deterministic Turing machine** with a *polynomial* time complexity. I.e. the definition is the same as for the P class with the difference that the Turing machine is non-deterministic -- such a machine is faster because it can make kind of "random correct guesses" that lead to the solution more quickly. It is known that the solution to all NP problems can be verified in *polynomial* time even by a deterministic Turing machine, we just don't know if the solution can also be found this quickly.
Basically P means "problems that can be solved quickly* and NP means *problems that can be verified quickly but we don't know if they can be solved quickly*.
The question is whether all NP problems are in fact P problems, i.e. whether *all problems that can be verified quickly can also be solved quickly*.