Maps to: Stanford CS 257 Introduction to Automated Reasoning (Winter 2026), Lecture 4 · Thu 01/15/2026 · Propositional logic: DPLL (guest lecture by Clark Barrett). Reading: Kroening & Strichman, Decision Procedures (DP), Chapter 2 (decision procedures for propositional logic: DPLL, unit propagation and watched literals, decision heuristics). Basis: The Stanford slides are on Canvas and not public. This lecture follows the public decks of the Iowa course CS:4980 (Cesare Tinelli, Spring 2024), which state that they are adapted from slides by Clark Barrett, Caroline Trippel and Andrew (Haoze) Wu at Stanford and by Emina Torlak at the University of Washington: the first half of DPLL and CDCL and the end of Decision Procedures for Satisfiability (“from DP to DPLL”). “The slides” below means those decks. Reused from them:
- the original DPLL idea and the step from DP to DPLL;
- the clause terminology (satisfied, conflicting, unit, unresolved);
- Abstract DPLL with the rules PROPAGATE, PURE, DECIDE, BACKTRACK, FAIL;
- the derivation example on and the exercise;
- the remark that DPLL can be turned into a resolution proof;
- the three shortcomings of DPLL that motivate CDCL.
These notes add proofs of correctness for Abstract DPLL, unit propagation engines including two watched literals, decision heuristics, the construction of tree-like resolution proofs from DPLL runs, and the phase transition of random 3-SAT. Four experiments measure each of them. The experiments and their code were designed for these notes and do not reflect what was said in class. Code:
code/lecture04/(4 scripts + 1 module; Python standard library only, matplotlib optional; from 3 seconds to about 50 seconds each) Reading time: 3–4 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Explain the step from Davis–Putnam to DPLL: split instead of eliminate, and why that trades memory for time.
- Run DPLL by hand, recursively and as the Abstract DPLL proof system, and read its derivation tables.
- Prove Abstract DPLL sound, complete and terminating with invariants and a lexicographic measure.
- Explain why unit propagation is the workhorse of SAT solving and implement it with two watched literals.
- Define and compare decision heuristics (DLIS, Jeroslow–Wang, MOMS), and explain why they are encoding-sensitive.
- Turn a failed DPLL search into a tree-like resolution refutation, and draw the consequences for lower bounds.
- Describe the phase transition of random 3-SAT and the easy–hard–easy pattern.
- Name the shortcomings of DPLL that CDCL removes, and show them on a measured example.
0.2 Prerequisites and scope
| Assumed | Introduced here | Developed later |
|---|---|---|
| clause sets, unit resolution, DP (Lecture 2) | splitting, decision levels, backtracking | non-chronological backjumping (Lecture 5) |
| proof systems, invariants, measures, strategies (Lecture 3) | Abstract DPLL and its correctness | abstract CDCL (Lecture 5), DPLL(T) (Lecture 10) |
| tree vs DAG resolution proofs (Lecture 2) | DPLL runs as tree-like refutations | CDCL and DRUP proofs (Lecture 5) |
| the adder miters of Lectures 1–2 | DPLL’s exponential behaviour on them | CDCL on the same miters (Lecture 5) |
0.3 Map
§1 from Davis–Putnam to DPLL: split, propagate, backtrack
§2 the recursive procedure; correctness and cost against DP and semantic arguments ← code 01
§3 Abstract DPLL: states, rules, the slides' derivations; correctness proofs ← code 02
§4 unit propagation: the workhorse; naive, counting and two watched literals ← code 03
§5 decision heuristics ← code 04
§6 DPLL refutations are tree-like resolution proofs ← code 02
§7 random 3-SAT and the phase transition ← code 04
§8 the limits of DPLL, and the road to CDCL ← code 04
§9 summary §10 common pitfalls §11 exercises §12 further reading §13 next lecture
0.4 Notation
| Symbol | Meaning |
|---|---|
| literals, with abbreviated as (as in the slides); in code and output is written ¬3 | |
| the complement of | |
| a sequence of literals (a partial assignment); marks a decision literal | |
| , | decision level of (the literals after the -th decision); levels |
| / ” is false in ” | is assigned true / |
| a state of Abstract DPLL; UNSAT is the failure state |
The slides’ clause terminology, for the partial assignment :
| clause | status under | why |
|---|---|---|
| satisfied | a literal is true | |
| conflicting | every literal is false | |
| unit | all literals but one are false, the last () unassigned | |
| unresolved | none of the above |
0.5 The code of this lecture
One module, dpll.py, with four versions of the same procedure:
dpll_recursive— the textbook recursion on clause sets, with traces;AbstractDPLL— the slides’ proof system on states , printing derivation tables in the slides’ format, runnable with any strategy;DPLLSolver— an iterative solver on a trail with chronological backtracking, three unit-propagation engines (naive,counting,watched) and five decision heuristics (first,random,dlis,jw,moms), with machine-independent work counters;dpll_refutation— DPLL that records why each branch failed, producing a tree-like resolution refutation that Lecture 2’s checker verifies.
1. From Davis–Putnam to DPLL
Lecture 2 ended with a trade-off. The Davis–Putnam procedure (1960) never guesses: it eliminates variables by resolution. But each elimination can square the number of clauses, and on random 3-CNF with 4.26 clauses per variable it ran out of a 2-million-pair budget at 25 variables.
Two years later, Davis, Logemann and Loveland (1962) replaced elimination by splitting. The slides:
Let be the input clause set. Choose a literal occurring in . Recursively check ; if SAT, return SAT. Otherwise recursively check and return that result.
Intuition. DP asks “what do all the clauses say about , taken together?” and writes the answer down as new clauses — a lot of writing. DPLL asks “what if were true?” and looks: the unit clause is propagated at once, the problem shrinks, and if it fails, “what if were false?”. Nothing is written down beyond the current branch. A detective who keeps a notebook of every inference (DP) versus one who tries a hypothesis, follows its consequences, and crosses it out when it fails (DPLL).
DPLL is built from three ingredients, each met before:
| ingredient | from | role |
|---|---|---|
| splitting on a variable | the SPLIT rule (Lectures 1, 3) | exhaustive, disjoint cases: every assignment is in exactly one branch |
| unit propagation | DP’s 1-literal rule, unit resolution (Lecture 2) | deduce instead of guess; complete with splitting |
| backtracking | depth-first search | memory linear in the number of variables |
Modern CDCL solvers (Lecture 5) are still DPLL at heart: the slides call modern SAT solvers an extension of the DPLL procedure.
2. The recursive procedure
2.1 The algorithm
DPLL(Δ):
repeat: # simplify
if {} ∈ Δ: return UNSAT # a conflict
if some {l} ∈ Δ: Δ := Δ|l # unit propagation: make l true
elif some literal l is pure: Δ := Δ|l # (optional) pure literal
else: break
if Δ = ∅: return SAT
choose a literal l
if DPLL(Δ|l) = SAT: return SAT
return DPLL(Δ|l̄)
where removes the clauses containing and deletes from the others. Script 01 (Part 1) traces it on the slides’ DPLL example (the clause set of §3.3) and on DP example 2:
Δ = {p1, ¬p2} {¬p1, ¬p2} {p2, p3} {¬p3, p2} {p1, p4} Δ = {p1, p2} {p1, ¬p2} {¬p1, p3} {¬p1, ¬p3}
pure 4 decide 1
decide 1 unit 3
unit ¬2 conflict
unit 3 decide ¬1
conflict unit 2
decide ¬1 conflict
unit ¬2 -> UNSAT
unit 3
conflict
-> UNSAT
Each split creates two simpler problems: the decision literal becomes a unit clause, and unit propagation follows. In both examples, a single decision suffices to expose the conflict, in each branch.
2.2 Correct, and cheap in memory
DPLL is sound and complete because splitting is exhaustive (every model makes true or false) and simplification by a unit clause preserves satisfiability given that branch; it terminates because every split removes a variable. §3 proves this formally for the abstract version. Script 01 (Part 2) checks it on 2,000 random clause sets (3–12 variables): the recursive and the iterative solver agree with the truth table 2,000/2,000 times, and all 1,225 models returned satisfy their input.
Memory. The recursion keeps one simplified copy of the clauses per level; the iterative solver of §4 keeps only the input and a trail of at most assigned literals. Script 01 (Part 3) runs both procedures on the very instances where DP drowned in Lecture 2 (3 instances per row):
| vars | clauses | DP: peak clauses | DPLL: decisions | DPLL: max level |
|---|---|---|---|---|
| 10 | 43 | 78, 66, 61 | 6, 4, 4 | 6 |
| 20 | 85 | 2,047, 1,953, 2,972 | 12, 16, 15 | 15 |
| 25 | 106 | > 8,798, > 6,947, > 6,855 (stopped) | 10, 17, 8 | 8 |
| 50 | 213 | (not run) | 80, 58, 60 | 14 |
| 100 | 426 | (not run) | 407, 714, 125 | 32 |
Space was DP’s bottleneck; DPLL removes it. Its time still grows exponentially — the decision counts climb — but at 100 variables it is still well under a second here.
2.3 Why split on variables? Lecture 1’s puzzle solved
Lecture 1’s semantic argument also splits — on formulas: from it branches into and . Script 01 (Part 4) runs it and DPLL on the same random 3-CNF (5 clauses per variable; the tableau stops at its first open branch, as in Lecture 1):
| vars | tableau lines, plain | tableau lines, skip fulfilled | DPLL nodes | truth-table rows |
|---|---|---|---|---|
| 3 | 36, 16,456, 20,639 | 36, 1,636, 1,270 | 4, 7, 7 | 8 |
| 4 | > 100,000, 84,151, > 100,000 | 6,574, 2,998, 2,850 | 7, 7, 6 | 16 |
| 5 | > 100,000, 273, > 100,000 | 1,406, 106, 23,381 | 5, 4, 6 | 32 |
Thousands of tableau lines against a handful of DPLL nodes, on identical inputs. The three differences are exactly what Lecture 1’s “plan vs reality” diagnosed:
- Disjoint cases. and cannot both hold, so each assignment is explored once; the cases and overlap.
- Satisfied clauses disappear. After is set, every clause containing is gone for the rest of the branch; the tableau splits on satisfied disjunctions again and again.
- Propagation after every decision. Forced literals are deduced before the next guess.
Run it.
python3 01_from_dp_to_dpll.py(about 6 seconds).
3. Abstract DPLL
3.1 States and rules
To reason about DPLL independently of data structures, the slides present it as a satisfiability proof system in the style of Lecture 3 (after Nieuwenhuis, Oliveras and Tinelli 2006, and Krstić and Goel 2007). A state is UNSAT or a pair : is a sequence of literals, some marked as decision points ; is the clause set. determines the partial assignment if , false if , undefined otherwise. The initial state is ; the expected final states are UNSAT, or with a model.
( contains the literals of and their complements.) The clause that makes PROPAGATE fire is the antecedent of . BACKTRACK goes back over the last decision only — the premise enforces chronological backtracking — and puts the complement of the decision literal in its place, now without a decision mark: it is no longer a guess but a consequence. Note that no rule changes : DPLL learns nothing (CDCL’s rules will).
3.2 The slides’ derivation and exercise
. Script 02 (Part 1) runs Abstract DPLL with the slides’ priorities (repair a conflict, then PROPAGATE, then PURE, then DECIDE) and prints:
| rule | |
|---|---|
| PURE | |
| DECIDE | |
| PROPAGATE (by ) | |
| PROPAGATE (by ) | |
| BACKTRACK (conflicting clause ) | |
| PROPAGATE (by ) | |
| PROPAGATE | |
| UNSAT | FAIL (conflicting clause , no decision left) |
The exercise decides 3 first: , , (by ), (by ), BACKTRACK on to , then , , FAIL. Both tables match the slides row for row.
On a satisfiable set the run stops when no rule applies. On (the set Lecture 5 will use for CDCL), the default strategy propagates 1 and 2, sets the pure literals 3, 4 and , then decides 6 and 7: , a model.
3.3 Correctness
We prove the three properties of Lecture 3. (For simplicity, leave PURE aside first; it is discussed at the end.)
Lemma (invariants). In every state reachable from :
- contains no literal twice and never both and ;
- every non-decision literal of is entailed by together with the decision literals that precede it in .
Proof. (1) Every rule adds only literals whose variable is unassigned. (2) By induction on the derivation. PROPAGATE adds because of with all ; each is a decision or (by induction) entailed by and earlier decisions, so plus the decisions entail , and with the clause, . BACKTRACK applies when a clause is false in : by the invariant, entails every literal of , hence , while — so is unsatisfiable, where is the last decision. Therefore : exactly invariant (2) for in . ∎
Theorem. Abstract DPLL is sound, complete and terminating.
Soundness of FAIL. FAIL applies when a clause is false in and has no decision. By the invariant, entails every literal of , hence ; with , is unsatisfiable.
Final SAT states. If no rule applies to , then no clause is false in (otherwise BACKTRACK or FAIL would apply), and every variable of is assigned (otherwise DECIDE would apply). So every clause has all its literals assigned and not all false: it contains a true literal. is a model.
Termination. For , consider the tuple of length (there are at most decisions). PROPAGATE and PURE increase the last non-zero component; DECIDE turns a 0 into 1 at a new position; BACKTRACK removes level and adds to level , so component increases and later components become 0. Every rule increases the tuple lexicographically. All components are at most , so there are finitely many tuples, and no derivation is infinite.
Completeness. Every derivation is finite, and in a final state either FAIL has produced UNSAT or no rule applies, in which case is a model. So every maximal derivation ends with a verdict — by Lecture 3, Abstract DPLL is a decision procedure, for every strategy.
PURE. A pure literal is not entailed; it is merely harmless: if (with the current decisions) has a model, it has one in which is true, since no clause contains . The proof goes through if pure literals are treated like decisions in invariant (2) — they are assumptions that can never cause a conflict.
Checked by machine. Script 02 (Part 2) runs Abstract DPLL on 1,000 random clause sets (3–6 variables), each with a random strategy (a random applicable rule instance at every step), and checks every step:
| check | result |
|---|---|
| final state correct (UNSAT iff unsatisfiable; SAT with a model) | 1,000 / 1,000 |
| steps where contains and | 0 |
| deduced literals not entailed by + the decisions and pure literals before them | 0 |
| steps where the measure did not increase lexicographically | 0 |
| median / max number of steps | 7 / 53 |
3.4 Which rules are necessary?
The proof shows something surprising: DECIDE, BACKTRACK and FAIL alone are already sound, complete and terminating — the final-state argument never used PROPAGATE. That system enumerates assignments and backtracks at the first falsified clause: a truth table that stops early. Script 02 (Part 3), on 300 random 3-CNF with 4–8 variables at 4.26 clauses per variable:
| variant | correct | mean steps | max steps | mean DECIDE steps |
|---|---|---|---|---|
| all rules | 300 / 300 | 14.3 | 56 | 3.8 |
| without PURE | 300 / 300 | 14.3 | 56 | 3.8 |
| without PROPAGATE and PURE | 300 / 300 | 35.3 | 191 | 19.0 |
PROPAGATE is “only” an optimization — the one that matters: 2.5 times fewer steps and 5 times fewer guesses even on these tiny instances. PURE fired once in the 300 runs: with the slides’ definition a literal must be pure in all of , which almost never happens at this density. Modern solvers drop PURE.
Run it.
python3 02_abstract_dpll.py(about 7 seconds).
4. Unit propagation: the workhorse
4.1 Who does the work?
Script 03 (Part 1) counts how the variables of a solved instance got their values:
| instance | vars | clauses | decisions | propagations | by propagation | conflicts |
|---|---|---|---|---|---|---|
| Sudoku (easy) | 729 | 12,020 | 0 | 729 | 100.0% | 0 |
| Sudoku (hard) | 729 | 12,009 | 27 | 2,257 | 98.8% | 18 |
| 12-queens | 144 | 2,608 | 138 | 700 | 83.5% | 34 |
| random 3-SAT, 50 vars (UNSAT) | 50 | 213 | 48 | 793 | 94.3% | 49 |
| random 3-SAT, 200 vars, 3 clauses/var | 200 | 600 | 143 | 57 | 28.5% | 0 |
| pigeonhole, 5 holes | 30 | 81 | 374 | 3,127 | 89.3% | 375 |
| 6-bit adder miter | 72 | 202 | 2,194 | 20,122 | 90.2% | 2,195 |
(Propagations count every deduced assignment over the whole search, so they can exceed the number of variables.) The easy Sudoku is solved by unit propagation alone. On every constrained instance, 83–99% of assignments are deduced; only the under-constrained random instance is decided mostly by guesses — and it never meets a conflict. The time of a DPLL solver is dominated by unit propagation, so its implementation matters.
4.2 Three implementations
The question unit propagation asks after each assignment: which clauses just became unit or conflicting?
- Naive. Scan every clause, repeat until nothing changes. Simple, and hopeless on large inputs.
- Counting. Keep, for each clause, the number of true and of false literals, and occurrence lists from literals to clauses. Assigning updates every clause containing or ; a clause with no true literal and one unassigned literal is unit. The catch: backtracking must undo every counter update.
- Two watched literals (Moskewicz, Madigan, Zhao, Zhang and Malik, Chaff, 2001). Each clause watches two of its literals. A clause can become unit or conflicting only when one of its watched literals becomes false; until then it is ignored. When a watched literal becomes false, look for another literal of the clause that is not false and watch it instead; if there is none, the other watch is the only candidate: if it is unassigned the clause is unit, if false it is conflicting.
The invariant behind watched literals: in a state where propagation has finished without conflict, for every clause, either both watched literals are non-false, or one of them is true. Backtracking only unassigns literals, which can only make literals non-false, so the invariant survives: nothing needs to be done on backtracking. That is the decisive advantage over counting, since a DPLL (and CDCL) solver backtracks constantly.
Script 03 (Part 3) follows one clause , initially watching :
| event | visits of | watches afterwards | effect |
|---|---|---|---|
| assign | 0 | – ( is not watched) | |
| assign | 1 | the watch moves to | |
| assign | 1 | no replacement left: propagated | |
| backtrack: undo and | 0 | nothing to do | |
| assign | 0 | – |
4.3 Measured: same search, different cost
All three engines reach the same propagation fixpoint, so with the same heuristic they perform the same search (script 03 checks: same decisions and conflicts). Only the work differs (Part 2):
| instance | engine | clause visits | visits per propagation |
|---|---|---|---|
| Sudoku (hard) | naive / counting / watched | 1,937,323 / 139,348 / 16,168 | 864.1 / 62.7 / 7.2 |
| 12-queens | naive / counting / watched | 629,494 / 59,188 / 6,419 | 891.6 / 84.6 / 9.2 |
| random 3-SAT, 50 vars (UNSAT) | naive / counting / watched | 43,185 / 23,467 / 2,858 | 51.2 / 29.4 / 3.6 |
| random 3-SAT, 200 vars | naive / counting / watched | 109,200 / 1,857 / 571 | 1,915.8 / 32.6 / 10.0 |
| pigeonhole, 5 holes | naive / counting / watched | 92,404 / 49,447 / 6,242 | 29.6 / 15.8 / 2.0 |
| 6-bit adder miter | naive / counting / watched | 2,420,817 / 351,883 / 62,549 | 125.0 / 17.9 / 3.1 |
Watched literals visit 15 to 190 times fewer clauses than naive rescanning, and several times fewer than counting (whose figures include the undo work on backtracking). In our Python code the wall-clock gap between counting and watching is smaller than the visit counts suggest, since each watched visit does more interpreted work; in compiled solvers the visits dominate.
Run it.
python3 03_unit_propagation.py(about 3 seconds).
5. Decision heuristics
When nothing can be deduced, DPLL must guess. Which variable, and which value? A good choice leads quickly to a model or to a short refutation; a bad one explores a big useless subtree. Classic heuristics score literals by looking at the unresolved clauses (not yet satisfied) and their unassigned literals:
| heuristic | score of literal | intuition |
|---|---|---|
| first | smallest unassigned variable, value true | no intelligence: a baseline |
| random | random variable and value | another baseline |
| DLIS (dynamic largest individual sum) | number of unresolved clauses containing | satisfy as many clauses as possible |
| Jeroslow–Wang (JW) | short clauses weigh more: they are closest to becoming unit or conflicting ( is the chance that a random assignment falsifies ) | |
| MOMS | among the shortest unresolved clauses, occurrence counts ; choose maximizing | Maximum Occurrences in clauses of Minimum Size; the product favours variables that occur in both polarities (Freeman 1995) |
(Our JW uses the current number of unassigned literals as .) Script 04 (Part 1) — decisions until the answer:
| instance | first | random | DLIS | JW | MOMS |
|---|---|---|---|---|---|
| random 3-SAT, 75 vars, 320 clauses (median of 5) | 1,368 | 604 | 45 | 34 | 21 |
| pigeonhole, 5 holes | 374 | 214 | 374 | 374 | 259 |
| 10-queens | 28 | 13 | 144 | 144 | 115 |
| Sudoku (hard) | 27 | > 1,000 | > 1,000 | > 1,000 | > 1,000 |
| 6-bit adder miter | 4,095 | 7,464 | 5,085 | 2,194 | 1,950 |
- On random 3-SAT, counting heuristics need 30 to 65 times fewer decisions than a fixed order.
- On n-queens and Sudoku the ranking flips. These encodings consist mostly of binary at-most-one clauses (Lecture 2, §8), so negative literals (“no queen here”, “this cell is not a 3”) occur in many short clauses, and the counting heuristics keep choosing them — which propagates little. The fixed order sets a variable true (place a queen, fill a cell), which propagates a lot. Heuristics are encoding-sensitive: the same problem, encoded differently, can reverse their ranking.
- No heuristic is best everywhere. These “static counting” heuristics also cost a full scan of the clauses per decision. Modern solvers use VSIDS (Variable State Independent Decaying Sum, also from Chaff), which scores variables by their involvement in recent conflicts — cheap to maintain and robust — but it needs the learned clauses of CDCL to work well (Lecture 5).
6. DPLL refutations are tree-like resolution proofs
The slides note that the search of DPLL can be turned, after the fact, into a resolution proof. Here is the construction that dpll_refutation implements.
Attach to every failed node of the search, with partial assignment , a clause that is falsified by — the reason for the failure:
- at a conflict, is the input clause all of whose literals are false under ;
- at a split on , the children give (falsified by ) and (falsified by ). If does not contain , it is already falsified by : take it. Likewise for and . Otherwise contains and contains : their resolvent on is falsified by ;
- a unit propagation of by clause is a split whose -branch fails at once, with as its clause.
At the root, is empty, and the only clause falsified by the empty assignment is . So a failed DPLL search, read bottom-up, is a resolution refutation — a tree-like one, since the two branches share nothing. On DP example 2 the search of §2.1 gives three steps:
5. {¬p1} resolve {¬p1, p3}, {¬p1, ¬p3} on p3 (the branch p1 failed)
6. {p1} resolve {p1, p2}, {p1, ¬p2} on p2 (the branch ¬p1 failed)
7. {} resolve 6, 5 on p1 (the split on p1)
On the slides’ DPLL example the extracted proof derives twice (lines 5 and 7 of script 02’s output): a tree cannot reuse a clause. Script 02 (Part 4) extracts proofs from DPLL and lets Lecture 2’s independent checker verify them:
| unsatisfiable input | DPLL nodes | tree-like refutation steps | checker | Lecture 2 saturation: DAG steps |
|---|---|---|---|---|
| random 3-CNF #1 (10 vars, 60 clauses) | 43 | 35 | yes | 31 |
| random 3-CNF #2 | 34 | 28 | yes | 36 |
| random 3-CNF #3 | 26 | 22 | yes | 27 |
| pigeonhole, 3 holes | 66 | 42 | yes | 66 |
| pigeonhole, 4 holes | 410 | 188 | yes | 362 |
| pigeonhole, 5 holes | 3,040 | 970 | yes | > budget |
Two consequences:
- A lower bound for every DPLL solver. Whatever its heuristics and data structures, DPLL’s running time is at least the size of the shortest tree-like resolution refutation of its input. Haken’s pigeonhole bound (Lecture 2) therefore applies, and tree-like resolution is known to be exponentially weaker than general resolution on some families.
- A surprise in the measurements. The tree-like proofs DPLL finds are often shorter than the DAG proofs found by Lecture 2’s saturation (188 vs 362 steps on 4 holes), and DPLL finishes 5 holes, where saturation ran out of budget. A DAG proof can be shorter, but saturation’s shortest-clause-first strategy does not find the shortest one. As in Lecture 3, the strategy matters as much as the proof system.
7. Random 3-SAT and the phase transition
7.1 The model
A random -CNF with variables and clauses draws each clause by choosing distinct variables uniformly and negating each with probability (the “fixed clause length” model). The key parameter is the density . Two easy facts:
- The probability of satisfiability decreases with : adding a clause can only remove models.
- First-moment bound. A fixed assignment satisfies a random 3-clause with probability , so the expected number of models is . When , this expectation tends to 0, so the formula is unsatisfiable with high probability (exercise 9).
The true threshold is lower. Experiments by Mitchell, Selman and Levesque (1992) and Crawford and Auton (1996) located it near 4.26 clauses per variable for 3-SAT, and statistical-physics methods predict about 4.267 (Mézard, Parisi and Zecchina 2002) — as reported in the literature. Friedgut (1999) proved that the transition is sharp, and Ding, Sly and Sun (2015) proved the predicted threshold for all sufficiently large .
7.2 Easy–hard–easy, measured
Script 04 (Part 2) generates 30 instances per cell, for and densities 3.0 to 6.0, and runs DPLL (watched literals, Jeroslow–Wang). It reports the fraction of satisfiable instances and the median number of conflicts (failed branches — a better measure of search effort than decisions, because an easy satisfiable instance still needs one decision per unconstrained variable, but no conflict):
| \ density | 3.0 | 3.5 | 4.0 | 4.25 | 4.5 | 4.75 | 5.0 | 5.5 | 6.0 |
|---|---|---|---|---|---|---|---|---|---|
| P(SAT), | 1.00 | 0.97 | 0.90 | 0.50 | 0.50 | 0.37 | 0.23 | 0.00 | 0.00 |
| P(SAT), | 1.00 | 1.00 | 0.87 | 0.60 | 0.20 | 0.07 | 0.00 | 0.00 | 0.00 |
| conflicts, | 0 | 0 | 0 | 10 | 9 | 8 | 9 | 10 | 9 |
| conflicts, | 0 | 0 | 15 | 21.5 | 31 | 40.5 | 32 | 30 | 27 |
| conflicts, | 0 | 1 | 20 | 98 | 172.5 | 120.5 | 119.5 | 73 | 64.5 |
| conflicts, | 0 | 1 | 15 | 517 | 604.5 | 509.5 | 363.5 | 239 | 138 |

- Under-constrained (few clauses): almost always satisfiable, and easy — DPLL assigns values and never meets a conflict.
- Over-constrained (many clauses): almost always unsatisfiable, and easy again — conflicts come fast and refutations are short.
- At the transition (4.25–4.75 here), P(SAT) falls from near 1 to near 0, more steeply as grows, and the work peaks: at , about 600 conflicts at density 4.5 against 0–1 at 3.5 and 138 at 6.0. The peak itself grows exponentially with (10 → 40.5 → 172.5 → 604.5 median conflicts from to 100).
Hardness is a property of the instance distribution, not of the size alone. Random instances at the threshold became the standard stress test for SAT solvers in the 1990s. Industrial instances behave very differently: they are huge but highly structured, which is what CDCL exploits.
Run it.
python3 04_heuristics_and_phase_transition.py(about 50 seconds).
8. The limits of DPLL, and the road to CDCL
The slides list DPLL’s shortcomings on practical instances:
- No learning. All work done to conclude that the current assignment is bad is thrown away; bad partial assignments that fail for the same root cause are revisited.
- Chronological backtracking. It backtracks only one level, even when the assignment became doomed at a much lower level.
- Naïve decisions. It ignores the state of the search when choosing the next decision.
Script 04 (Part 3) shows the consequence on Lecture 1’s adder-equivalence problem (ripple-carry vs or-carry miter, Tseitin-encoded, Jeroslow–Wang):
| bits | vars | clauses | decisions | truth-table rows |
|---|---|---|---|---|
| 4 | 46 | 128 | 155 | 256 |
| 6 | 72 | 202 | 2,194 | 4,096 |
| 8 | 98 | 276 | 31,271 | 65,536 |
| 9 | 111 | 313 | 119,031 | 262,144 |
The decisions grow by about ×3.8 per bit — the same rate as the rows of the truth table. On this problem plain DPLL is essentially an enumeration of half the input space: it needed about 8 seconds at 9 bits here, and the measured growth extrapolates to about seconds at 32 bits. Lecture 1’s bit-parallel truth table did 12 bits in under a tenth of a second.
Why? When the two adders disagree on a carry under some partial assignment, DPLL detects the conflict, backtracks one decision, and later meets the same carry conflict again in every other branch below the same root cause. A solver that learned a clause summarizing the cause (“these three carry bits cannot all be like this”) would never re-explore it, and could jump straight back to the decision that caused it. That is conflict-driven clause learning:
- learning: add a clause, derived by resolution from the conflict, that captures its root cause;
- non-chronological backjumping: jump back several levels, to where the learned clause becomes unit;
- conflict-driven heuristics (VSIDS): decide on the variables involved in recent conflicts.
9. Summary
- DPLL = splitting on a variable + unit propagation + backtracking. It replaces DP’s variable elimination, trading DP’s memory explosion for (exponential, but often small) search time. Memory stays linear.
- Splitting on variables gives disjoint cases and removes satisfied clauses; splitting on formulas (semantic arguments) does neither — thousands of lines against a handful of nodes on the same instances.
- Abstract DPLL (PROPAGATE, PURE, DECIDE, BACKTRACK, FAIL) is a proof system; it is sound, complete and terminating for every strategy, proved by two invariants and a lexicographic measure on decision-level sizes, and checked step by step by machine.
- DECIDE + BACKTRACK + FAIL already decide SAT; unit propagation is what makes DPLL fast. It assigns 83–99% of the variables on constrained instances.
- Two watched literals make propagation cheap: a clause is visited only when a watch becomes false, and backtracking costs nothing.
- Decision heuristics (DLIS, JW, MOMS) help a lot on random instances and can hurt on structured ones; they are encoding-sensitive.
- A failed DPLL run is a tree-like resolution refutation; every DPLL solver is bounded below by tree-like resolution proof size.
- Random 3-SAT has a phase transition near 4.26 clauses per variable; the hardest instances cluster there (easy–hard–easy).
- DPLL has no learning and backtracks chronologically; on the adder miters its work grows like the truth table’s. CDCL fixes both.
10. Common pitfalls
| Pitfall | Why it is wrong | Correct view |
|---|---|---|
| “BACKTRACK undoes the last literal” | It undoes everything after the last decision and flips that decision | |
| Keeping the decision mark on the flipped literal | is now entailed (by and earlier decisions), not guessed | Without the mark; otherwise FAIL would never fire |
| “Unit propagation is needed for correctness” | DECIDE + BACKTRACK + FAIL are already complete | It is needed for speed (§3.4) |
| “A pure literal is entailed” | It is harmless, not entailed | Treat it like a decision in the invariant |
| Updating watches on backtracking | Unassigning never breaks the watch invariant | Watched literals need no undo work |
| Watching the same literal twice | Then one false literal makes the clause look unit or conflicting too early | Two distinct literals; unit clauses are handled before the search |
| Measuring random-instance hardness by decisions | Easy satisfiable instances need one decision per free variable | Count conflicts (failed branches) |
| “A heuristic that wins on random 3-SAT wins everywhere” | DLIS/JW lose on queens and Sudoku encodings | Heuristics are encoding-sensitive; VSIDS is the robust choice in CDCL |
| “DPLL beats truth tables” | On the adder miters it grows at the same rate | Without learning, DPLL can re-explore the same conflict exponentially often |
11. Exercises
Answers are collapsed; try each exercise first.
1. (Abstract DPLL) Run Abstract DPLL on without PURE, deciding first and then 5 (then smallest variable, true first). Write the table.
Answer
PROPAGATE; PROPAGATE; DECIDE; PROPAGATE (by ); DECIDE; PROPAGATE (by ); PROPAGATE (by ); conflict on : BACKTRACK to ; DECIDE 6, DECIDE 7; no rule applies: SAT. (Lecture 5’s CDCL runs on the same set and learns the clause from the same conflict.)
2. (termination) Show that BACKTRACK increases the measure lexicographically, using the slides’ example step .
Answer
Before: , : tuple . After: : tuple . The first component grew from 1 to 2, so the new tuple is larger, although it is “shorter” overall. In general BACKTRACK increases component and zeroes the later ones.
3. (soundness) Why must the flipped literal lose its decision mark? What would go wrong if BACKTRACK produced ?
Answer
is entailed by and the earlier decisions (invariant proof, §3.3), so it is not a guess. If it kept a mark, the next conflict below it would BACKTRACK over it again, flipping back to — an infinite loop between the two values — and FAIL, which requires no decision in , would never be reachable. The measure argument would also break.
4. (final states) Prove that if no rule of Abstract DPLL applies to , then satisfies . Which rules does the proof use?
Answer
See §3.3: no conflicting clause (else BACKTRACK or FAIL), every variable assigned (else DECIDE). Only DECIDE, BACKTRACK and FAIL are used — which is why the system without PROPAGATE and PURE is still complete (§3.4).
5. (heuristics) Compute the JW scores of all literals for (nothing assigned). Which literal does JW choose?
Answer
; ; ; ; ; ; . JW chooses (it satisfies both binary clauses).
6. (watched literals) Why two watches and not one? And why are clauses of length 1 not watched?
Answer
With one watch , the clause is unit when all other literals are false; detecting that needs to know when the second-to-last non-false literal becomes false — information a single watch cannot give without scanning. With two watches, as long as both are non-false the clause cannot be unit or conflicting; the moment one becomes false, a scan for a replacement either succeeds (keep ignoring the clause) or proves that the other watch is the last candidate. A unit clause has no second literal to watch: it is propagated once, before the search, at level 0 (and never unassigned).
7. (DPLL to resolution) Build the tree-like refutation from the DPLL run on DP example 2 (§2.1) by hand.
Answer
Branch : unit (by ) then conflict on : resolve them on into , falsified by . Branch : unit by , conflict on : resolve on into . Split on : resolve and into . Three steps — the output of dpll_refutation in §6.
8. (counting vs watching) In the counting engine, why does backtracking cost as much as propagating? Give the number of counter updates for assigning, then unassigning, a literal that occurs in clauses positively and clauses negatively.
Answer
Assigning increments the true-counter of the clauses containing and the false-counter of the clauses containing : updates. Unassigning must undo exactly those: another . With watched literals, assigning visits only the clauses watching (usually far fewer than ), and unassigning visits none.
9. (phase transition) Show that a random 3-CNF with clauses over variables has expected model count , and deduce that it is unsatisfiable with high probability when . Why is this not the true threshold?
Answer
Each of the assignments satisfies each clause independently with probability ; by linearity of expectation, , which tends to 0 when . By Markov’s inequality, . It is only an upper bound: below 5.19 the expectation is huge, but it is dominated by rare formulas with exponentially many models, while typical formulas have none above about 4.27.
10. (encodings and heuristics, programming) Explain the Sudoku result of §5, then modify the jw heuristic so that it only considers positive literals (variables set to true). Measure decisions on the hard Sudoku and on random 3-SAT.
Answer
In the Sudoku encoding each negative literal occurs in 32 binary at-most-one clauses (8 each for its cell, row, column and box), each positive literal in 4 “at least one” clauses of length 9; JW weighs binary clauses 4 times more per occurrence than ternary ones and much more than 9-literal ones, so it picks negative literals. Restricting to positive literals on the Sudoku turns each decision into “put digit in cell ”, which propagates many negations; expect far fewer decisions there, and somewhat worse results on random 3-SAT, where polarity carries information.
11. (programming) Implement the two-sided Jeroslow–Wang rule: choose the variable maximizing , then the value with the larger . Compare with one-sided JW on the instances of script 04, Part 1.
Answer
In DPLLSolver.choose, after computing score, pick v = max(vars, key=lambda v: score.get(v, 0) + score.get(-v, 0)) and return v or -v depending on which score is larger. Two-sided JW favours variables that matter in both directions, which tends to shorten refutations; measure and report.
12. (programming) Instrument DPLLSolver to record the index of every conflicting clause, and print the 5 most frequent on the 8-bit adder miter. What does this say about learning?
Answer
Append conflict to a list in solve() and use collections.Counter(...).most_common(5). A few clauses (in the carry logic) account for a large share of all 31,272 conflicts: the same local contradiction is rediscovered in many branches. A learned clause that forbids its cause would prune every one of those branches — the motivation for CDCL.
12. Further reading
- Textbooks
- D. Kroening, O. Strichman, Decision Procedures, 2nd ed., 2016, Ch. 2 (DPLL, BCP, watched literals, decision heuristics, CDCL).
- A. Biere, M. Heule, H. van Maaren, T. Walsh (eds.), Handbook of Satisfiability, 2nd ed., 2021: Ch. 3 (complete algorithms, by A. Darwiche and K. Pipatsrisawat), Ch. 4 (CDCL solvers, by J. Marques-Silva, I. Lynce and S. Malik), Ch. 10 (random satisfiability, by D. Achlioptas).
- D. Knuth, The Art of Computer Programming, Vol. 4B (2022), “Satisfiability”, Algorithms A–D (from backtracking to DPLL with watched literals).
- Papers
- M. Davis, G. Logemann, D. Loveland, “A machine program for theorem-proving”, Communications of the ACM, 1962.
- R. Nieuwenhuis, A. Oliveras, C. Tinelli, “Solving SAT and SAT Modulo Theories: from an abstract Davis–Putnam–Logemann–Loveland procedure to DPLL(T)”, Journal of the ACM, 2006.
- M. Moskewicz, C. Madigan, Y. Zhao, L. Zhang, S. Malik, “Chaff: engineering an efficient SAT solver”, DAC 2001 (two watched literals, VSIDS).
- R. Jeroslow, J. Wang, “Solving propositional satisfiability problems”, Annals of Mathematics and AI, 1990.
- J. Freeman, Improvements to propositional satisfiability search algorithms, PhD thesis, University of Pennsylvania, 1995 (POSIT, MOMS).
- D. Mitchell, B. Selman, H. Levesque, “Hard and easy distributions of SAT problems”, AAAI 1992.
- J. Crawford, L. Auton, “Experimental results on the crossover point in random 3-SAT”, Artificial Intelligence, 1996.
- E. Friedgut, “Sharp thresholds of graph properties, and the k-SAT problem”, JAMS, 1999; J. Ding, A. Sly, N. Sun, “Proof of the satisfiability conjecture for large k”, STOC 2015.
- P. Beame, H. Kautz, A. Sabharwal, “Towards understanding and harnessing the potential of clause learning”, JAIR, 2004 (DPLL as tree-like resolution, CDCL vs resolution).
- Slides: C. Tinelli, DPLL and CDCL and Decision Procedures for Satisfiability in Propositional Logic, Iowa CS:4980, Spring 2024 (adapted from Stanford CS 257 slides by Barrett, Trippel and Wu, and from slides by Torlak).
13. Next lecture
Lecture 5 (CDCL, Trippel) removes DPLL’s shortcomings.
- Abstract CDCL: BACKTRACK becomes CONFLICT, EXPLAIN and BACKJUMP, with a third state component, the conflict clause; FAIL is adapted. The invariant and holds whenever a conflict clause is present.
- The implication graph, the first unique implication point (1-UIP), and why a learned clause is a resolvent — so CDCL proofs are (DAG-like) resolution proofs, checkable in the DRUP format.
- VSIDS, restarts and phase saving, measured by ablation.
- Code:
cdcl.pyanddrup_check.py, built on this lecture’s trail and watched literals; the first test is the 9-bit adder miter that DPLL needed 119,031 decisions for.