SAT solvers: Solving the unsolvable, at scale
In May 2016, three researchers (Marijn Heule, Oliver Kullmann, and Victor Marek) settled a question Ronald Graham had been asking since the 1980s. Can the numbers 1, 2, 3, … be split into two groups so that neither group contains a Pythagorean triple ()? The answer : you can survive up to 7,824, and at 7,825 it becomes impossible. What made headlines wasn’t the theorem but the method and the receipt. They proved it impossible by encoding the question as a SAT formula and running a solver for two days across 800 cores. The solver emitted a machine-checkable proof of unsatisfiability weighing 200 terabytes, then the largest proof ever produced. The contradiction this chapter lives in: Chapter 2 crowned SAT the hardest problem in NP, and here is SAT being solved, with a certified proof, on an instance encoding a statement about infinitely many integers.
This chapter is how that’s possible:
- DPLL — the 1962 backtracking core: guess, propagate consequences, backtrack on contradiction. We’ll run it, for real, on the dinner party.
- CDCL — the 1990s revolution: solvers that learn a new clause from every mistake, plus the supporting tricks (backjumping, a decision-scoring scheme called VSIDS, restarts, and watched literals) that made the learning scale.
- The reckoning — why real-world instances fall when the worst case says they shouldn’t, how a solver’s “no” can be trusted (those 200 TB), and the provable wall where every solver in this chapter must fail.
DPLL: guess, propagate, backtrack
Brute force tries all assignments. The first real idea in SAT solving — Davis–Putnam 1960 , refined into the modern form by Davis–Logemann–Loveland 1962 — so, DPLL — is that you almost never have to guess all variables, because guesses have consequences you can compute. Two rules do the work:
- Unit propagation. If a clause has all but one literal false, the last literal is forced — no choice, assign it. Each forced assignment can strand more clauses at one literal, so forcings cascade.
- Pure literals. If a variable appears only positively (or only negatively) in the clauses that remain, set it the way it wants; nothing can be lost. (This rule generalizes to an autarky — a set of variables whose assignment satisfies every clause it touches, safely deletable wholesale — which powered the first algorithm proven faster than ; Chapter 13 picks up that thread.)
Only when neither rule fires does DPLL decide: pick a variable, guess a value, and recurse; on contradiction (some clause with every literal false) backtrack and try the other value. You already executed this algorithm in Chapter 2, when you solved the dinner party by hand: “if Carol comes, Dave must come, but then Alice can’t…” was unit propagation, verbatim.
To watch DPLL work for a living, the dinner party needs to bite back. Chapter 2’s formula , restated: someone from the trio attends, and the two feuds, and Carol and Dave are a couple who attend together or not at all, Alice vetoes Dave. Its three solutions (, , ) all seat somebody essentially alone, and nobody wants a lonely dinner.
So add three clauses: Alice won’t be the only guest , neither will Bob , and the couple won’t dine as a pair alone . Call the nine-clause result . Each new clause knocks out exactly one of the three solutions, so is unsatisfiable — no guest list works. (A sanity check it passes, and a tiny general law: every unsatisfiable CNF must contain an all-positive clause and an all-negative one, or else all-true or all-false would satisfy it. has and .) Here is DPLL discovering that, with every step below verified by running the algorithm:
Count what just happened: a 16-assignment space, closed by two decisions and three conflicts, because propagation filled in every other variable. (On Chapter 2’s Hamming cube, a decision selects a sub-cube and propagation shrinks it; a conflict discards the whole region unvisited. DPLL amputates sub-cubes rather than walking corners one by one.) On a real instance a solver decides perhaps one variable in a hundred (an order-of-magnitude observation from solver logs), and propagation (pure logical bookkeeping) does the rest. The exponential blowup, when it comes, comes from backtracking: each wrong guess at depth can cost revisiting sub-worlds. So the game is to guess rarely, guess well, and never pay for the same mistake twice.
CDCL: never make the same mistake twice
Look again at DPLL’s first conflict in the figure, and notice what the plain algorithm does with it: nothing. It backtracks one level and forgets. But the conflict contained information (a=true led, by forced steps alone, to contradiction) and information, once paid for, shouldn’t be discarded. That observation, industrialized in the solvers GRASP (1996) and Chaff (2001), is conflict-driven clause learning (CDCL).
CDCL keeps, alongside the assignment, an implication graph: every forced literal records which clause forced it and from what. When a conflict arrives, the solver walks the graph backward and asks: what subset of my decisions actually caused this? The answer is a cut through the graph, a set of assignments jointly sufficient for the conflict. Its negation (“they can’t all hold at once,” an OR of the opposites, De Morgan in action) is a brand-new clause, always logically implied by the formula but never before written down, which the solver learns, appending it permanently. The conflict is now structurally impossible, in every future branch:
On our dinner party, the first conflict traces entirely to the decision , so the solver learns the unit clause (“Alice can never attend”) a fact true of from the beginning that no human reading the nine clauses would spot instantly. Three learned clauses later, propagation alone (no decisions pending) derives a contradiction — and a contradiction with no decision anywhere in its ancestry follows from the formula alone, with no guess left to retract, so the solver declares UNSAT. Three refinements make this loop industrial:
- Backjumping. Having learned the conflict’s true cause, the solver jumps straight back to where the learned clause becomes a unit, skipping sub-trees that chronological backtracking would have slogged through. (Learned clauses in practice come from a graph cut called the first unique implication point (the first forced literal through which every path from the latest decision to the conflict passes), which empirically yields the strongest units.)
- VSIDS decision scoring (variable state independent decaying sum — the name is worse than the idea). Which variable should the next decision try? Chaff’s answer — bump a variable’s score whenever it appears in a conflict, exponentially decay all scores over time — makes the solver swarm whatever region of the formula is currently producing trouble. Decay is the key: the heuristic has a half-life, so it follows the fight as it moves.
- Restarts, with memory. Solver progress is heavy-tailed : the same instance can take seconds or days depending on early luck. CDCL’s cure is shameless — periodically throw away the partial assignment and start over (on a schedule, often the Luby sequence (a slowly growing schedule provably within a log factor of optimal for restart-style algorithms)) — but keep every learned clause and all the VSIDS scores. A restart is a fresh route through accumulated knowledge, not amnesia. (A cheap companion trick, phase saving, remembers each variable’s last value, so the retried route doesn’t re-litigate old sub-problems.)
Underneath it all sits the systems engineering: propagation runs 80–90% of wall time in typical profiles, so Chaff rebuilt it around two watched literals: to detect “all but one literal false,” you don’t track a clause’s every literal — you watch two unfalsified ones, because while both watches live the clause has at least two open literals and cannot be unit, so it can be ignored entirely. Only when a watched literal dies must the clause be touched (find a replacement watch, or declare it unit). And backtracking requires no bookkeeping at all: un-assigning can only turn false literals back to open, so a stale watch is still a valid watch. A million-clause formula propagates at memory-bandwidth speed. If this book has one lesson for systems engineers, it’s that asymptotic destiny and cache behavior are separate lines of the invoice, and both get paid.
That’s the whole machine: MiniSat proved it fits in ~600 readable lines in 2003; today’s champions (Kissat, CaDiCaL and kin, battle-ranked at the annual SAT Competition ) add preprocessing and tuning but keep this skeleton. Formulas from hardware verification with millions of variables and tens of millions of clauses routinely dispatch in minutes.
Why does any of this work? An accounting
Everything above is heuristics bolted to a worst-case-exponential loop. Chapter 2’s theorem didn’t bend: SAT is NP-complete, and CDCL’s worst case is as exponential as brute force. So the right question is: what property do industrial instances have that the worst case lacks?
The answer is that it’s only partially understood, and the gap is itself unexplained. The leading explanations: real formulas are structured — they encode engineered artifacts. Their variable-interaction graphs show strong community structure (modules wired narrowly, like the codebases and netlists (chips’ wiring graphs) they came from), and their constraints are locally shaped, built from adders and multiplexers and package-version ranges, not adversarial noise.
Backdoors: the tractable islands pay off
The sharpest formal version of “structured” cashes in Chapter 2’s tractable islands. A backdoor is a set of variables whose assignment collapses everything that remains into one of the polynomial classes: pure Horn-SAT (unit propagation finishes it), 2-SAT (two-literal clauses), or XOR-SAT (parity equations), after which the solver coasts downhill. An instance with a -variable backdoor costs at most easy sub-solves, no matter how many total variables it has. Recall how two decisions closed our 16-assignment dinner party, because everything after each decision was propagation.
Do the islands overlap? A one-line theorem about the 2-vs-3 boundary
Solvers get polarity renaming for free (swap a variable with its negation everywhere; satisfiability is untouched), and deciding whether some renaming makes a formula Horn is itself polynomial (Lewis, 1978 — the test is itself a 2-SAT instance). Renaming also buys a short theorem: every satisfiable 2-SAT formula is renamable Horn, with a two-sentence proof. Flip exactly the variables some satisfying assignment sets true; after the flip, a literal is positive precisely when falsifies it. A clause satisfies has at most one falsified literal among two, so every clause ends up with at most one positive literal: Horn. Now watch the same arithmetic explain Chapter 2’s razor edge: a satisfied 3-clause can carry two falsified literals — two positives, no Horn shape — so the trick dies at width 3, exactly where NP-completeness begins.
The empirical claim about industrial instances is that their backdoors are tiny relative to their size: measured in the dozens, on instances with hundreds of thousands of variables. And CDCL’s whole heuristic stack can be read as a backdoor-hunting machine: conflicts concentrate around the few variables that control everything else (the backdoor’s signature), VSIDS swarms exactly the variables conflicts implicate, and learning extracts the modules’ interfaces as clauses while restarts hedge the heavy tail. (That reading is an interpretation, not a theorem — but it’s the going one.) None of this is a theorem about all inputs; all of it is an empirical law about the inputs civilization produces. “NP-complete” and “your instances are hard” are different claims — a gap Chapter 6 will measure precisely, by finding instances that genuinely are hard.
Which raises the question of trust:
- When the solver says SAT, it prints the assignment — Chapter 2’s certificate, checkable in one pass. No trust required.
- When it says UNSAT, it’s asserting a coNP statement — Chapter 3 warned those have no obvious short certificate. The industry’s answer: modern solvers emit a DRAT proof (deletion resolution asymmetric tautology — the acronym names the clause-admission rule) — a log of every learned clause, each checkable by (essentially) re-running unit propagation on its antecedents (the clauses that forced it). An independent verifier, a small fraction of the solver’s size, replays the log; you trust the small verifier, not the large solver. The Pythagorean-triples proof is exactly this: 200 TB of DRAT, independently checked. Mathematics has quietly acquired a new epistemology (the theorem is true because the refutation replayed) and it’s built on Chapter 3’s asymmetry.
Every clause CDCL learns is derivable by resolution — a single, ancient inference rule that Chapter 8 will formalize. The learned-clause log is a resolution proof; a CDCL run on an UNSAT instance cannot be shorter than the shortest resolution refutation (the correspondence is a theorem ). So if some family of formulas provably requires exponential-size resolution proofs, then every solver in this chapter — GRASP, Chaff, MiniSat, Kissat, all of them, with every heuristic, on any hardware — necessarily takes exponential time on that family. Do such formulas exist? They do; a mathematician found them in 1985, and the proof is one of the few outright victories in this entire war. That’s Chapter 8. But first, a different idea entirely: CDCL answers one question per run — satisfiable or not. What if you could pay once to compile the formula into a data structure that then answers every question (satisfiability, counting, equivalence) instantly? There’s a famous one, it conquered hardware verification twice, and it comes with this book’s first unconditional exponential lower bound. Chapter 5.
Further reading
- Everything’s Bigger in Texas: The Largest Math Proof Ever (Heule, Kullmann & Marek, 2016) — the Pythagorean triples paper; the encoding section is a master class in SAT modeling.
- Chaff: Engineering an Efficient SAT Solver (Moskewicz et al., 2001) — VSIDS and watched literals, in eight pages that reoriented the field.
- MiniSat (Eén & Sörensson, 2003) — read the actual source; there is no better way to internalize CDCL.
- Handbook of Satisfiability, 2nd ed. (Biere et al., eds.) — the field’s reference; chapters 3–4 cover CDCL at full depth.
- On the Power of Clause-Learning SAT Solvers as Resolution Engines (Pipatsrisawat & Darwiche, 2011) — the CDCL ≡ resolution theorem behind this chapter’s closing trap.