Maps to: Stanford CS 257 Introduction to Automated Reasoning (Winter 2026), Lecture 5 · Tue 01/20/2026 · Propositional logic: CDCL (Caroline Trippel). Homework 2 released. Reading: Kroening & Strichman, Decision Procedures (DP), Chapter 2 (conflict-driven clause learning, the implication graph, decision heuristics). Basis: The Stanford slides are on Canvas and not public. This lecture follows the second half of the public deck DPLL and CDCL of the Iowa course CS:4980 (Cesare Tinelli, Spring 2024). The deck says it is adapted from slides by Clark Barrett, Caroline Trippel and Andrew (Haoze) Wu at Stanford and by Emina Torlak at the University of Washington. “The slides” below means that deck. Reused from it:
- the three shortcomings of DPLL;
- the CDCL states and the rules CONFLICT, EXPLAIN, BACKJUMP, FAIL, LEARN, FORGET, RESTART;
- the derivation example on ;
- implication graphs, separating cuts, unique implication points (UIPs) and first-UIP learning;
- the correctness theorems of Basic CDCL and the basic strategy.
These notes add:
- a machine check of the correctness claims, which turns up a precondition that Lemma 2 needs;
- the concrete algorithms: first-UIP analysis on a trail, clause minimization, VSIDS, Luby restarts, phase saving, LBD-based clause deletion;
- DRUP/DRAT proofs and an independent checker;
- CDCL runs as resolution proofs;
- five experiments, including the adder miters of Lectures 1–4 up to 256 bits.
The experiments and their code were designed for these notes and do not reflect what was said in class. Code:
code/lecture05/(5 scripts + 2 modules; Python standard library only, matplotlib optional; from 2 seconds to about 90 seconds each, none over 2 minutes) Reading time: 4 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Name the three shortcomings of DPLL and show the first one on a measured example.
- Run Abstract CDCL by hand: CONFLICT, EXPLAIN, BACKJUMP, FAIL; read its derivation tables.
- Draw the implication graph of a conflict, find its UIPs, and compute the first-UIP learned clause by resolution.
- Explain why a learned clause is sound (entailed), why it is asserting, and to which level CDCL jumps back.
- Prove Basic CDCL terminating, and state exactly which strategies make every run end in SAT or UNSAT.
- Explain the roles of VSIDS, restarts, phase saving and clause deletion, and read an ablation table critically.
- Explain how an UNSAT answer is certified: DRUP/DRAT proofs, RUP and RAT checks, unsatisfiable cores, and why every CDCL refutation is a resolution proof.
- Say where CDCL is dramatically better than DPLL (structured problems), where it is only somewhat better (random 3-SAT), and where every resolution-based solver fails (pigeonholes).
0.2 Prerequisites and scope
| Assumed | Introduced here | Developed later |
|---|---|---|
| resolution, refutations, Haken’s theorem (Lecture 2) | learned clauses as resolvents; DAG vs tree proofs of a solver run | — |
| proof systems, invariants, strategies (Lecture 3) | Abstract CDCL and its correctness | CDCL(T) (Lecture 10) |
| DPLL, trails, decision levels, watched literals (Lecture 4) | conflict analysis, backjumping, VSIDS, restarts, deletion | the SAT engine of Lectures 9–20 |
| the adder miters (Lectures 1, 2, 4) | CDCL on them, up to 256 bits | bit-blasting (Lecture 16), model checking (Lecture 9) |
0.3 Map
§1 why DPLL is not enough: three shortcomings, one measurement
§2 the idea of CDCL in one picture: learn from every conflict
§3 Abstract CDCL: states, rules, the slides' derivation; correctness, checked by machine ← code 01
§4 conflict analysis: implication graphs, cuts, UIPs; learning schemes; minimization ← code 02
§5 the concrete solver: trail, reasons, analysis, backjumping ← cdcl.py
§6 decisions: VSIDS ← code 03
§7 restarts, heavy tails and phase saving ← code 03
§8 forgetting: clause deletion and LBD; the full ablation ← code 03
§9 trusting UNSAT: DRUP and DRAT proofs; CDCL runs as resolution proofs ← code 04
§10 CDCL against DPLL: adders up to 256 bits, bugs, random 3-SAT, pigeonholes ← code 05
§11 summary §12 common pitfalls §13 exercises §14 further reading §15 next lecture
0.4 Notation
| Symbol | Meaning |
|---|---|
| literals, with abbreviated as (as in the slides); in code output is written ¬3 | |
| , | the assignment, a sequence of literals; marks a decision |
| the decision level of : the number of decisions in up to and including | |
| the prefix of up to and including level (everything before the -th decision) | |
the conflict clause under analysis, or no when there is none | |
| a state of Abstract CDCL; UNSAT is the failure state | |
| occurs before in | |
| (implication graphs) literal assigned at level | |
| reason of | the clause that propagated (its antecedent); decisions have none |
0.5 The code of this lecture
Two modules.
cdcl.py is the SAT engine that every later lecture of the course uses. It contains:
AbstractCDCL: the slides’ proof system on states . It prints derivation tables in the slides’ format and runs under any strategy and three “readings” of the rules (§3.3).CDCLSolver: a complete solver. It has:- two watched literals and first-UIP learning, with the alternatives last UIP, decisions only, and no learning;
- recursive clause minimization and non-chronological backjumping (chronological as an option);
- VSIDS (a static order as an option), Luby or geometric restarts, phase saving, and LBD-based clause deletion;
- DRUP proof logging and, optionally, every learned clause written out as resolution steps;
- machine-independent work counters.
- Teaching tools:
first_conflict,explain_steps,uip_clausesandgraph_textshow the implication graph of a conflict, its UIPs and the clause of every cut.
drup_check.py is an independent proof checker. It shares no code with the solver and does:
- forward and backward checking;
- RUP and RAT checks;
- unsatisfiable cores.
1. Why DPLL is not enough
Lecture 4 ended with a sobering measurement. On the miter of two -bit adders, which asks “is there an input on which the two adders disagree?”, DPLL needed ×3.8 more decisions per extra bit: 119,031 decisions at 9 bits. That is the growth rate of the truth table, rows. On this problem DPLL is a smarter way of enumerating, but it is still enumerating.
The slides list three shortcomings of DPLL:
- No learning. When a branch fails, DPLL throws away all the work that showed why it failed. It then meets conflicts with the same root cause again and again in other branches.
- Chronological backtracking. DPLL undoes only the most recent decision, even when that decision had nothing to do with the conflict. The assignment may have been doomed many levels earlier.
- Naive decisions. The heuristics of Lecture 4 look at clause counts, not at what the search has found out so far.
An analogy. Picture a detective who interviews suspects in a fixed order. Every time an alibi collapses, the detective forgets which facts made it collapse. With the next suspect the same contradiction comes up again, and it is “discovered” again. CDCL is the detective who writes down every contradiction as a short rule (“whoever was at the station at 9 cannot have been at the bank at 9:15”). The rule is checked automatically against every future suspect. When a contradiction turns out to have nothing to do with the last interview, the detective goes straight back to the interview that caused it.
On the adders the cost of forgetting is concrete. A contradiction about the carries of the low bits does not depend on the high bits at all. Yet DPLL, having forgotten it, can meet it again under every combination of the bits decided above it, and so it ends up enumerating.
2. The idea of CDCL in one picture
CDCL keeps DPLL’s loop of decide → propagate. When propagation produces a conflict, it adds a third step before backtracking:
┌──────────────── no conflict, unassigned variables ───────────────┐
▼ │
DECIDE ──► PROPAGATE ──► conflict? ──yes──► ANALYZE: resolve the conflict back │
(VSIDS) (watched lits) │ to a learned clause D (first UIP) │
│ LEARN D, BACKJUMP to the level │
│ where D is unit ─────────────────────►┤
│ (conflict at level 0: UNSAT) │
no, all assigned: SAT │
occasionally: RESTART (keep D's), FORGET (delete useless D's) ─────────────────────┘
The heart of the method is the learned clause. When the clause is false under , we follow the propagations that made its literals false backwards. Each step replaces a literal by the reasons that forced it, and that replacement is one resolution step (Lecture 2). We stop at a clause that has exactly one literal from the current decision level. Three properties follow:
- sound: is derived by resolution from , so . Adding it changes no model.
- general: mentions only the literals that caused the conflict, not the whole assignment. It blocks every future assignment that contains those literals, however the search gets there.
- asserting: after undoing every level above the second-highest level in , all literals of but one are still false. is then unit and propagates the one remaining literal, exactly the literal that must flip. Undoing several levels at once is backjumping.
So CDCL is, at the same time:
- a search procedure, DPLL;
- a deduction procedure, resolution, producing exactly the lemmas the search needs;
- in Lecture 2’s terms, a strategy for building a resolution refutation that the search itself guides.
3. Abstract CDCL
3.1 States and rules
To model learning and backjumping, the slides add a third component to the states of Abstract DPLL:
- States are UNSAT, or , where is
noor a clause, the conflict clause. - Initial state: .
- Expected final states: UNSAT if is unsatisfiable, otherwise with equisatisfiable to (in fact equivalent) and .
PROPAGATE, PURE and DECIDE are unchanged from Lecture 4. BACKTRACK is replaced by three rules, and FAIL is modified:
| rule | premises | conclusion |
|---|---|---|
| CONFLICT | , , | |
| EXPLAIN | , , , | |
| BACKJUMP | , | , , |
| FAIL | , no decision in | UNSAT |
Read them like this:
- CONFLICT notices that a clause is false and starts an analysis with it.
- EXPLAIN picks a literal of , whose complement is true in . It looks for a clause that could have propagated : all of that clause’s other literals were false before . It then replaces by those other literals. This is resolution of with that clause on .
- BACKJUMP needs a clause with exactly one literal at the highest level of . It cuts back to some level between the second-highest level of and . At level , is unit, so is appended, as a deduction and not as a decision. is learned.
- FAIL: a conflict clause and no decision left means that nothing can be undone.
The slides also add the rules of the full CDCL system:
| rule | premises | conclusion | purpose |
|---|---|---|---|
| LEARN | , | add any entailed clause (e.g., preprocessing) | |
| FORGET | , , | delete a redundant clause: memory (§8) | |
| RESTART | — | , | abandon the current search, keep the learned clauses (§7) |
FORGET may delete only clauses that the rest still entails. Learned clauses always qualify, since they were derived from the input. A RESTART keeps level 0 and every learned clause, so it is not a restart “from scratch”.
3.2 The slides’ derivation
. With the slides’ strategy (propagate first, decide the smallest variable true, and EXPLAIN the literal assigned last), script 01 prints:
M Δ C rule
ε Δ no (initial state)
1 Δ no PROPAGATE (by C1)
1 2 Δ no PROPAGATE (by C2)
1 2 •3 Δ no DECIDE
1 2 •3 4 Δ no PROPAGATE (by C3)
1 2 •3 4 •5 Δ no DECIDE
1 2 •3 4 •5 ¬6 Δ no PROPAGATE (by C4)
1 2 •3 4 •5 ¬6 7 Δ no PROPAGATE (by C5)
1 2 •3 4 •5 ¬6 7 Δ {¬2, ¬5, 6, ¬7} CONFLICT
1 2 •3 4 •5 ¬6 7 Δ {¬1, ¬2, ¬5, 6} EXPLAIN with C5
1 2 •3 4 •5 ¬6 7 Δ {¬1, ¬2, ¬5} EXPLAIN with C4
1 2 ¬5 Δ, {¬1, ¬2, ¬5} no BACKJUMP to level 0
1 2 ¬5 •3 Δ, {¬1, ¬2, ¬5} no DECIDE
1 2 ¬5 •3 4 Δ, {¬1, ¬2, ¬5} no PROPAGATE (by C3)
1 2 ¬5 •3 4 •6 Δ, {¬1, ¬2, ¬5} no DECIDE
1 2 ¬5 •3 4 •6 •7 Δ, {¬1, ¬2, ¬5} no DECIDE
no rule applies, C = no: M is a model -> SAT
These rows reproduce the slides’ table. The slides write “SAT!” after , since every clause is satisfied at that point. The rules as written still DECIDE the unassigned variables 6 and 7, which explains the last two rows.
Script 01 runs Lecture 4’s Abstract DPLL on the same set and the same decisions. It meets the same conflict at and BACKTRACKs to . The decision 3 stays, although it had nothing to do with the conflict, and nothing is remembered.
CDCL instead asks why the conflict happened:
- EXPLAIN with resolves with on 7.
- EXPLAIN with resolves the result with on 6.
- The result is : “with 1 and 2, 5 is impossible”.
Its literals sit at levels 0, 0 and 2. BACKJUMP can choose , and the strategy takes the lowest, . This skips the irrelevant decision 3.
3.3 Correctness, and a precondition the slides leave implicit
The slides state four results for Basic CDCL = {PROPAGATE, PURE, DECIDE, CONFLICT, EXPLAIN, BACKJUMP, FAIL}. Here an execution is a derivation from , and an exhausted execution is one that ends in a state where no rule applies.
- Strong termination: every execution is finite.
- Lemma 2: every exhausted execution ends with or UNSAT.
- Refutation soundness: if an exhausted execution ends with UNSAT, then is unsatisfiable.
- Solution soundness: if it ends with , then .
The invariants. Every rule preserves:
- . BACKJUMP adds , and is entailed (next item).
- When : and every literal of is false in .
- CONFLICT copies a clause of that is false in .
- EXPLAIN replaces by a resolvent of and a clause of , and resolution is sound (Lecture 2). The new literals are false in by the premise.
- Every non-decision literal of is entailed by together with the decisions before it. This is Lecture 4’s invariant; BACKJUMP’s is entailed because is unit at level .
Termination has two parts.
- Steps that change (PROPAGATE, PURE, DECIDE, BACKJUMP) increase the tuple of level sizes lexicographically. BACKJUMP to level adds a literal at level and empties the levels above, exactly like BACKTRACK in Lecture 4. There are finitely many such tuples.
- EXPLAIN replaces one literal of by literals assigned strictly earlier in . So the multiset of -positions of ‘s literals decreases in the multiset order, which is well-founded (Dershowitz–Manna).
Between two BACKJUMPs there is at most one CONFLICT.
Soundness. When FAIL fires, is false in , which contains no decisions. By invariant 3, every literal of is entailed by . And while those literals falsify . So is unsatisfiable. When no rule applies and :
- no clause is false, otherwise CONFLICT would apply;
- every variable is assigned, otherwise DECIDE would apply.
So is a model.
Checked by machine. Script 01 runs 1,500 random clause sets (2–6 variables). Each run uses a random strategy, choosing a uniformly random applicable rule instance at every step, and checks every invariant at every step. It does this under three readings of the rules:
| check | propagate first | conflict first | rules as written |
|---|---|---|---|
| final state correct (SAT with a model / UNSAT iff unsatisfiable) | 1,500 / 1,500 | 1,219 / 1,500 | 959 / 1,500 |
| derivations ending STUCK ( no, no rule applies) | 0 | 281 | 541 |
| violations of any invariant, of the measure, or of “CONFLICTs ≤ BACKJUMPs + 1” | 0 | 0 | 0 |
| BACKJUMPs that skip at least one level / all BACKJUMPs | 2 / 36 | 254 / 1,379 | 366 / 1,669 |
The three readings are:
- Propagate first: CONFLICT as soon as a clause is false; DECIDE and PURE only when no PROPAGATE applies.
- Conflict first: conflicts first, but DECIDE may preempt a pending PROPAGATE.
- Rules as written: no priorities at all.
What the table shows.
- The invariants and the measure hold under every reading: no run ever gives a wrong answer. Soundness and termination are robust.
- Lemma 2 fails without propagate-first. The shortest stuck derivation is:
M Δ C rule
ε Δ no (initial state)
•¬2 Δ no DECIDE
•¬2 Δ {2} CONFLICT
•¬2 Δ {} EXPLAIN with C2
no rule applies, but C ≠ no: a stuck state
on .
Why it gets stuck. EXPLAIN only requires a clause that would have propagated . It does not check that was propagated. A strategy that decides although the unit clause would have propagated it lets EXPLAIN “explain” a decision. Every literal of can then disappear, leaving . At that point:
- proves UNSAT;
- but FAIL requires “no decision in ”, and still holds the decision ;
- and BACKJUMP needs a literal in .
The same happens when a strategy postpones a conflict whose literals are all at level 0.
Repairs. Either of two fixes restores Lemma 2:
- The strategy repair, which is what solvers do: propagate exhaustively before every decision and detect conflicts at once. Then no decision is ever explainable. A clause that could explain would have been unit before was decided, so PROPAGATE would have applied. EXPLAIN therefore never removes the last literal of the conflict level, and BACKJUMP always becomes applicable.
- The rule repair: let FAIL also fire when . This is sound, because .
The slides’ own strategy (“apply PROPAGATE to completion”, conflicts first) is the propagate-first reading, so its runs are not affected. But the four results above are stated for every exhausted execution of Basic CDCL, and that is too strong as written.
A slip on slide 25. The slide says to backjump “to the second lowest decision level among ‘s literals”. The BACKJUMP premise allows any with (all other levels) (the highest level). The lowest allowed level is the second highest level of . The two phrases agree only when has at most three distinct levels, as in the example (levels 0 and 2).
For example, take a clause with levels 1, 2, 3, 5. It must jump to level 3 or 4. Jumping to level 2 would unassign the level-3 literal, and the clause would no longer be unit.
4. Conflict analysis
4.1 The implication graph
The slides represent the propagations as a graph:
- Nodes: one per literal of , labelled with its level ().
- Edges: from each literal of a reason clause to the literal that clause propagated, labelled with the clause. Decisions have no incoming edges.
- Conflict graph: also contains a node , with edges from the literals of the falsified clause.
For the slides’ conflict, first_conflict and graph_text print it in trail order:
1@0 <- unit clause
2@0 <- reason {¬1, 2}
•3@1 <- decision
4@1 <- reason {¬3, 4}
•5@2 <- decision
¬6@2 <- reason {¬5, ¬6}
7@2 <- reason {¬1, ¬5, 7}
⊥@2 <- falsified clause {¬2, ¬5, 6, ¬7}
Cuts give conflict clauses. Cut the graph into a reason side, which contains all decisions and level-0 literals, and a conflict side, which contains . The reason-side nodes with an edge across the cut cannot all be true. Negating them gives a clause, and the clause is entailed: from those literals, propagation reaches .
There are many cuts, so many possible learned clauses. Which one should we learn?
4.2 Unique implication points
A UIP of the conflict level is a node other than that lies on every path from the current decision to . The decision itself is always a UIP; it is the last UIP. The first UIP is the one closest to .
There is a simple way to compute every UIP. Run EXPLAIN on the literal assigned last, again and again. Whenever the clause has exactly one literal of the conflict level, that literal’s node is a UIP, and the clause is the one of the cut just behind it. Script 02 prints these steps:
step conflict clause C one literal at the conflict level? next
0 {¬2, ¬5, 6, ¬7} - EXPLAIN ¬7 with {¬1, ¬5, 7}
1 {¬1, ¬2, ¬5, 6} - EXPLAIN 6 with {¬5, ¬6}
2 {¬1, ¬2, ¬5} UIP 5 (the decision: stop)
In the slides’ example the decision 5 is the only UIP, as the slides note.
A real solver also drops literals that are false at level 0: they can never become true. In the clause , both 1 and 2 are forced at level 0, so two more resolution steps (with , then ) remove them. Script 02’s concrete solver accordingly learns the unit clause .
A conflict with two UIPs. Script 02 builds a second example:
It decides 1 and then 3:
•1@1 <- decision
2@1 <- reason {¬1, 2}
•3@2 <- decision
4@2 <- reason {¬3, 4}
5@2 <- reason {¬2, ¬4, 5}
6@2 <- reason {¬4, 6}
7@2 <- reason {¬5, ¬6, 7}
⊥@2 <- falsified clause {¬5, ¬6, ¬7}
step conflict clause C one literal at the conflict level? next
0 {¬5, ¬6, ¬7} - EXPLAIN ¬7 with {¬5, ¬6, 7}
1 {¬5, ¬6} - EXPLAIN ¬6 with {¬4, 6}
2 {¬4, ¬5} - EXPLAIN ¬5 with {¬2, ¬4, 5}
3 {¬2, ¬4} UIP 4 EXPLAIN ¬4 with {¬3, 4}
4 {¬2, ¬3} UIP 3 (the decision: stop)
Three learning schemes take different clauses from this conflict:
| scheme | stops when | learns | meaning |
|---|---|---|---|
| first UIP | one literal of the conflict level is left | “4 and 2 never together” | |
| last UIP | that literal is the decision | “3 and 2 never together” | |
| decisions only | only decisions are left (also resolve lower levels) | “not both decisions” |
The first-UIP clause blames the real culprit: 4, together with 2, causes the conflict, however 4 became true. The clause is a second way to make 4 true; the first-UIP clause covers it, and the other two do not.
The runs show the difference. With each scheme, the solver (decide true first, no restarts) does:
first UIP 2 conflicts: •1 •3 ⊥ learn {¬2, ¬4} → level 1 •5 •6 ⊥ learn {¬5, ¬6} → level 2 •7
last UIP 3 conflicts: •1 •3 ⊥ learn {¬2, ¬3} → level 1 •4 ⊥ learn {¬2, ¬4} → level 1 •5 •6 ⊥ ...
decisions only 3 conflicts: •1 •3 ⊥ learn {¬1, ¬3} → level 1 •4 ⊥ learn {¬1, ¬4} → level 1 •5 •6 ⊥ ...
After a last-UIP or decision clause, the solver simply decides 4 next and meets the same conflict again.
Asserting clauses. All three clauses are asserting: they contain exactly one literal of the conflict level. So after the jump to the second-highest level they are unit and propagate at once. That is what makes BACKJUMP’s "" a propagation rather than a guess.
First UIP among the asserting clauses. It is the asserting clause found with the fewest resolution steps. It is also the one that jumps back the farthest: its lower-level literals are a subset of those of later UIP clauses, which only add literals. Zhang, Madigan, Moskewicz and Malik (2001) compared many schemes on industrial benchmarks and found first UIP the most robust; every modern solver uses it.
4.3 Learning schemes, measured
On the adder miters (script 02, conflicts):
| scheme | 4 bits | 5 | 6 | 7 | 8 | 9 | 10 bits |
|---|---|---|---|---|---|---|---|
| first UIP | 38 | 62 | 96 | 124 | 130 | 137 | 162 |
| last UIP | 52 | 96 | 138 | 145 | 184 | 225 | 242 |
| decisions only | 256 | 1,024 | 4,096 | 10,560 | 11,154 | 15,682 | 18,271 |
| no learning (backjumping only) | 127 | 251 | 657 | 1,443 | 3,326 | 6,647 | 11,701 |
| (truth-table rows) | 256 | 1,024 | 4,096 | 16,384 | 65,536 | 262,144 | 1,048,576 |
Three lessons:
-
First-UIP learning makes the miters easy. It needs 162 conflicts at 10 bits, growing by ×1.0 to ×1.6 per bit. (§10 continues to 256 bits.)
-
Decision clauses reproduce the truth table. Up to 6 bits they need exactly conflicts. Script 02 looks inside the runs, with no restarts and no deletion:
bits conflicts decisions on input bits / all decisions learned clauses of length 1, 2, 3, 4, 5 5 1,024 1,023 / 1,023 10, 45, 120, 210, 252 6 4,096 4,095 / 4,095 12, 66, 220, 495, 792 7 11,291 9,783 / 11,577 5, 37, 173, 496, 1,055 8 14,446 11,802 / 15,433 14, 62, 188, 369, 651 Up to 6 bits every decision is an input bit. The number of learned clauses of length is , giving one clause per node of the complete binary tree over the inputs. It is Lecture 1’s truth table, one row per conflict.
From 7 bits on, VSIDS also decides internal gate variables (15–25% of the decisions). A clause over gate variables blocks many input combinations at once, so the count falls below .
-
Backjumping without learning forgets each clause once it stops justifying a literal. It about doubles per bit (×1.8 to ×2.6): better than DPLL’s ×3.8, because irrelevant decisions are skipped, but still exponential.
Why only first UIP is cheap here. It learns facts about internal signals (“these two carry signals cannot differ”), and such a fact holds in every branch.
On other families (script 02, conflicts, budget 5,000):
| scheme | pigeonhole 6 | Sudoku (hard) | 30-queens | 32-bit miter, bug at bit 20 | random 3-SAT n=100 (median of 5) |
|---|---|---|---|---|---|
| first UIP | 713 | 61 | 148 | 197 | 486 |
| last UIP | 878 | 93 | 200 | 501 | 335 |
| decisions only | 1,109 | 152 | > 5,000 | > 5,000 | 704 |
| no learning | 1,526 | 118 | > 5,000 | > 5,000 | 668 |
- First UIP wins on all four structured families.
- On random 3-SAT, last UIP needed fewer conflicts, though five instances are a small sample.
- Decision clauses are not always longer: their mean length is 6.5 vs 10.6 on the pigeonhole and 5.3 vs 6.4 on the Sudoku. But they need more conflicts.
- Their LBD equals their length. The LBD (literal block distance) is the number of distinct levels in a clause, and a decision clause has one decision per level. A first-UIP clause can hold several literals of one level: on the Sudoku its mean LBD is 3.1 for a mean length of 6.4.
- On the buggy adder, first UIP jumps back 13 levels per conflict on average. Its clauses mention a few gates, so the jump goes far back.
4.4 Clause minimization
A literal of the learned clause can be dropped if the reason of consists only of three kinds of literal:
- literals already in the clause;
- level-0 literals;
- literals that are themselves droppable, checked recursively.
In that case is implied by the rest of the clause, and the shorter clause follows by more resolution steps (Sörensson and Biere 2009). Script 02 measures:
| instance | conflicts off → on | mean length off → on | literals removed |
|---|---|---|---|
| 32-bit adder miter | 568 → 602 | 4.3 → 3.8 | 7% |
| 64-bit adder miter | 1,703 → 1,614 | 5.4 → 4.8 | 9% |
| pigeonhole, 7 holes | 4,145 → 5,827 | 18.9 → 15.9 | 19% |
| Sudoku (hard) | 61 → 61 | 6.9 → 6.4 | 8% |
| 40-queens | 240 → 265 | 232.9 → 234.8 | 0% |
| random 3-SAT n=125 (median of 15) | 707 → 708 | 10.0 → 8.2 | 22% |
- Minimization shortens clauses by up to 22%.
- Its effect on the number of conflicts is small and goes both ways. On random 3-SAT it won on 8 of 15 instances, with equal medians.
- A shorter clause costs less to store and propagates earlier, but each change also redirects the later search. On small instances that noise dominates.
5. The concrete solver
CDCLSolver follows MiniSat (Eén and Sörensson 2003). It keeps three per-variable records:
- trail: the literals in assignment order, with
trail_limmarking where each level starts; - level: the level of each variable;
- reason: the clause that propagated it, or none for a decision.
Unit propagation uses Lecture 4’s two watched literals, with one convention: when a clause becomes the reason of a literal, that literal is in position 0.
Conflict analysis (first UIP; _analyze_uip). It is EXPLAIN on a trail, without building any intermediate clause:
seen := ∅; learnt := [ _ ]; count := 0; c := conflicting clause; p := none
loop:
for each literal q of c (skipping p itself if c is p's reason):
if var(q) not seen and level(q) > 0:
mark seen, bump VSIDS activity of var(q)
if level(q) = current level: count += 1 # to be resolved away
else: learnt.append(q) # lower level: goes into the clause
p := the most recent trail literal that is marked seen; unmark it; count -= 1
if count = 0: break # p is the first UIP
c := reason(p) # one resolution step
learnt[0] := ¬p
The rest of the conflict step:
- Backjump level: the highest level among
learnt[1:]. That literal goes to position 1, so the two watched literals are the asserting literal and the last literal to be unassigned. - Undo:
cancel_until(level)unassigns the levels above. Unassigned variables keep their last value for phase saving and go back into the VSIDS heap. - Assert: add the learned clause and enqueue
learnt[0]with the new clause as its reason.
The main loop:
propagate
if conflict: if level = 0: UNSAT
analyze → learn → backjump → assert; maybe RESTART; maybe FORGET
else: pick the unassigned variable with the highest activity, with its saved phase
if none: SAT (the model is checked against the input before it is returned)
Correctness against truth tables. Script 01, Part 4, runs 2,000 random clause sets (1–10 variables; 916 satisfiable) through 11 configurations: every learning scheme, minimization off, the static order, extreme restart and deletion schedules, chronological backtracking, and random decisions.
- All 22,000 answers agree with the truth tables.
- All 11 × 1,084 UNSAT answers come with a DRUP proof that
drup_check.pyaccepts. - Each also comes with a resolution proof that Lecture 2’s checker accepts (§9).
6. Decisions: VSIDS
Lecture 4’s heuristics score literals by clause counts of the current formula. Chaff (Moskewicz et al. 2001) replaced them with VSIDS (Variable State Independent Decaying Sum):
- every variable has an activity;
- each variable that takes part in a conflict analysis is bumped (+1);
- periodically all activities are multiplied by a decay factor.
We implement the decay as in MiniSat. Instead of shrinking all activities, the bump increment grows by after every conflict, and everything is rescaled before the numbers overflow. The decision variable is the unassigned one with the highest activity, kept in a heap.
Why it works:
- VSIDS keeps the search on the variables of recent conflicts, the part of the problem the solver is stuck on.
- It costs almost nothing per decision. JW scanned every clause for every decision; VSIDS pops a heap.
- It needs no knowledge of the encoding.
Script 03 compares it with a static order (Jeroslow–Wang scores of the input, never updated). Conflicts, budget 5,000:
| instance | VSIDS | static order |
|---|---|---|
| 32-bit adder miter (UNSAT) | 602 | 1,009 |
| 32-bit miter, bug at bit 20 (SAT) | 197 | 371 |
| pigeonhole, 7 holes (UNSAT) | > 5,000 | 322 |
| Sudoku, hard (SAT) | 61 | 189 |
| 20-queens (SAT) | 111 | > 5,000 |
| random 3-SAT n=125 (median of 3) | 1,805 | 1,473 |
Neither wins everywhere:
- The static order is a gift on the pigeonhole (322 conflicts) and a disaster on the queens (out of budget).
- VSIDS wins on four of the six. Its one bad case is the pigeonhole, where no resolution-based method is fast (§9.5).
VSIDS needs no knowledge of the problem, and that robustness is why it and its successors (e.g., the learning-rate heuristic LRB, Liang et al. 2016) are used everywhere.
7. Restarts, heavy tails and phase saving
Heavy tails. Gomes, Selman and Kautz (1998) observed that the runtime of a randomized backtracking solver on one instance often has a heavy-tailed distribution. Most runs are short, but a few take extremely long, because an early bad decision traps the search in a large subtree without solutions.
The cure is to restart: give up after a while and start again. The randomness of the next run, or here the knowledge gathered so far, makes another long run unlikely.
Script 03 solves 20-queens with 20 seeds. A seed gives tiny random initial activities and 2% random decisions. Budget 5,000 conflicts:
| restart policy | min | median | 90th pct | max | over budget |
|---|---|---|---|---|---|
| Luby () | 103 | 133 | 220 | 244 | 0 |
| geometric () | 103 | 133 | 236 | 416 | 0 |
| no restarts | 164 | 1,680 | 4,824 | > 5,000 | 1 |

Without restarts, the median run needs 13 times more conflicts and the tail reaches the budget. With either policy, every seed finishes within a few hundred conflicts.
Why a CDCL restart is cheap. A restart keeps:
- all learned clauses;
- the VSIDS activities;
- the saved phases.
So a restart is not “start over”. It is “re-decide the top of the tree with what we now know”.
Luby restarts. The Luby sequence is made of copies of itself. Luby, Sinclair and Zuckerman (1993) proved that, for any runtime distribution, this schedule is within a logarithmic factor of the best fixed restart schedule. It is a safe default when nothing is known.
Restarts are not free. On the 7-hole pigeonhole (UNSAT), the deterministic run without restarts needs 2,761 conflicts, and both restart policies need more than 5,000. An unsatisfiability proof in progress gets interrupted. Modern solvers adapt the restart frequency to the observed LBDs (Glucose) or alternate between restart-heavy and restart-free phases.
Phase saving (Pipatsrisawat and Darwiche 2007) decides a variable with the value it had when it was last unassigned. Backjumps and restarts throw away many consistent assignments, and phase saving puts them back as soon as the variables are decided again.
On script 03’s small instances its effect is mixed:
- it wins on the adder miters and the queens;
- “always true” solves the Sudoku with 11 conflicts (61 with phase saving);
- “always false” needs ten times fewer conflicts on the three random instances (three instances is as much luck as signal).
8. Forgetting: clause deletion and LBD
Every conflict adds a clause. Industrial runs have millions of conflicts, and each learned clause costs memory and propagation time. FORGET deletes clauses that the rest entails: any learned clause qualifies.
The question is which clauses to keep. Audemard and Simon (2009, Glucose) observed that clauses with a low LBD (literal block distance, the number of distinct decision levels in the clause) are the valuable ones. A clause with LBD 2, a “glue clause”, links one decision level to one other and propagates often.
Our policy is a simplified Glucose. At 2,000 conflicts, and then every conflicts, it deletes half of the learned clauses with LBD > 2, worst LBD first. It never deletes:
- binary clauses;
- glue clauses;
- clauses that currently justify an assignment.
Script 03, Part 4:
| instance | deletion | conflicts | most clauses kept at once | clause visits per conflict |
|---|---|---|---|---|
| pigeonhole, 7 holes | on | 5,827 | 3,300 | 708 |
| off | 6,064 | 6,059 | 1,197 | |
| 128-bit adder miter | on | 3,485 | 2,784 | 301 |
| off | 3,189 | 3,174 | 324 | |
| random 3-SAT n=200 | on | 13,553 | 5,756 | 532 |
| off | 12,907 | 12,899 | 921 |

- On the long runs, deletion about halves the clauses kept (54% and 45%), giving a saw-tooth curve. The adder run is short, so only one deletion round happens.
- Each conflict then visits fewer clauses: 59% and 58% of the visits on the long runs, 93% on the adder.
- The price is re-learning: deletion cost 9% more conflicts on the adder and 5% on the random instance, and saved 4% on the pigeonhole.
The full ablation. Script 03 switches off one feature at a time (conflicts, budget 5,000):
| configuration | adder miter | buggy miter | pigeonhole 7 | Sudoku | 20-queens | random n=125 |
|---|---|---|---|---|---|---|
| all features (default) | 602 | 197 | > 5,000 | 61 | 111 | 1,805 |
| static order instead of VSIDS | 1,009 | 371 | 322 | 189 | > 5,000 | 1,473 |
| no restarts | 754 | 294 | 2,761 | 61 | > 5,000 | 1,329 |
| no phase saving | 891 | 240 | 4,663 | 43 | 124 | 179 |
| no clause deletion | 602 | 197 | > 5,000 | 61 | 111 | 1,805 |
| no minimization | 568 | 258 | 4,145 | 61 | 111 | 890 |
| chronological backtracking | 2,373 | 822 | 3,547 | 89 | 128 | 1,438 |
| last-UIP learning | 1,181 | 501 | > 5,000 | 93 | 119 | 1,725 |
| decision learning | > 5,000 | > 5,000 | > 5,000 | 152 | > 5,000 | 2,458 |
| no learning (backjumping only) | > 5,000 | > 5,000 | > 5,000 | 118 | > 5,000 | 1,744 |
How to read it:
- First-UIP learning is the feature that matters. Without it, the adder miters and the queens run out of budget.
- Backjumping matters on the circuits. Chronological backtracking needs about four times more conflicts on both miters, although it learns the same clauses.
- Everything else changes the count by small factors, in both directions, and no family shows the whole picture.
- Deletion changes no entry: it first acts at 2,000 conflicts, which only the pigeonhole run reaches, and the budget cuts that run off.
A solver’s defaults are a compromise over many benchmarks. That is why SAT competitions use hundreds of instances, and why one table on six instances, like this one, should be read as anecdotes, not rankings.
9. Trusting UNSAT
9.1 DRUP proofs
A SAT answer certifies itself: the model is checked in a moment, and script 05 decodes and re-evaluates every counterexample. An UNSAT answer has no such witness.
Solvers have bugs. Since 2013 the SAT competitions have required solvers to emit a proof in the DRAT format (Wetzler, Heule and Hunt 2014) for every UNSAT answer, and checkers such as drat-trim verify it. The simplest form, DRUP, just lists the learned clauses (“lemmas”) in order, plus deletions, and ends with the empty clause.
RUP check. A lemma is accepted if assigning all its literals false and running unit propagation on the current clause set reaches a conflict. Then the clause set entails .
For Lecture 4’s UNSAT example , the CDCL proof has two lines, 2 0 and 0. Script 04 checks each:
Lemma {2}: assume it is false, then propagate:
¬2 assumption (negated lemma)
3 unit in {2, 3}
conflict: {2, ¬3} is false -> lemma accepted
Lemma {}: assume it is false, then propagate:
2 unit in {2}
1 unit in {1, ¬2}
conflict: {¬1, ¬2} is false -> lemma accepted
Why every CDCL lemma passes. Conflict analysis derived the lemma by resolving backwards along an implication graph. RUP replays that graph forwards, starting from the negated lemma.
9.2 Checking at scale
Forward checking checks every lemma. Backward checking (the idea of drat-trim) works differently:
- first add all lemmas without checking them;
- then walk back from the empty clause, checking only the lemmas that some later check actually used. “Used” is found by following the reasons of each RUP conflict.
As a by-product, backward checking reports which input clauses were used: an unsatisfiable core.
Script 04, Part 2:
| instance | input clauses | lemmas | backward: lemmas checked | core |
|---|---|---|---|---|
| pigeonhole, 6 holes | 133 | 713 | 700 | 133 (100%) |
| pigeonhole, 7 holes | 204 | 5,827 | 5,635 | 204 (100%) |
| 16-bit adder miter | 572 | 256 | 211 | 479 (84%) |
| 64-bit adder miter | 2,348 | 1,614 | 1,415 | 2,085 (89%) |
| 128-bit adder miter | 4,716 | 3,485 | 2,573 | 4,173 (88%) |
| random 3-SAT n=100, 5 clauses/var | 500 | 302 | 260 | 420 (84%) |
| random 3-SAT n=150, 4.5 clauses/var | 675 | 1,739 | 1,535 | 654 (97%) |
- Every proof checks in both modes. Checking costs about as much as solving, or less.
- Pigeonhole formulas are minimally unsatisfiable: every clause is needed, so the core is 100%.
- On the adder miters, almost every core clause belongs to the Plaisted–Greenbaum encoding of Lecture 2 (477 of the 479 at 16 bits). Of each gate definition, only the direction that the polarity of its occurrence requires is used. The refutation hardly ever needs the other direction.
9.3 Lying and buggy solvers
Script 04, Part 3 tampers with the 5-hole pigeonhole proof:
| proof offered | checker’s verdict |
|---|---|
| the solver’s proof | verified: 153 lemmas, all RUP |
| a non-entailed unit inserted as the 4th lemma | step 4: lemma [1] is not RUP |
| the empty clause removed | the proof never derives the empty clause |
| the 6-hole proof offered for 5 holes | step 1: … is not RUP |
| each lemma removed in turn (152 variants) | 17 of 152 variants still accepted |
A simulated buggy solver silently assumes on the satisfiable miter of a correct and a buggy 16-bit adder. It answers UNSAT, and its proof is rejected at step 1 when checked against the real input. A valid refutation of a satisfiable formula cannot exist.
Removing one lemma usually breaks the proof too, because a later lemma needed it. In 17 of 152 cases unit propagation re-derives what was missing.
9.4 DRAT: lemmas that are not entailed
RAT (resolution asymmetric tautology) is the other check of DRAT. A lemma with first literal is RAT if, for every clause containing , the resolvent is RUP (or a tautology).
A RAT lemma need not be entailed, but adding it preserves satisfiability. That is all a refutation needs. Script 04, Part 4 adds the definition as three lemmas, :
| input | RUP only | RUP + RAT |
|---|---|---|
| (4 is fresh) | step 1 rejected | all three accepted |
| the same plus (4 already constrained) | step 1 rejected | step 1 rejected: not RUP nor RAT |
The definitions are the heart of extended resolution (Tseitin 1966), which has polynomial-size proofs of the pigeonhole formulas (Cook 1976). DRAT lets solvers that introduce new variables (preprocessing, symmetry breaking, cardinality reasoning) still emit checkable proofs.
9.5 CDCL runs are resolution proofs
Every learned clause is the end of a chain of resolution steps (§4). With resolution=True, the solver records each chain. resolution_proof() then writes the run as a refutation in Lecture 2’s format, which Lecture 2’s checker verifies. For Lecture 4’s example:
1. {p1, ¬p2} input
2. {¬p1, ¬p2} input
3. {p2, p3} input
4. {p2, ¬p3} input
5. {p2} resolve 4, 3 on p3
6. {¬p2} resolve 2, 1 on p1
7. {} resolve 6, 5 on p2
A learned clause is used again and again, so the proof is a DAG. The proofs from DPLL runs (Lecture 4, §6) are trees. Script 04 compares them:
| instance | CDCL: DRUP lemmas | CDCL: resolution steps | DPLL (tree-like): resolution steps |
|---|---|---|---|
| adder miter, 2 bits | 10 | 45 | 165 |
| 3 bits | 25 | 128 | 859 |
| 4 bits | 38 | 196 | 3,864 |
| 5 bits | 62 | 428 | 16,383 |
| 6 bits | 96 | 721 | 67,530 |
| pigeonhole, 4 holes | 28 | 284 | 188 |
| pigeonhole, 5 holes | 153 | 1,551 | 970 |

- On the adders, tree-like proofs grow ×4 per bit and DAG proofs stay under a thousand steps. The power of learning is the power of reusing derived clauses.
- On the pigeonhole, the CDCL proof is longer. Writing out one learned clause takes about ten resolution steps, and Haken’s theorem says no resolution proof is short there.
- A DRUP proof stands for 4.5 to 10 times as many resolution steps as it has lines. The checker pays for that brevity by re-deriving each lemma.
A consequence for lower bounds. CDCL runs are resolution proofs, so Haken’s exponential lower bound for the pigeonhole formulas (Lecture 2) applies to every CDCL solver, however clever its heuristics.
Conversely, Pipatsrisawat and Darwiche (2011) showed that CDCL with restarts, given suitable decisions, can polynomially simulate general resolution. As a proof system it is as strong as resolution: no stronger, and in principle no weaker.
10. CDCL against DPLL
The adder miters. Script 05, Part 1:
| bits | variables | clauses | DPLL conflicts | CDCL conflicts | CDCL time (s) |
|---|---|---|---|---|---|
| 2 | 20 | 54 | 8 | 10 | 0.00 |
| 4 | 46 | 128 | 156 | 38 | 0.00 |
| 6 | 72 | 202 | 2,195 | — | — |
| 8 | 98 | 276 | 31,272 | 130 | 0.01 |
| 16 | 202 | 572 | — | 256 | 0.03 |
| 32 | 410 | 1,164 | — | 602 | 0.06 |
| 64 | 826 | 2,348 | — | 1,614 | 0.25 |
| 128 | 1,658 | 4,716 | — | 3,485 | 0.81 |
| 256 | 3,322 | 9,452 | — | 6,341 | 2.84 |

- DPLL grows ×3.7–4.0 per bit, the truth-table rate.
- CDCL proves the 64-bit adders equivalent with fewer conflicts than DPLL needs at 6 bits. From 8 bits on it needs 16–27 conflicts per bit: linear growth.
- The 256-bit miter, with 3,322 variables, takes about 3 seconds of plain Python.
This is the exponential wall of Lecture 1 removed for this family. A clause learned about one bit’s carries holds for every input pattern.
Finding bugs. With a missing carry term in one adder, the miter is satisfiable, and a model is an input on which the adders differ. Script 05 makes the following checks:
- CDCL finds the counterexample at 8, 16, 32, 64 and 128 bits with 44–460 conflicts.
- Each one is decoded and re-evaluated on the original circuits: the correct adder computes and the buggy one does not.
- DPLL finds the 8-bit bug after 1,503 conflicts and is stopped at 20,000 decisions on the 16-bit one.
Random 3-SAT at 4.26 clauses per variable (script 05, medians):
| n | DPLL conflicts | CDCL conflicts |
|---|---|---|
| 50 | 52 | 66 |
| 75 | 127 | 185 |
| 100 | 350 | 286 |
| 125 | 890 | 594 |
| 150 | — | 1,886 |
| 175 | — | 5,861 |
- Up to 75 variables DPLL needs fewer conflicts. A clause learned on a random formula is rarely useful elsewhere, and Jeroslow–Wang is a strong heuristic there.
- From 100 on, CDCL needs fewer, and it is faster throughout, because its decisions do not scan the clauses.
- The gap is a factor, not an exponential. Random 3-SAT near the threshold stays exponentially hard for every complete method.
Pigeonholes (script 05, conflicts):
| holes | DPLL | CDCL |
|---|---|---|
| 5 | 375 | 153 |
| 6 | 3,246 | 713 |
| 7 | 32,781 | 5,827 |
| 8 | — | 30,051 |
Both are exponential, as Haken’s theorem demands (§9.5). Solvers that reason with cardinality constraints or cutting planes have short proofs here; resolution-based CDCL does not.
Puzzles. Lecture 4’s DPLL depended on the luck of its heuristic:
- the fixed order solved the Sudoku and 10-queens at once but not 20-queens;
- Jeroslow–Wang ran out of budget on the Sudoku and 20-queens.
CDCL solves all three with 31–111 conflicts.
11. Summary
- DPLL forgets. CDCL analyses every conflict: EXPLAIN = resolution along the implication graph, until one literal of the conflict level is left, the first UIP.
- The learned clause is entailed (sound), general (it mentions only the causes) and asserting (unit after the jump). BACKJUMP goes to the second-highest level of the clause, skipping irrelevant decisions.
- Abstract CDCL is sound and terminating under any strategy; checked here at every step of 4,500 random derivations. Every run ends in SAT or UNSAT if propagation is exhaustive before decisions. Otherwise EXPLAIN can explain a decision and leave stuck.
- First-UIP learning is the decisive feature: on the adder miters, decision clauses reproduce the truth table exactly ( clauses of length ), backjumping alone doubles per bit, and first UIP grows linearly.
- VSIDS, restarts, phase saving, deletion steer and maintain the search. Each helps on some families and hurts on others; robustness, not uniform wins, justifies the defaults. Restarts tame heavy tails (20-queens: 13× in the median); deletion halves memory.
- UNSAT answers are certified by DRUP/DRAT proofs and checked independently. Backward checking yields unsatisfiable cores. RAT admits definitions of new variables.
- CDCL runs are DAG-like resolution proofs: exponentially smaller than DPLL’s trees on the adders, and as weak as resolution on the pigeonholes.
- On structured problems (circuits) CDCL is dramatically better than DPLL: 64 bits with fewer conflicts than DPLL’s 6. On random 3-SAT it is a constant factor better. On pigeonholes both are exponential.
12. Common pitfalls
- “The learned clause is the conflict clause.” The conflict clause is an input clause that happens to be false. The learned clause is derived from it by EXPLAIN steps and is usually new.
- “Backjump to the level of the UIP.” The UIP is at the conflict level, which is exactly the level being undone. The jump goes to the second-highest level of the learned clause, where it becomes unit. (Slide 25’s “second lowest” is a slip.)
- “First UIP = the decision.” Often it is not (§4.2): it is the dominator closest to the conflict.
- “A restart throws everything away.” It keeps the learned clauses, the activities, the phases and level 0.
- “CDCL learns arbitrary entailed clauses.” That is the LEARN rule of the abstract system. Real solvers learn the clause their analysis produces; LEARN covers preprocessing.
- “Deleting learned clauses is unsound.” It is not. FORGET requires the remaining clauses to entail the deleted one, and learned clauses are entailed by the input.
- “UNSAT proofs list the resolution steps.” DRUP lists only the lemmas, and the checker re-derives them. A RUP check is a unit propagation, not a lookup.
- “A checker can reuse the solver’s code.” Then it inherits the solver’s bugs. Our
drup_check.pyshares no code withcdcl.py. - “CDCL beats DPLL everywhere.” Not on small random instances in conflicts (§10), and not on pigeonholes, where both are exponential.
- “One benchmark settles a heuristic.” §6–§8: almost every feature both helps and hurts on six instances.
13. Exercises
Answers are collapsed; try each exercise first.
1. (Abstract CDCL) Run Abstract CDCL with the slides’ strategy on Lecture 4’s set , deciding the smallest variable true first. Write the table.
Answer
No PROPAGATE applies at first, so DECIDE . Then is propagated by and 3 by . Now is false: CONFLICT .
EXPLAIN 3 with gives . One literal at level 1, so BACKJUMP to level 0: , and is learned.
PROPAGATE 1 by . Then is false: CONFLICT. There is no decision in : FAIL, UNSAT.
The DRUP proof is 2 0 and 0, as in §9.1.
2. (implication graph) For the two-UIP example of §4.2, draw the implication graph. Show that 4 is a UIP and 5 is not.
Answer
Edges:
- ;
- ;
- ;
- ;
- ;
- .
Every path from 3 to starts , so 4 is on all of them and is a UIP. The path avoids 5, so 5 is not a UIP.
3. (soundness of learning) Prove that every clause produced by CONFLICT followed by EXPLAIN steps is entailed by .
Answer
By induction on the number of EXPLAIN steps. CONFLICT sets to a clause of . EXPLAIN replaces by the resolvent of and on . Resolution is sound (Lecture 2): any model of both premises satisfies the resolvent. Both premises are entailed by , so the resolvent is too.
4. (asserting) Let be a first-UIP clause with highest level (only the UIP literal) and second-highest level . Show that after BACKJUMP to level , is unit. Why would jumping to be wrong?
Answer
At level . All other literals of are at levels . They are still false in . The UIP literal’s level is undone, so it is unassigned. So is unit.
At level . At least one other literal, the one at level , becomes unassigned. then has two unassigned literals and propagates nothing. BACKJUMP’s premise forbids this.
5. (termination) In the derivation of §3.2, list the multiset of -positions (counting from 0) of ‘s literals after CONFLICT and after each EXPLAIN, and check that it decreases.
Answer
has positions 0–6.
| step | complements in | positions | |
|---|---|---|---|
| CONFLICT | 2, 5, , 7 | ||
| EXPLAIN with | |||
| EXPLAIN with |
Sorted descending, : each step decreases.
6. (Lemma 2) Show that under the propagate-first reading, can only arise when has no decisions. (Hint: show that EXPLAIN never removes the last literal of the conflict level above level 0.)
Answer
The invariant. Under propagate-first, for every level below the current level, the prefix is closed under unit propagation and falsifies no clause of the current .
- DECIDE happens only after closure.
- BACKJUMP to level keeps the closed prefixes below . The new clause is not unit below level : its literal at level is still unassigned there, together with the asserting literal.
The conflict clause starts with a level- literal. Let the conflict be at level . The falsified clause is detected at once. By the invariant it was not false at the end of level , so one of its literals was falsified at level .
EXPLAIN never removes the last level- literal. Suppose EXPLAIN removes a literal with at level , using , where the come before .
- If all were at levels , then was unit at the end of level , with unassigned. That contradicts the invariant.
- So some is false at level , and the resolvent keeps a level- literal.
- This also shows that the decision of level is never explained: every literal before it is at a lower level.
Conclusion. always has at least one level- literal.
- While it has two or more, one of them is implied, and its actual reason clause satisfies EXPLAIN’s premise.
- When it has exactly one, BACKJUMP applies.
So arises only from conflicts at level 0, where has no decisions and FAIL applies.
7. (Luby) Compute the first 15 terms of the Luby sequence, and the conflict counts at which a Luby restart policy with unit 100 restarts during the first 1,000 conflicts.
Answer
The sequence starts . Times 100, the intervals are 100, 100, 200, 100, 100, 200, 400, …
The restarts fall at cumulative conflicts 100, 200, 400, 500, 600, 800. The next one would be at 1,200.
8. (LBD) A learned clause has literals at levels . What are its length and its LBD? Why is a low LBD a good sign?
Answer
Its length is 6 and its LBD is 3 (levels 7, 3, 1).
The literals of one level tend to be propagated together. A clause with LBD 2 needs only one other “block” of literals to be set to become unit, so it propagates often and connects two parts of the search. Glucose keeps such clauses forever.
9. (RUP by hand) Check that is RUP for the 2-hole pigeonhole formula with 3 pigeons. The formula has pigeon clauses and hole clauses .
Answer
Assume . The hole-1 clauses and propagate and . The pigeon clauses then propagate and . Now is false: a conflict, so the lemma is accepted.
10. (RAT) Is the lemma RUP or RAT (on ) with respect to (a) and (b) ?
Answer
(a) .
- Not RUP. Assume and . Both clauses are satisfied, so there is no conflict.
- RAT. The only clause containing is . The resolvent is , a tautology. So the lemma is accepted, although does not entail it (take true, true).
(b) .
- Not RUP, as in (a).
- Not RAT. The resolvent with is . Assume and : is satisfied and propagates . No conflict, so the resolvent is not RUP.
- Yet adding the lemma keeps satisfiable ( false, false, true). RAT is a sufficient check, not a necessary one.
11. (decision scheme) Explain why, when every decision is an input bit, the decision scheme on an -bit adder miter learns exactly clauses of length .
Answer
Every leaf is a conflict. The miter is unsatisfiable and its outputs depend on all inputs. So a conflict appears exactly when all inputs are assigned, at a leaf of the binary tree over the inputs.
What gets learned at a leaf. The decision scheme resolves away every implied literal. So the learned clause consists of the negations of the decisions on the path to that leaf. An input that was flipped earlier is not a decision any more: it was implied by an earlier learned clause, and it is resolved away too.
So the clause at a leaf has one literal for each input that still carries its first-tried value.
The search visits every leaf once. After each conflict the clause is unit one level up, so the last decision flips. The run is a depth-first traversal of the complete tree with leaves, one conflict per leaf.
Counting.
- The leaves where exactly of the inputs carry their first-tried value number .
- The leaf with (every input flipped) is the final conflict at level 0, which gives UNSAT and is not learned.
- So there are learned clauses of length for . For that is 10, 45, 120, 210, 252, …, as script 02 prints.
- In total there are learned clauses and conflicts.
12. (programming) Add Glucose-style dynamic restarts to CDCLSolver. Restart when the average LBD of the last 50 learned clauses exceeds 1.25 times the average over the whole run. Compare it with Luby on script 03’s six families, and on the 20-queens seeds.
Answer sketch
- Keep a deque of the last 50 LBDs and a running sum of all LBDs.
- After each conflict, if the deque is full and
mean(deque) * 0.8 > total_mean, restart and clear the deque. - Expect fewer restarts on UNSAT instances: the idea of Audemard and Simon (2012) is to restart only when the recent clauses are worse than usual.
- Report conflicts as in §8. With six instances, report the numbers, not a verdict.
14. Further reading
- J. Marques-Silva, I. Lynce, S. Malik, “Conflict-Driven Clause Learning SAT Solvers”, Chapter 4 of the Handbook of Satisfiability (2nd ed., 2021). The standard reference for everything in §4–§8.
- J. Marques-Silva, K. Sakallah, “GRASP: A Search Algorithm for Propositional Satisfiability”, IEEE Trans. Computers 1999 (conference version 1996). Learning and non-chronological backtracking.
- M. Moskewicz, C. Madigan, Y. Zhao, L. Zhang, S. Malik, “Chaff: Engineering an Efficient SAT Solver”, DAC 2001. Watched literals and VSIDS.
- L. Zhang, C. Madigan, M. Moskewicz, S. Malik, “Efficient Conflict Driven Learning in a Boolean Satisfiability Solver”, ICCAD 2001. Learning schemes compared; first UIP.
- N. Eén, N. Sörensson, “An Extensible SAT-solver” (MiniSat), SAT 2003. The architecture our solver follows.
- R. Nieuwenhuis, A. Oliveras, C. Tinelli, “Solving SAT and SAT Modulo Theories: From an Abstract Davis–Putnam–Logemann–Loveland Procedure to DPLL(T)”, JACM 2006. The abstract transition-system view.
- C. Gomes, B. Selman, H. Kautz, “Boosting Combinatorial Search Through Randomization”, AAAI 1998. Heavy tails and restarts.
- G. Audemard, L. Simon, “Predicting Learnt Clauses Quality in Modern SAT Solvers”, IJCAI 2009. LBD and Glucose.
- K. Pipatsrisawat, A. Darwiche, “A Lightweight Component Caching Scheme for Satisfiability Solvers”, SAT 2007 (phase saving); and “On the Power of Clause-Learning SAT Solvers as Resolution Engines”, Artificial Intelligence 2011.
- N. Wetzler, M. Heule, W. Hunt, “DRAT-trim: Efficient Checking and Trimming Using Expressive Clausal Proofs”, SAT 2014.
- A. Nadel, V. Ryvchin, “Chronological Backtracking”, SAT 2018. When backjumping is not better (cited by the slides).
15. Next lecture
Lecture 6, First-order logic: syntax. Propositional logic cannot say “every adder of any width is correct” or “for all , ”. First-order logic adds:
- objects, through terms built from constants and functions;
- relations between them, through predicates;
- quantifiers over them.
We build fol.py: signatures, terms, formulas, free and bound variables, and the subtle operation every prover depends on, capture-avoiding substitution.
The SAT solver of this lecture comes back in Lecture 9 (model checking), in Lecture 10, where it becomes the engine of an SMT solver, and in every application lecture after that.