4.6.24 · D1Theory of Computation

Foundations — P vs NP — statement, why it matters

2,816 words13 min readBack to topic

This is the prerequisite page for the P vs NP topic. The parent note throws around , , "decision problem", "certificate", , and more. Here we earn every one of those from zero, in the order they build on each other.


1. A "problem" — but a very specific kind

Before we can say "hard" or "easy", we must pin down what a problem is.

Figure s01 shows this as a machine with one input slot and exactly two lamps — a green YES lamp and a red NO lamp. Every decision problem is the question "which lamp lights up?"; look at how exactly one lamp ever lights.

Figure — P vs NP — statement, why it matters

2. Input size — the ruler we measure against

We say some problems are "harder for big inputs". But big needs a number.

Figure s01 also hints at this: the input arrives written out on tape squares; = how many squares are filled. (That tape is literally a Turing machine tape.)


3. Counting steps, and the symbol

Now: "harder" = "takes more steps as grows". We need a way to describe growth while ignoring petty details. (Recall a step is one basic tape action of our algorithm, defined at the top.)

Figure s02 is the heart of the whole topic: it plots a polynomial curve (teal) against an exponential curve (orange). Watch how they start close near the left, then the orange curve rockets almost straight up.

Figure — P vs NP — statement, why it matters

4. The class — problems we can solve fast

Picture a box labelled . Inside it sit problems like "is in this sorted list?" (solvable by binary search, , which is below any ). We draw that box explicitly in figure s04.


5. Certificate, verifier, and the class

Here is the subtle idea the whole topic hinges on: checking an answer vs finding it.

Figure s03 draws the verifier as a bouncer at a door: (teal arrow) is "the club rules", (plum arrow) is "your ID". The bouncer glances (fast) and admits or rejects. A good hint gets you in; no fake hint gets a non-member in.

Figure — P vs NP — statement, why it matters

6. The symbols , , and

Now the notation that states the actual question.

Figure s04 shows the blob nestled inside the blob. The million-dollar mystery is whether those two blobs are actually the same blob.

Figure — P vs NP — statement, why it matters

7. Two more words the parent leans on


How these foundations feed the topic

Algorithm on a Turing machine

Decision problem YES or NO

Input size n in bits

Step count and Big-O worst case

Polynomial vs Exponential

Class P solve fast

Certificate hint

Verifier V of x and c

Class NP check fast

Subset P inside NP

The P vs NP question

Reduction

NP-complete


Equipment checklist

Cover the right side and answer each before moving to the parent note.

An "algorithm" is
a finite, fixed recipe of unambiguous steps (here, actions of a Turing machine on a tape) turning input into output.
A "step" that we count is
one basic tape action of the algorithm — read a square, write a square, or move left/right.
A "decision problem" is
a question with only YES or NO as the answer.
The symbol (also ) stands for
the input size — the number of symbols (bits) in the encoded input.
Why the choice of alphabet (bits vs digits) doesn't matter
different fixed alphabets change lengths only by a constant factor, which Big-O absorbs.
All our time bounds are measured in the
worst case — the most steps over all inputs of size .
means precisely
there exist constants and such that for all .
Polynomial time means
for a fixed constant — variable in the base.
Exponential time means
for a fixed constant — variable in the exponent.
The class is
all decision problems a deterministic algorithm can solve in worst-case polynomial time.
Why counts as being in
for any fixed , so it is below polynomial.
A certificate (witness) is
a short hint whose length is polynomial in , used to confirm a YES answer.
A verifier does
checks in time polynomial in whether is a YES-instance, using hint .
The class is
problems whose YES-answers can be verified fast given a poly-length certificate.
"NP" stands for
Nondeterministic Polynomial — verifiable fast, NOT "non-polynomial".
means
every element of is also in (A sits inside B).
Why
a fast solver acts as a verifier that ignores the hint and just solves it.
asks
is every check-easy problem also solve-easy? (open — unknown).
A reduction from to must be poly-time because
otherwise a slow translation would ruin the efficiency transfer — fast B would not give fast A.
A reduction must preserve YES/NO because
else B's answer would be the wrong answer for A; preservation makes B's verdict trustworthy as A's.
NP-complete means
in and every problem reduces to it — the hardest problems in .

Connections