Skip to Content
Chapter 2

NP and the master problem: One problem to rule them all

Tomas Reimers 21 minute read

On May 4, 1971, at a computing conference in Shaker Heights, Ohio, a University of Toronto professor named Stephen Cook presented a paper with the unassuming title The Complexity of Theorem-Proving Procedures . In it, he proved that one specific problem (Boolean satisfiability) stands apart: every problem whose solutions can be efficiently checked can be mechanically translated into it. Crack that one problem and you crack them all. Across the Iron Curtain, a Soviet mathematician named Leonid Levin proved the same thing independently (publication was delayed until 1973 , and the Soviet literature had been circling the theme for years under the name perebor — “brute-force search”). The next year, Richard Karp showed the result wasn’t a curiosity about one problem: 21 problems  that operations researchers had been beating their heads against for decades (scheduling, packing, routing, coloring) all turned out to be the same problem in different clothes. This chapter is about that discovery:

  1. We name the pattern from Chapter 1’s cliffhanger: problems whose answers are easy to check. That’s the class NP, defined by certificates and verifiers.
  2. We meet SAT, the satisfiability problem, and build this book’s running example — a six-clause formula you can solve by hand, whose descendants with a million clauses will be solved by industrial tools in Chapter 4.
  3. We prove (at engineer’s rigor) the Cook–Levin theorem (SAT is NP-complete, the universal problem) and then walk the razor-thin boundary where SAT variants fall back into P.

By the end, “P vs NP” will be a precise question about one concrete problem: is there a polynomial-time algorithm for SAT?

NP: the class of checkable problems

Chapter 1 ended with an asymmetry: finding the factors of a 600-digit number seems to take geological time, but checking a claimed factorization takes 90 microseconds. The sudoku you struggle with, you grade in seconds. A flight itinerary under $800 with no overnight layovers may take an evening to find, but your friend’s claimed itinerary takes a minute to audit. In each case, a solution comes with something you can hand to a skeptic — a certificate (also called a witness) — that makes verification cheap even when discovery was expensive. (Formally we mean each problem’s decision version, Chapter 1’s yes/no framing: “is there an itinerary under 800 dollars?” rather than “find one.” A decision problem asks for a single bit.)

NP is the class of decision problems with that shape: whenever the answer is “yes,” there exists a certificate, of at most polynomial size, that a polynomial-time verifier can check.

x∈L  ⟺  ∃ w  ∣w∣≤nk:V(x,w)  accepts\tip{the instance x is a yes-instance of problem L}{x \in L} \iff \tip{there exists a certificate}{\exists\, w} \; \tip{of size polynomial in the instance size n}{|w| \le n^k} : \tip{a poly-time check accepts the pair}{V(x, w) \;\text{accepts}}

Here xx is the problem instance, LL the set of all yes-instances (a “language,” in Chapter 1’s jargon — a decision problem is such a set), and nn the instance’s size in bits. Read the definition with an engineer’s suspicion, because three traps lurk in it:

  • The certificate only needs to exist. Nobody has to be able to find it efficiently — existence is the whole definition. NP is not “hard problems”; it’s “checkable problems.”
  • “No” is unprotected. The definition demands certificates for yes-answers only. For “this formula has no solution,” no short evidence is promised — an asymmetry that opens Chapter 3.
  • The name is a historical accident. NP stands for nondeterministic polynomial — in the original formulation, a machine that can guess the certificate and verify it. It does not mean “not polynomial.” P ⊆ NP trivially: if you can solve a problem outright, you can verify a yes-answer by ignoring the certificate and solving it. (So P vs NP asks whether the containment is strict.)

And one bound in the other direction, cashing in Chapter 1: every NP problem is solvable in exponential time — enumerate all 2nk2^{n^k} possible certificates and run the verifier on each. So NP lives between P (Chapter 1’s polynomial-time class) and EXP (exponential time — the class Chapter 1 proved strictly bigger than P), precisely in the gap where the hierarchy theorem went silent: that theorem separates less time from more time, and checking-versus-finding is not a time-scale question. In 2000, the Clay Mathematics Institute put a million-dollar bounty  on determining where in the gap NP actually sits.

SAT: the master problem

Now the problem Cook chose. A Boolean formula is built from variables that take values true/false. A literal is a variable or its negation (xx or ¬x\neg x). A clause is an OR of literals. A formula in conjunctive normal form (CNF) is an AND of clauses. SAT asks: given a CNF formula, does any assignment of true/false to the variables satisfy every clause? (3-SAT is the special case where every clause has at most three literals.)

That’s dry, so here’s the same thing with people in it — the formula this book will carry from here through Chapter 10. You’re planning a dinner party with four possible guests: alice, bob, carol, dave. House rules: at least one of Alice, Bob, Carol must come. Alice and Bob are feuding, and so are Bob and Carol. Carol and Dave are a couple who only come together. And Alice won’t share a room with Dave. As a CNF formula:

φ=(a∨b∨c)∧(¬a∨¬b)∧(¬b∨¬c)∧(¬c∨d)∧(¬d∨c)∧(¬a∨¬d)\varphi = \tip{at least one of the three}{(a \lor b \lor c)} \land \tip{not both Alice and Bob}{(\neg a \lor \neg b)} \land \tip{not both Bob and Carol}{(\neg b \lor \neg c)} \land \tip{Carol brings Dave}{(\neg c \lor d)} \land \tip{Dave brings Carol}{(\neg d \lor c)} \land \tip{Alice vetoes Dave}{(\neg a \lor \neg d)}

Every constraint-shaped thought becomes clauses this way. “At least one” is a clause of positive literals. “Not both” is a clause of two negative literals. “If cc then dd” is (¬c∨d)(\neg c \lor d) — verify it by checking that the one assignment breaking the implication (cc true, dd false) is exactly the one falsifying the clause. Try the formula yourself — find all three satisfying assignments:

(a ∨ b ∨ c)invite at least one of Alice, Bob, Carol
(¬a ∨ ¬b)Alice and Bob are feuding
(¬b ∨ ¬c)Bob and Carol are feuding
(¬c ∨ d)if Carol comes then Dave comes
(¬d ∨ c)if Dave comes then Carol comes
(¬a ∨ ¬d)Alice won't be in a room with Dave
5 / 6 clauses satisfied
4 guests → 2⁴ = 16 possible lists. 60 guests → 2⁶⁰ ≈ 1.15 × 10¹⁸. Checking one list stays six quick looks either way.
The dinner-party formula φ — this book's running example. Click guests to toggle the assignment; a clause is satisfied (solid) when at least one of its literals is true. Of the 16 possible guest lists, exactly 3 satisfy all six clauses: {Alice}, {Bob}, and {Carol, Dave}.

Solve it by hand once, because the reasoning you just did is Chapter 4 in miniature: if Carol comes, Dave must come (clause 4), but then Alice can’t (clause 6), and Bob can’t anyway (clause 3)… — you were propagating forced consequences of a guess. Hold the formula’s answer in your head: exactly three of sixteen assignments work: {a}\{a\}, {b}\{b\}, {c,d}\{c,d\} — each set naming the guests invited (the variables set true).

Those sixteen assignments also have a geometry. Give each guest an axis: an assignment is then a corner of a 4-dimensional cube, and two corners share an edge exactly when they differ in one guest. This is the Hamming cube {0,1}n\{0,1\}^n (and Hamming distance counts the differing coordinates). The search space is a terrain:

AbcdaBcdabCdabcDabCDAbCDaBCD
abCD — invite Carol + Dave: 6 / 6 clauses ✓ a solution
darker dot = more clauses satisfied · its 4 edges = the one-flip moves
The search space as a place: all 16 assignments, arranged as the 4-dimensional Hamming cube — an edge connects assignments differing in exactly one guest, so every algorithm in this book is a strategy for exploring this graph. The 3 solutions (ringed) sit at Hamming distances 2, 3, and 3 from each other. Click around; note that fixing a partial guest list selects a sub-cube — which is exactly what a DPLL decision will do in Chapter 4.

Every algorithm this book will meet is a strategy for exploring this cube: flipping one variable is walking an edge, fixing a partial guest list is selecting a sub-cube, and the solutions form a sub-territory whose shape — scattered? clustered? connected? — turns out to govern how findable they are. Even in our toy, the three solutions are no one’s neighbors: pairwise Hamming distances 2, 3, and 3. At n=60n = 60 the cube has 2602^{60} corners, and the geometry of the solution territory becomes a serious scientific question. Chapter 6 maps it, with help from physicists.

And if you flatten the cube onto a line, failing assignments become wave interference?

They do. Fix a variable order — say aa first, dd last — and read each assignment as a binary number (8a+4b+2c+d8a + 4b + 2c + d): the cube’s 16 corners become positions 0 through 15 on a line, and each variable becomes a square wave. The slow wave aa is false for the whole left half and true for the whole right; dd, the fast wave, alternates every step. A clause fails only on the intersection of its literals’ half-periods, so each clause’s failing set is a periodic comb — and a kk-literal clause’s comb covers exactly 1/2k1/2^k of the line — 2n−k2^{n-k} positions, arranged in a pattern set by which frequencies it mentions (fast variables space the teeth finely; slow ones fuse them into blocks). Here is the dinner party, computed:

0000000100100011010001010110011110001001101010111100110111101111(a∨b∨c)one low block(¬a∨¬b)one low block(¬b∨¬c)period 8(¬c∨d)period 4(¬d∨c)period 4(¬a∨¬d)period 2 · high half✓✓✓any fail?gaps = solutions
filled = this clause is violated there · the ✓ columns (1000, 0100, 0011) are {a}, {b}, {c,d}
The dinner party as wave interference. Order the variables (a the slow wave, d the fast one) and the 16 assignments become a number line; each clause's FAILING set (filled cells) is a periodic comb — a k-literal clause covers exactly 1/2^k of the line. Unsatisfiable would mean the six combs interfere to cover every column. They don't: three gaps survive, and the gaps are precisely the three solutions.

Satisfiability is now an interference question: the formula is unsatisfiable exactly when the clauses’ combs superpose to cover every position — and a satisfying assignment is a surviving gap in the interference pattern. The picture pays off twice later. The 1/2k1/2^k coverage is why a random assignment satisfies ⅞ of random 3-clauses: the number behind Chapter 9’s hardness-of-approximation floor. And the rigorous version of “variables as frequencies” is the Walsh–Hadamard (Fourier) basis of Boolean functions: Chapter 7’s parity bound has a Fourier reading (shallow circuits are provably “low-frequency” objects, a theorem of Linial, Mansour and Nisan, and parity — the product of all the waves — is the purest high-frequency signal, which is exactly why they can’t compute it), and the analysis behind the ⅞ theorem is Fourier analysis outright. One caveat: for deciding a given formula, no one knows how to cash the wave picture faster than brute force — superposing mm combs over 2n2^n positions is just the truth table again. It’s a lens, not an algorithm; but it’s the lens the field’s sharpest tools are ground from.

SAT is in NP by inspection — a satisfying assignment is the certificate, and the verifier is one pass over the clauses:

certificate:a = Fb = Fc = Td = T
(a ∨ b ∨ c)✓ c(¬a ∨ ¬b)✓ ¬a(¬b ∨ ¬c)✓ ¬b(¬c ∨ d)✓ d(¬d ∨ c)✓ c(¬a ∨ ¬d)✓ ¬a
without it: try abcd, abcD, abCd, abCD, … — 2ⁿ assignments; n = 60 guests is 1.15 × 10¹⁸ lists
the claim: φ is satisfiable — somewhere among the 16 guest lists, one works
A certificate turns an exponential question into a linear check: verifying that {Carol, Dave} satisfies φ takes one pass over the clauses, while finding a satisfying assignment with no hint has — as far as anyone knows — no fundamentally better strategy than search.

Checking: with mm clauses of at most kk literals, verification is O(mk)O(mk) — for our formula, six looks at at most three literals each. Finding: nothing obvious beats trying assignments, and assignments double per variable — 16 for our four guests, 260≈1.15×10182^{60} \approx 1.15 \times 10^{18} for sixty. SAT is checkable in linear time and searchable, naively, in exponential time. The whole question is whether the naivety is necessary.

Hold on — “exponential” in what? The formula’s length and its variable count are different numbers…

Caught — and the gap between those two numbers is where SAT’s difficulty actually lives. Call the formula’s text length NN and its variable count MM. Brute force costs O(2M⋅N)O(2^M \cdot N) — so if a formula is at least as long as its own truth table (N≥2MN \ge 2^M), brute force is O(N2)O(N^2): polynomial in the input. SAT over fully-spelled-out constraint tables is easy; writing the question down already did the exponential work. And spelling-out is the common case in function-space: almost every function of MM variables requires a description of length about 2M2^M (a counting argument, delivered in Chapter 7 — a typical function simply has no shorter name than its full table).

So NP-hardness lives entirely in the opposite corner: formulas whose meaning (a constraint over 2M2^M rows) is exponentially larger than their text. A CNF formula is, seen this way, a compression format, and SAT is the problem of reasoning about compressed data without decompressing it. (For 3-CNF the compression is mandatory: there are only 8(M3)≈43M38\binom{M}{3} \approx \tfrac{4}{3}M^3 distinct 3-clauses over MM variables, so after deduplication every 3-SAT instance has length polynomial in its variable count.) The hard instances of this book all sit at high meaning-density: the Cook–Levin formula below packs an entire machine-run’s validity into polynomial clauses; Chapter 6’s hard random formulas keep MM at a fixed fraction of NN, the maximally-compressed regime (where the modern Exponential Time Hypothesis (Chapter 13) conjectures nothing beats 2Θ(M)2^{\Theta(M)}).

The frame recurs. Chapter 5’s OBDDs (ordered binary decision diagrams) attack SAT by deliberately decompressing: pay the exponential once, then every query is cheap — and the payment explodes exactly for the functions that resist compression. And in Chapter 13, turning the dial one level further — the formula itself handed over compressed, as a small circuit describing an exponentially long formula — jumps satisfiability from NP-complete to NEXP-complete. Difficulty, throughout, is a property not of questions but of the gap between a question’s size and its meaning’s size. (One warning against reading “compressible” as “simple”: the Cook–Levin theorem below shows these short formulas contain universal computation — every checkable question in mathematics compiles into them. Rare by counting, and rich enough to hide everything this book is about.)

Reductions: how problems compare

Before Cook’s theorem can even be stated, we need the tool it’s made of. A (polynomial-time) reduction from problem AA to problem BB is an efficient translator: a polynomial-time function that converts any instance xx of AA into an instance f(x)f(x) of BB with the same answer.

x∈A  ⟺  f(x)∈Bwritten A≤pBx \in A \iff \tip{the translated instance}{f(x)} \in B \qquad \text{written } A \le_p B

If such a translator exists, then an algorithm for BB solves AA too — run the translator, then the BB-solver. Read A≤pBA \le_p B as ”AA compiles to BB,” or ”BB is at least as hard as AA.” For an engineer this is the most familiar idea in the book wearing formal dress: you reduce every problem to SQL, to regex, to an integer-linear-programming (ILP) solver, to sort | uniq -c. Complexity theory just insists the compiler itself be cheap, so it can’t smuggle in the hard work.

Here’s a real one, small enough to verify by hand: every CNF formula reduces to 3-SAT. The only obstacle is long clauses, and they split. A five-literal clause becomes three 3-literal clauses with two fresh variables chaining them:

(l1∨l2∨l3∨l4∨l5)  ⟶  (l1∨l2∨y1)∧(¬y1∨l3∨y2)∧(¬y2∨l4∨l5)(l_1 \lor l_2 \lor l_3 \lor l_4 \lor l_5) \;\longrightarrow\; (l_1 \lor l_2 \lor y_1) \land (\neg y_1 \lor l_3 \lor y_2) \land (\neg y_2 \lor l_4 \lor l_5)

If some lil_i is true, set the yy‘s before it true and after it false, and all three clauses check out; if all lil_i are false, the clauses force y1y_1 true, then y2y_2 true, and the last clause dies. (We verified the equivalence by brute force over all 32 assignments of the lil_i — it holds.) In general a kk-literal clause becomes k−2k-2 clauses with k−3k-3 new variables: the blowup is linear, the translator is a loop. This is what reductions look like up close — gadgets: little widgets of structure in the target problem that simulate the source problem’s parts.

One more property: reductions compose. If A≤pBA \le_p B and B≤pCB \le_p C then A≤pCA \le_p C — polynomials closed under composition again (Chapter 1 keeps cashing checks). So “reduces to” organizes all of NP into a hierarchy of hardness. Cook’s question was: does the hierarchy have a top?

Cook–Levin: SAT is universal

The theorem: every problem in NP reduces to SAT. A problem with this property (in NP, and every NP problem reduces to it) is called NP-complete: the “complete” means it contains the full difficulty of the entire class. Solve SAT in polynomial time and every checkable problem collapses into P — Gödel’s dream of mechanized proof-finding, from Chapter 1’s letter, included; prove SAT needs super-polynomial time and P ≠ NP. SAT is not a hard problem; it is, in a precise sense, the hard problem.

At first the claim sounds impossible to prove — how do you reduce every NP problem, including ones nobody has invented yet, to one formula? The proof is one of those arguments that looks like a magic trick until you see that it only uses facts already on our table. Any NP problem has a verifier — a machine. Machines can be filmed: write down the complete configuration (tape, head, state) at every step, row after row, and you get a rectangular grid called a tableau — polynomially many rows (the verifier is poly-time) by polynomially many columns (it can only touch polynomially many cells). The input and a blank slot for the certificate fill the top row; “accept” appears somewhere in the bottom row if and only if some certificate works.

Now the only idea in the proof: because a Turing machine step is local (Chapter 1’s load-bearing fact) the grid is a valid film if and only if every little 2×3 window of cells is consistent with the machine’s rule table (Chapter 1’s finite instruction list). Why 2×3 is enough: one step changes one row into the next, and it can only touch the head’s cell and its immediate neighbors — so two consecutive rows, three adjacent columns, capture everything a step can do. Correct computation, a global property, has shattered into polynomially many constant-size facts. And constant-size facts about a handful of true/false cell-variables are exactly what CNF clauses express — the general recipe: list the window’s forbidden combinations and veto each with one clause, the dinner party’s “not both” pattern scaled up:

tape cells (poly many) →step 0 (input)step 1step 2step 3step 4accept?→ O(1) clauses
any NP problem comes with a poly-time verifier: a machine that accepts (input + certificate). Film its run.
The Cook–Levin construction: film any verifier's run as a grid, observe that correctness is purely local (every 2×3 window legal), and write one clause batch per window. The formula is satisfiable exactly when an accepting run — i.e., a valid certificate — exists. Drawn 6×10 for legibility; really poly(n)×poly(n).

So: one variable per possible symbol per cell, a constant batch of clauses per window, clauses pinning row 0 to the input (with the certificate cells left free), one clause demanding the accept state. The resulting formula is polynomially large, built by an utterly mechanical translator, and satisfiable precisely when some certificate makes the verifier accept. Every NP problem just compiled to SAT. ∎

Notice what the proof did not use: nothing about the problem being reduced — only that it had a verifier. That’s why one theorem covers problems not yet invented. And notice the aftermath, which is where Karp comes in: to prove some other problem BB NP-complete, you no longer need Cook’s machinery — show BB is in NP, and reduce SAT (or any known NP-complete problem) to BB; composition does the rest. That’s how 21 problems fell in 1972, and how thousands  have fallen since: clique, graph coloring, traveling salesman, subset-sum, bin packing, generalized sudoku, protein structure models, most scheduling, Minesweeper. Every one of them is SAT in costume; every one of them, fed to the translator, becomes clauses. (This is Chapter 4’s business model. A 9×9 sudoku becomes 729 variables (one per cell–digit pair, 81×981 \times 9) and 11,745 clauses under the standard encoding: 81 “this cell holds some digit” clauses, plus 4×2,9164 \times 2{,}916 pairwise “these two can’t both be true” clauses — for cells: 81 cells × (92)=36\binom{9}{2} = 36 digit pairs =2,916= 2{,}916, and rows, columns, and boxes each happen to total the same. A SAT solver eats it in milliseconds.)

What does an NP-completeness proof buy you, practically, as an engineer?

Permission to stop looking for the clean polynomial algorithm, and guidance on what to do instead. When your problem is NP-complete: (1) stop burning weeks hunting an exact fast algorithm that would, incidentally, collect a million dollars; (2) your options become approximation, heuristics, special-case structure, or small nn — and, surprisingly often, (3) encode it to SAT and use an industrial solver, because Chapter 4’s engines routinely crush structured million-variable instances despite worst-case theory. NP-completeness is a statement about the worst case of the general problem — not a curse on your particular instances. The gap between those two statements is Part II of this book.

The razor’s edge: where SAT falls back into P

A fair first instinct is that hardness comes from scale — many variables, many clauses. The truth is stranger: hardness is a structural property of the constraint type, with a boundary so sharp it looks like a typo.

  • 2-SAT (every clause at most two literals) is solvable in linear time. A 2-clause is two implications ((x∨y)(x \lor y) means ¬x⇒y\neg x \Rightarrow y and ¬y⇒x\neg y \Rightarrow x); build the implication graph (a node per literal, an edge per implication), and the formula is unsatisfiable exactly when some variable and its negation sit in the same strongly connected component — because that means xx forces ¬x\neg x and ¬x\neg x forces xx, a contradiction either way. Three literals: NP-complete. Two: a tarjan() call.
  • Horn-SAT (at most one positive literal per clause — the shape of logic-programming rules: “if aa and bb then cc”) is solvable in linear time by unit propagation, the same forced-consequence reasoning you did at the dinner party. It works because a violated Horn clause forces its one repair, while a violated 3-clause offers a menu of three. Branching factor one versus three — the whole dichotomy in miniature. And forcing is no toy: a circuit gate (”cc fires if aa and bb fired”) is a Horn clause, so propagation cascades simulate any polynomial-time computation — Horn-SAT is P-complete under log-space reductions (poly-time reductions would make the label vacuous), as hard as tractable gets.
  • XOR-SAT — clauses are exclusive-ors instead of ors (“an odd number of these literals is true”) — solvable in polynomial time, because XOR-clauses are linear equations over the field of two elements, and Gaussian elimination doesn’t care that the field is tiny. Stare at an XOR-SAT instance and it looks every bit as scrambled and combinatorial as 3-SAT. It isn’t, and when someone announces a P ≠ NP proof, XOR-SAT is often the first counterexample referees reach for — Chapter 13 tells the famous story.
IN PNP-COMPLETEnothing in between (for these constraint languages)2-SATimplication graph + SCCsHorn-SATunit propagationXOR-SATGaussian elimination3-SATthis book1-in-3-SATeven with no negationsNAE-3-SAT"not all equal"
Schaefer's dichotomy theorem (1978): every Boolean constraint-satisfaction variant of SAT is either polynomial-time solvable or NP-complete — the middle ground is provably empty. Memorize XOR-SAT's position; it returns as a famous proof-killer in Chapter 13.

You might expect, between the easy variants and the complete ones, a smooth gradient of intermediate difficulty. There isn’t. Schaefer’s dichotomy theorem  (1978) proves that every SAT-like constraint language — a fixed menu of allowed clause shapes, like “2-literal clauses only” or “XORs only” — is either in P or NP-complete. For this entire family of problems, the middle is empty. (Whether any NP problem can live strictly between P and NP-complete is a subtler question; the next chapter answers it.)

The islands are also easy in two different ways. 2-SAT and Horn run on propagation: monotone forcing that only ever adds conclusions. XOR-SAT runs on cancellation: Gaussian elimination subtracts equations until terms annihilate, and nothing in a forcing cascade can un-assert anything. The split is a theorem twice over. Barto and Kozik proved  that a constraint problem is solvable by local propagation (of any fixed radius) precisely when it cannot encode linear equations; parity is invisible to every bounded window. And the full CSP (constraint satisfaction problem) dichotomy (Schaefer lifted to arbitrary finite domains, conjectured in 1993, proved independently by Bulatov  and Zhuk  in 2017) says every such problem is in P or NP-complete, with every tractable one solved by interleaving exactly these two moves: accumulate or cancel.

One more twist, checkable by sorting. Classify any 3-clause by sign pattern: two or three positives means at most one negative (dual-Horn); zero or one positive means Horn. Every case is covered, so every 3-SAT formula is the conjunction of one Horn formula and one dual-Horn formula — two linear-time theories, stapled together. Take H=(¬x∨¬y)(¬x∨¬z)(¬y∨¬z)H = (\neg x \lor \neg y)(\neg x \lor \neg z)(\neg y \lor \neg z), “at most one of the three,” whose solutions are the cube’s bottom (weight, the count of true variables, at most 1), and D=(x∨y)(x∨z)(y∨z)D = (x \lor y)(x \lor z)(y \lor z), “at least two,” whose solutions are the cube’s top. Each half is satisfiable in linear time; the conjunction is unsatisfiable. NP-completeness, on this view, is the price of the handshake between a floor theory and a ceiling theory that share variables.

Is there one statement that unifies all the islands?

Yes, and it is how the dichotomy theorems are actually proved. Each island’s solution set is closed under an operation that combines solutions into new solutions. Horn: the coordinatewise AND of two solutions is a solution (which is why a unique bottom solution exists). 2-SAT: the coordinatewise majority vote of any three solutions is a solution. XOR-SAT: the triple-XOR α⊕β⊕γ\alpha \oplus \beta \oplus \gamma of three solutions is a solution, because linear equations pass XOR through: ℓ(α⊕β⊕γ)=c⊕c⊕c=c\ell(\alpha \oplus \beta \oplus \gamma) = c \oplus c \oplus c = c. The smallest clause separates the islands: (x∨y)(x \lor y) has solutions 01,10,1101, 10, 11; the majority of all three is 1111, a solution, but the AND of 0101 and 1010 is 0000, which isn’t — so this clause is 2-SAT territory but not, as written, Horn territory. (Flip the sign of xx and it becomes Horn; Chapter 4 turns that renaming trick into a theorem.)

Operations like these are called polymorphisms, and the dichotomy in its modern form reads: a constraint language is in P exactly when its solutions are closed under some operation of a particular well-behaved kind (a cyclic or weak near-unanimity polymorphism, which AND, majority and triple-XOR all are), and NP-complete otherwise. “Nontrivial” alone isn’t enough: Not-All-Equal 3-SAT is closed under flipping every bit, which is not a dictator (an operation that just copies one input), yet it is NP-complete. The polymorphism even dictates the algorithm: AND-closure gives propagation toward the bottom, majority-closure gives the implication-graph method, XOR-closure gives Gaussian elimination. Hardness, on this view, is the absence of any well-behaved operation under which solutions compose. And the tableau construction above says where that absence comes from. A 3-SAT solution set can be the accepting computation histories of any machine, and machines don’t average: the AND, majority, or XOR of two valid histories is not a valid history. Universality of the syntax and lawlessness of the semantics are one fact, seen from two sides.

One problem now carries the weight of every checkable problem: a polynomial algorithm for SAT would make verification and discovery the same thing. Before asking whether that algorithm exists, you should want to know what hangs on the answer — what certifies a “no,” what lives above NP, and why the RSA keys securing your TLS sessions quietly assume the answer is no. That map is Chapter 3.

Further reading

Last updated on