← Back to all chapters

Chapter 13Down the Rabbit Hole: How SAT Solvers Learn From Their Mistakes

8 min read
rabbit-holealgorithmsformal-methodslogic

SAT is the textbook NP-complete problem: given a boolean formula, does any assignment make it true? In the worst case nobody knows how to avoid exponential time.

Yet SAT solvers are quietly load-bearing. Chip design runs bounded model checking as repeated SAT calls. Z3, CVC5 and Yices have a SAT core. libsolv, the package resolver behind DNF, Zypper and Conda/Mamba, is a SAT solver, and PubGrub (Dart's pub, Poetry, uv) is a close cousin. In 2016 a SAT solver settled the Boolean Pythagorean triples problem, with a proof of roughly 200 TB.

Hopelessly hard, or solving huge formulas every day? The answer is CDCL, conflict-driven clause learning. Every time the solver hits a dead end, it works out why, writes the reason down as a clause, and never makes that mistake again.

The planner who keeps repeating themselves#

You're seating 200 wedding guests under thousands of rules. "Ann won't sit with Bob." "Cal sits with Dee or Eve." You hit a clash and undo your last choice.

A naive planner undoes only the last choice, and an hour later makes the same underlying mistake in a different arrangement. A CDCL planner asks which of its choices actually caused the clash, writes that combination down as a rule, jumps back to the choice that mattered, and keeps the rule forever.

The naive planner is DPLL (1962): pick a variable, try a value, propagate, backtrack on conflict. Propagation is unit propagation: if a clause has every literal false but one unassigned, that literal must be true.

DPLL backtracks chronologically, so on structured formulas (10^5 to 10^7 variables) it rediscovers the same contradiction under every permutation of irrelevant decisions. Pre-1996 solvers handled a few hundred variables on hard combinatorial instances.

Watching one conflict#

The dive has a small CDCL implementation with a trace, fuzzed against brute force on 2,000 random formulas with zero mismatches. Five clauses:

C1 (¬3 ∨ 4)   C2 (¬4 ∨ 5)   C3 (¬4 ∨ 6)   C4 (¬5 ∨ ¬6 ∨ ¬2)   C5 (1 ∨ 2 ∨ 3 ∨ 7)
1/5Decide
L1: x1 = T
L2: x2 = T
L3: x3 = T
trail: 1 | 2 | 3

Each guess opens a new decision level.

One conflict, step by step

DPLL would just flip x3. CDCL got there by deduction.

conflict at L3
  -> undo x3, flip it to F
  -> keep going, learn nothing
later: a new arrangement of the same
irrelevant choices hits the same x4 + x2
clash, and the search finds it all again
Same conflict, two reactions

How it picks the clause#

"The real culprit" has a mechanical definition, and computing it is resolution. From (A ∨ x) and (B ∨ ¬x), derive (A ∨ B). If an assignment satisfies both inputs, one of A or B must hold, so the output never rules out a real solution.

Conflict analysis walks back along the trail, resolving the conflict clause against the reasons that forced each literal:

start:               (¬5 ∨ ¬6 ∨ ¬2)      level-3 literals: ¬5, ¬6
resolve with C3 on 6: (¬5 ∨ ¬2 ∨ ¬4)      level-3 literals: ¬5, ¬4
resolve with C2 on 5: (¬2 ∨ ¬4)           level-3 literals: ¬4   -> stop

Keep resolving until exactly one literal from the current level remains. That's the first unique implication point (1-UIP), here x4: every path in the implication graph from the decision x3 to the conflict passes through it. The decision x3 is also a UIP, just a later one.

1-UIP cutreason sideconflict sideC1C2C3C4x3x4x5x6x2⊥decision, L31-UIPx2 decided at L2conflictlearn (¬2 ∨ ¬4)
The implication graph of the worked example. Every path from the decision x3 to the conflict passes through x4, so the cut right after x4 gives the learned clause.

Why stop at one? The clause becomes asserting. Every other literal sits at a lower level. Jump back to the highest of those (level 2), and the clause is unit, so propagation immediately forces ¬4. It steers the search off the dead end the instant you land.

Learning is sound by construction: every learned clause is a chain of resolutions over earlier clauses, so it's implied by the original formula. Keeping or deleting them changes speed, never the answer. Proof checkers use a quicker test, RUP: assume the clause's negation (x2, x4 true), propagate (x5 from C2, x6 from C3), and C4 is falsified.

The rest of the engine#

GRASP introduced learning and backjumping in 1996. Chaff (2001) added two big tricks and reported one to two orders of magnitude over predecessors. MiniSat (2003) made it small enough, about 2k lines, to read in a weekend.

  • Two watched literals. Each clause watches two literals and needs attention only when one becomes false. Then move the watch, or the clause is unit or conflicting. Backtracking costs nothing: unassigning can only make literals less false.
  • VSIDS. Every variable has an activity score. Each conflict bumps the variables in the analysis, then decays everyone. MiniSat grows the bump by 1/0.95 per conflict instead of multiplying all scores by 0.95. Same ordering, O(1) instead of O(n). The solver branches on whatever keeps showing up in recent trouble.
  • Restarts. Throw away the assignment, keep every learned clause, activity score and last polarity. Cheap, and it escapes bad early decisions. MiniSat follows the Luby sequence (1, 1, 2, 1, 1, 2, 4, 1, 1, 2, ...), within a log factor of the optimal universal schedule.
  • Clause deletion. Glucose (2009) scores clauses by LBD, the number of distinct decision levels among their literals. LBD of 2 or less is kept forever; about half the rest is periodically deleted, worst first.
1121124112restart number: allowed conflicts = unit x this value (a schematic scale)
The Luby restart sequence, first ten terms. Mostly short runs, with a long one at each doubling.

Where it falls off a cliff#

An UNSAT run is one big resolution proof, so CDCL can only be as clever as resolution. The pigeonhole principle (n+1 pigeons don't fit in n holes) takes one sentence for a person. Haken showed in 1985 that every resolution proof of it is exponential in n.

The dive measured it with CaDiCaL 1.5.3 through PySAT on a laptop:

HolesConflicts
5137
6994
76,383
837,288
9319,668
102,657,952 (26.9 s)
  • 5 holes137
  • 6 holes994
  • 7 holes6,383
  • 8 holes37,288
  • 9 holes319,668
  • 10 holes2,657,952
Conflicts CaDiCaL needs on the pigeonhole principle. Each extra hole multiplies the work by seven or eight.

Each extra hole multiplies conflicts by about seven or eight. Parity constraints and Tseitin formulas on expander graphs do the same, which is why XOR-heavy cryptanalysis needs solvers with Gaussian elimination bolted on.

The theorem behind it: with restarts and a suitable (adversarial) decision policy, CDCL is polynomially equivalent to general resolution (Pipatsrisawat and Darwiche, and independently Atserias, Fichte and Thurley, 2011). No short resolution proof, no short CDCL run. And even when one exists, nobody can prove VSIDS will find it.

The plainer failure is bugs. Solvers have returned wrong answers, and fuzzing found them. So modern solvers log a DRAT proof for every UNSAT answer, and independent checkers replay it line by line. "Trust me, it's UNSAT" isn't good enough for a 200 TB theorem.

The question nobody can answer#

Why does CDCL work so well on industrial instances? The field's central question is still open.

Correlates exist: community structure (dense clusters loosely connected), and backdoors (small variable sets that make the rest easy). A 2026 study of over 76,000 bounded model checking instances (Zhang, Xia, Li, Li, Vardi and Ganesh) proposes a "proofdoor", based on sequences of interpolants, that explains scaling where classical parameters don't. But nobody has a theorem linking structure to short proofs and to the heuristic finding them.

The engineering still moves. A SAT 2026 paper (Coutelier, Hader and Kovács) generalizes the backjump: instead of undoing everything above a level or just the last level, it uses the implication graph to undo exactly the assignments that depend on the conflict.

Coutelier, Hader and Kovács, Fig. 3: box plots of propagations per solved 3-colouring instance for non-chronological (NCB), chronological (CB) and graph backtracking (GB) variants, without restarts on the left and with Luby restarts on the right. Every GB variant sits lower than NCB and CB.

Figure 3 from Coutelier, Hader and Kovács, "Generalizing CDCL with Graph Backtracking", SAT 2026, arXiv:2605.28220, licensed CC BY 4.0. Cropped and recompressed.

Fewer propagations on 3-colouring, with and without restarts. Even the backjump, which I'd thought settled since 1996, is still up for redesign.

And the gap I keep thinking about: extended resolution (which DRAT can already express) and cutting planes are provably stronger than resolution, yet no CDCL-style solver finds such proofs automatically on pigeonhole-like families at scale. A solver that writes the one-sentence pigeonhole argument itself doesn't exist yet.

Sources#

© 2026 Bharat Kaurav. Built with Next.js & Tailwind.

>_ bk@netherwatcheresc to close

Welcome, reader. Type help to see what this shell can do.