4.6.25 · D1Theory of Computation

Foundations — NP-completeness — Cook's theorem (SAT is NP-complete), reduction

1,832 words8 min readBack to topic

This page assumes you have seen none of the notation on the parent note. We build every symbol, one at a time, each resting on the one before. Return here whenever a symbol on the parent note feels unearned.


0. What a "problem" even means here

Picture a big box labelled with a rule. You drop an input into it, and a single lamp on top lights up: green for YES, red for NO.

Figure — NP-completeness — Cook's theorem (SAT is NP-complete), reduction

Why restrict to yes/no? Because the whole theory compares the difficulty of questions, and yes/no questions are the cleanest unit to compare. A "find the actual answer" task can always be rebuilt out of yes/no questions.


1. The symbol and the dots

The parent writes . Read it left to right:

  • with a little number below (a subscript) is just a named slot. is "slot one", is "slot two".
  • The three dots mean "keep going the same way".
  • is how many slots there are — it stands for a number we haven't fixed yet.

So is simply: a row of labelled boxes, and we don't say how many because the argument must work for any number.


2. TRUE / FALSE and the three logic symbols

Each box can hold one of two values: TRUE or FALSE (think: a light switch, ON or OFF). A box holding a truth value is called a Boolean variable (named after George Boole).

Now three operations combine switches. Read each as an everyday word:

Figure — NP-completeness — Cook's theorem (SAT is NP-complete), reduction

Why exactly these three? Because every possible truth-rule you could ever write can be built from just AND, OR, NOT. They are the complete toolkit — so a formula using only them can express any yes/no condition.

So is a list of demands, all of which must be met simultaneously.


3. What "satisfiable" pictures

The "haystack" from the core idea is now concrete: with switches there are possible flip-patterns. Checking one pattern is trivial; finding a winning one among is the hard part.


4. Polynomial time — the meaning of "fast"

We keep saying "fast" and "polynomial". Time to earn those words.

Figure — NP-completeness — Cook's theorem (SAT is NP-complete), reduction

Why is polynomial the dividing line between "fast" and "hopeless"? Look at the figure: polynomial curves stay tame; the exponential red curve rockets past them and never comes back. Double the input and merely quadruples, but squares. This is why the whole field draws its line exactly here. See Polynomial-time reduction and P vs NP problem.


5. Certificate, verifier, and the class NP

Here is the subtle one. Some problems we can't solve fast, but if someone hands us the answer, we can check it fast.

Picture a locked door. Finding the key by yourself may take forever, but if a friend hands you a key, testing it in the lock takes one second.


6. Reduction and the symbol

Now the machine that transfers hardness between problems.

Figure — NP-completeness — Cook's theorem (SAT is NP-complete), reduction

Why the symbol, pointing that way? Because literally means " is at least as hard as ": if you owned a fast solver for , you could answer any -question by translating it and asking . So difficulty flows uphill toward . This is Polynomial-time reduction.


7. NP-hard, NP-complete — the summit words

SAT is the first proven member (Cook's theorem). From it, Independent Set, Vertex Cover, and Clique inherit NP-completeness by reduction.


The prerequisite map

Decision problem YES or NO

Boolean variable TRUE FALSE

AND OR NOT connectives

Clause and formula phi

Satisfiability SAT

Input size n

Polynomial time class P

Certificate and verifier

Class NP

Reduction A le_p B

Cook theorem SAT is NP-complete

New NP-complete problems by reduction

Read top-down: pictures on the left build formulas; formulas plus timing build the classes P and NP; classes plus reduction feed the summit theorem.


Equipment checklist

Cover the right side and answer aloud before revealing.

What does a subscript mean?
The third named box, NOT " times 3".
When is true?
Only when both and are true (switches in series).
When is true?
When at least one is true (switches in parallel).
What does do?
Flips 's truth value.
A formula is satisfiable when...?
There exists a flip-pattern of the switches making every clause true.
How many flip-patterns do switches have?
.
Is polynomial or exponential?
Polynomial (fixed power of ).
Why is polynomial the "fast" line?
Polynomials stay tame as grows; explodes.
What is a certificate?
A proposed solution that a verifier can check quickly.
What does the N in NP stand for?
Nondeterministic (guess-and-check), NOT "not".
What does tell you about hardness?
is at least as hard as .
To prove is NP-hard, which way do you reduce?
Known-hard into ().
Difference between NP-hard and NP-complete?
NP-complete = NP-hard AND in NP.