4.6.26 · D1Theory of Computation

Foundations — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

2,109 words10 min readBack to topic

We build from absolute zero. If you have never seen an arrow like , a symbol like , or the word "graph" used to mean dots-and-lines — you are in exactly the right place. Nothing below is assumed; everything is earned.


Layer 0 — The pictures we draw everything on

A graph (dots and lines)

Figure — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

The picture is everything here. Look at the figure: the blue dots are , the white lines are . When the parent note says "graph and integer ", it is handing you a picture like this plus a number.

Why the topic needs this: every graph problem (Clique, Vertex Cover, Hamiltonian, TSP) is a question about which dots to pick or which lines to walk. No graph vocabulary → no way to even state the problems.

and — counting the dots

Picture: just point at the dots and say "one, two, three... ."


Layer 1 — Sets, and the symbols that move things between them

Figure — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

Look at the figure: the whole rectangle is , the shaded blob is , and is everything left over. When the parent proves " independent is a vertex cover", it is literally saying "shade a blob, and what's left has a special property." You must be able to see that leftover region.

Why the topic needs it: a "solution" to these problems is almost always a chosen subset of vertices — a blob inside the picture. Complement lets us flip between "the blob" and "everything else", which is the entire trick of Derivation 1.


Layer 2 — Logic symbols (the language of SAT)

Before any graph, the seed problem is about true/false logic. We need its alphabet.

Figure — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

The figure shows two little truth tables — the complete behaviour of OR and AND, all cases. Read every row: OR has just one FALSE row (both off); AND has just one TRUE row (both on). There are no other cases to worry about — two inputs, two values each, four rows, done.

Why the topic needs it: 3-SAT — the ancestor of the whole family via Cook–Levin Theorem — is stated entirely in these symbols. See Boolean Satisfiability (SAT, CNF) for the full treatment.


Layer 3 — The "there exists / for all" quantifiers

Picture: is you finding one working key on a keyring; is you checking that every key on the ring has some property. "Is the formula satisfiable?" means " a switch-setting making it true?". "Vertex cover" asks that edges are touched.


Layer 4 — The arrows that glue statements together

Picture: is a one-way street; is a two-way street. When the parent proves a reduction it always proves an — a perfect two-way translation, never a leaky one-way one.

Why the topic needs it: the definition of a reduction is literally an (Layer 6). Miss the two-way-ness and you'll accept broken reductions.


Layer 5 — "Fast": polynomial time and

Figure — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

Look at the figure: polynomial curves (, ) crawl; the exponential curve () rockets off the chart. That gap is the P-vs-NP drama — see P vs NP. "Fast" lives in the crawling zone.


Layer 6 — The reduction arrow and its two definitions

Now every piece is on the table, so we can finally read the topic's key notation.

Sets and complement

Graphs V and E

Boolean logic AND OR NOT

3-SAT and CNF

Quantifiers exists forall

Implication and iff arrows

Reduction A le_p B

Polynomial time and Big-O

Class NP verify fast

Clique VertexCover Hamiltonian TSP

Cook Levin seed

NP-complete family

The map shows the flow: pure sets + logic + counting at the top feed the two engines — graph problems and 3-SAT — and the arrows + fast-time notions build the reduction machine that welds the whole family into one. See Polynomial-time Reductions for the machinery and Graph Theory — Cliques and Independent Sets for the graph side. Everything ultimately loops back to the parent: the NP-complete topic.


A tiny worked check (tying symbols to a picture)


Equipment checklist

Read each question, answer in your head, then reveal.

What does mean, in one sentence?
A picture: is the set of dots (vertices), is the set of lines (edges) joining them.
What does usually stand for?
, the number of vertices — the count of dots.
What is ?
The complement: every vertex that is in but not in (the leftover blob).
When is a clause satisfied?
When at least one of its literals is true (OR is a low bar).
When is a CNF formula satisfied?
When every clause is satisfied simultaneously (AND is a high bar).
What is a literal?
A variable or its negation .
Difference between and ?
is one-way implication; is two-way — true in exactly the same cases.
What do and mean?
= "there exists (at least one)"; = "for all (every one)".
What does "polynomial time" mean, and measured in what?
Steps bounded by for fixed ; measured against the input size in bits, not the value of numbers.
Why is Subset Sum's NOT truly polynomial?
is written in bits, so can be exponential in the input length — it's pseudo-polynomial.
What puts a problem in NP?
A proposed certificate can be verified in polynomial time (checking is easy, finding may be hard).
What does assert?
A poly-time translator with , so is at least as hard as .