Module contents
Lesson 19 of 22Advanced 115 min

Resolution and DPLL: proving unsatisfiability

How to prove a formula has no solution: the resolution rule, its soundness and refutational completeness, and DPLL, whose failed runs are tree-like resolution refutations. The lesson studies limitations (Haken's exponential pigeonhole bound) and the random 3-SAT phase transition, preparing for CDCL in m10.

After this lesson you can

  • Construct resolution refutations and prove their soundness.
  • Prove refutational completeness of resolution by induction on the number of variables.
  • Implement DPLL with unit propagation, pure literals, and branching heuristics, and prove correctness and termination.
  • Extract an independently verifiable resolution certificate from an unsatisfiable run.
  • Explain Haken's lower bound and the random 3-SAT phase transition using the first-moment method.

Before you start

Motivation: “no” needs a proof

In the previous lesson you convert a problem to a CNF formula and give it to a SAT solver. If it says “satisfiable,” it gives an assignment you can check in linear time: no trust is needed. But many important questions are answered “no”:

  • Circuit equivalence. The miter of an optimized multiplier and the original (the circuit comparing outputs and activating if any differ) is unsatisfiable exactly when both compute the same thing. Here “no” is good news, and must be justified.
  • Software and protocol verification. A property holds through depth kk if the BMC formula seeking a counterexample has no model.
  • Mathematics. The Boolean Pythagorean triples problem was settled in 2016 with an unsatisfiable formula and a 200 TB proof.
  • Logical consequence. By the definition of consequence, F⊨GF \models G if and only if F∧¬GF \land \lnot G is unsatisfiable. Every deductive argument is, at heart, a refutation.

When a solver says “unsatisfiable” it cannot show something checked by one evaluation: it claims none of the 2n2^n assignments works. To avoid having to trust it, a proof system is needed: simple, mechanically checkable rules allowing “no” to be written as a chain of verifiable steps. This lesson studies the system used by modern solvers, resolution, and the classical algorithm exploiting it, DPLL. The questions are those for any proof system (the soundness and completeness of natural deduction): does it prove only true things? Does it prove all of them? How long is the shortest proof? The last has an uncomfortable answer: simple formulas such as the pigeonhole principle necessarily have exponential resolution refutations.

The resolution rule

Recall that a clause is a disjunction of literals and a CNF formula is a conjunction of clauses. From here write a clause as the set of its literals and a CNF as the set of its clauses: order and repetition do not change meaning. The clause with no literals, □\square, is the empty disjunction, false under every assignment (it has no literal that could make it true). A clause set containing □\square is therefore unsatisfiable, while the empty clause set is trivially satisfiable.

The rule condenses reasoning by cases. If xx is true, the second premise forces DD; if false, the first forces CC. Whatever xx is, one holds. Familiar special cases: from xx and ¬x∨y\lnot x \lor y obtain yy (modus ponens), from ¬a∨b\lnot a \lor b and ¬b∨c\lnot b \lor c obtain ¬a∨c\lnot a \lor c (transitivity of implication, computed by the 2-SAT graph), and from unit clauses xx and ¬x\lnot x obtain □\square.

The first claim is the case argument above, which you will work through carefully in the first exercise. The second follows by induction on derivation length: if ν\nu satisfied FF, it would satisfy every CiC_i, in particular □\square, which has no models. Two observations before continuing:

  • The resolvent is weaker than the premises. From C∨DC \lor D one cannot recover C∨xC \lor x and D∨¬xD \lor \lnot x: adding the resolvent to FF does not change models, but removing premises can add models. Resolution always moves toward consequences.
  • One pivot only. If C∨xC \lor x and D∨¬xD \lor \lnot x have another complementary pair, y∈Cy \in C and ¬y∈D\lnot y \in D, the resolvent contains y∨¬yy \lor \lnot y: a tautology, always true and useless. Resolving “on both variables at once” to obtain □\square from x∨yx \lor y and ¬x∨¬y\lnot x \lor \lnot y would be incorrect: those clauses are satisfied with x=1x = 1, y=0y = 0.
InteractiveDeriving the empty clause
x₁ ∨ x₂x₁ ∨ ¬x₂¬x₁ ∨ x₃¬x₁ ∨ ¬x₃
  • initial clause
  • manual resolvent
  • Davis-Putnam resolvent
  • refutation
Davis-Putnam: eliminate variables
Clauses: initial / derived / retired4 / 0 / 0
Eliminated variablesnone
Each tile is a clause. Drag one onto another, or click two consecutively, to resolve them: if they have exactly one complementary pair, the resolvent appears below linked to its premises. Reach □\square in ‘Four clauses’ (Cuatro cláusulas) with three resolutions, then try the cycle and pigeonhole by hand. Also try resolving two clauses with two complementary pairs. Then use the Davis–Putnam panel: ‘Eliminate’ (Eliminar) resolves every pair on a variable and removes clauses containing it, and ‘Saturate’ (Saturar) repeats to the end. For the satisfiable set, □\square is never reached, and the tool reconstructs and checks a model.

Notice two things in the figure. First, in the cycle (x1∨x2∨x3x_1 \lor x_2 \lor x_3, implications x1→x2→x3→x1x_1 \to x_2 \to x_3 \to x_1 and ¬x1∨¬x2∨¬x3\lnot x_1 \lor \lnot x_2 \lor \lnot x_3), resolving the first thing seen is not enough: a plan is needed, and some resolvents lead nowhere. Second, resolution is not complete for consequence: from F={x}F = \{x\} follows x∨yx \lor y, but no resolution produces it because there is nothing to resolve. Refutation is complete: to prove F⊨x∨yF \models x \lor y, refute F∪{¬x,¬y}F \cup \{\lnot x, \lnot y\}, which is immediate.

Refutational completeness

Does every unsatisfiable formula have a refutation? Yes, and the most direct proof is an algorithm: eliminate variables one by one without losing unsatisfiability. This is the idea of the Davis and Putnam procedure (1960).

DP⁡x(F)\operatorname{DP}_x(F) no longer mentions xx, and each clause is in FF or derived from FF in one step.

This is the refutational completeness theorem, proved by induction on the number nn of variables of FF.

Proof

Assume FF has no tautologies: removing them does not change models.

Case n=0n = 0. The only clause without variables is □\square. Since the empty clause set is satisfiable, F≠∅F \neq \varnothing, so F={□}F = \{\square\} and the refutation is the one-clause sequence □\square.

Step. Let FF be unsatisfiable with n+1n + 1 variables, xx one of them, and F′=DP⁡x(F)F' = \operatorname{DP}_x(F), which has at most nn variables. Show F′F' is unsatisfiable by the contrapositive: if an assignment ν\nu of the other variables satisfies F′F', it extends to a model of FF.

  • It satisfies F0⊆F′F_0 \subseteq F', whose clauses do not contain xx.
  • If every clause C∨xC \lor x of FxF_x has CC true under ν\nu, set x=0x = 0: all clauses of FxF_x hold (by their CC) and all of F¬xF_{\lnot x} hold (by ¬x\lnot x).
  • Otherwise some C∨x∈FxC \lor x \in F_x has CC false under ν\nu, so set x=1x = 1, satisfying FxF_x. For each D∨¬x∈F¬xD \lor \lnot x \in F_{\lnot x}, resolvent C∨DC \lor D is true under ν\nu. If it is in F′F', because ν\nu satisfies F′F'; if discarded as tautological, because it contains a pair y∈Cy \in C, ¬y∈D\lnot y \in D, and since CC is false, yy is false, ¬y\lnot y is true, and so is DD. In both cases, since CC is false, DD is true and clause D∨¬xD \lor \lnot x holds.

Thus F′F' is unsatisfiable and, by induction, has a refutation C1,…,Cs=□C_1, \dots, C_s = \square. Each CiC_i is in F′F' or resolved from two earlier clauses. Those of F′F' not in FF are resolvents of two clauses of FF: writing those premises first gives a sequence starting only from clauses of FF and ending in □\square. It refutes FF.

∎

The proof is constructive in both directions, as the figure shows. If FF is unsatisfiable, eliminating all variables produces □\square and a refutation. If satisfiable, elimination ends with the empty set and the proof’s second point, read backwards, constructs a model: traverse variables in reverse elimination order and set each to 1 only if some clause C∨xC \lor x removed at its step has CC false. This is the figure’s “saturation,” and why its reconstructed model always passes the check.

DPLL: branch, propagate, backtrack

The alternative of Davis, Logemann, and Loveland (1962) trades memory for time. Instead of eliminating xx by combining clauses, try both its values: FF is satisfiable if and only if F∣xF|_x or F∣¬xF|_{\lnot x} is, where F∣ℓF|_\ell is the restriction of FF by literal ℓ\ell: remove clauses containing ℓ\ell (already satisfied) and delete ¬ℓ\lnot\ell from the rest. Generally F∣ρF|_\rho is restriction by partial assignment ρ\rho, literal by literal. The resulting search is a binary tree of depth at most nn, pruned by two rules.

The name joins the four authors: Davis and Putnam for propagation and pure-literal rules, already present in the 1960 procedure, and Logemann and Loveland for branching. Each rule’s correctness takes a line to see, and the pure-literal rule is the interesting one:

Proof

Termination. Use the number of free variables as a variant function. Steps 3 and 4 assign a variable and branching calls twice with one fewer free variable, so recursion depth is at most nn and the tree is finite.

Correctness. By induction on the number of free variables, as in correctness of recursive algorithms, it suffices to see that each step preserves satisfiability of F∣ρF|_\rho:

  • Conflict and success are definitions: □\square has no models and the empty clause set is satisfied by any assignment.
  • Propagation. If ℓ\ell is a unit clause of F∣ρF|_\rho, every model of F∣ρF|_\rho makes ℓ\ell true, so F∣ρF|_\rho and F∣ρ∪{ℓ}F|_{\rho \cup \{\ell\}} have exactly the same models except for the variable of ℓ\ell.
  • Pure literal. If ν\nu models F∣ρF|_\rho, assignment ν′\nu' agreeing with ν\nu except that it makes ℓ\ell true is also a model: clauses with ℓ\ell hold, none contains ¬ℓ\lnot\ell, and the rest do not depend on that variable. Thus F∣ρF|_\rho is satisfiable if and only if F∣ρ∪{ℓ}F|_{\rho \cup \{\ell\}} is.
  • Branching. Every assignment gives xx a value, so F∣ρF|_\rho is satisfiable if and only if one of the two restrictions is.

If a call returns an assignment, it is a model by construction (step 2 is reached only when all clauses are satisfied).

∎

The pure-literal rule only preserves satisfiability: F∣ρF|_\rho and F∣ρ∪{ℓ}F|_{\rho \cup \{\ell\}} do not have the same models, because the second no longer requires anything of clauses containing ℓ\ell. That suffices for decision but not for counting or enumerating models. Unit propagation, by contrast, preserves exactly the models and alone decides some classes: for Horn formulas, if propagation from the empty assignment gives no conflict, setting all remaining free variables to 0 yields a model.

Branching heuristics

Correctness does not depend on the variable chosen in step 5, but tree size does, greatly. Three classical rules, all computed on still-unsatisfied clauses:

  • Fixed order: the first free variable, x1,x2,…x_1, x_2, \dots The baseline for assessing the others.
  • Most frequent: the variable with most occurrences, in its most frequent polarity. It satisfies many clauses at once and shortens as many others.
  • Jeroslow–Wang: the literal maximizing J(ℓ)=∑C∋ℓ2−∣C∣J(\ell) = \sum_{C \ni \ell} 2^{-\abs{C}}, where ∣C∣\abs{C} is the number of free literals in CC (in the two-sided version, the variable maximizing J(x)+J(¬x)J(x) + J(\lnot x), with the polarity of greater JJ). The weight has a probabilistic reading: a random assignment falsifies a clause of kk free literals with probability 2−k2^{-k}, so JJ prioritizes short clauses, close to becoming unit or empty.

The next section asks what remains of a run ending without a model. The answer turns DPLL into a proof system.

The DPLL tree is a refutation

A DPLL run on an unsatisfiable formula traverses a rooted tree: each node is a call with its incoming partial assignment; each internal node has two children, one per branching-variable polarity; and each leaf is a conflict. The whole tree says “I tried everything,” but checking it would require repeating the search. The next theorem turns it into something checkable step by step.

Proof

Construct EuE_u bottom-up. Call σu\sigma_u the assignment of uu after its own implications (propagations and pure literals), namely ρu\rho_u extended by them.

Leaves. At a conflict, a clause C∈FC \in F has all literals false under σu\sigma_u. Take E=CE = C.

Decisions. If uu branches on xx with children assigned σu∪{x}\sigma_u \cup \{x\} and σu∪{¬x}\sigma_u \cup \{\lnot x\} and clauses E1E_1 and E0E_0: if E1E_1 contains ¬x\lnot x and E0E_0 contains xx, take E=Res⁡x(E1,E0)E = \operatorname{Res}_x(E_1, E_0), whose literals were all false under σu\sigma_u (those of E1E_1 except ¬x\lnot x, false under σu∪{x}\sigma_u \cup \{x\} and without variable xx; likewise for E0E_0). If E1E_1 does not contain ¬x\lnot x, it is already falsified by σu\sigma_u and we take E=E1E = E_1; similarly for E0E_0.

Propagations. Traverse implications of uu from last to first. If ℓ\ell was propagated using reason clause R=ℓ∨R′R = \ell \lor R', with R′R' false at that time, and current clause EE contains ¬ℓ\lnot \ell, replace it by its resolvent with RR on the variable of ℓ\ell, whose literals are those of EE except ¬ℓ\lnot\ell and those of R′R', all false without counting ℓ\ell. If it does not contain ¬ℓ\lnot\ell, do nothing.

Pure literals. No resolution is needed here. EE does not contain ℓ\ell, which is true under σu\sigma_u; nor can it contain ¬ℓ\lnot\ell. All clauses of FF used in the subtree of uu are conflicts or reasons and were unsatisfied when used; since satisfaction only increases as assignments extend, they were also unsatisfied when the pure-literal rule was applied. Purity of ℓ\ell means no unsatisfied clause contained ¬ℓ\lnot\ell, so none used contains it, and resolution invents no literals: neither does EE.

After processing implications of uu, EE is falsified by ρu\rho_u, as required. Each resolution uses a child’s clause once: the proof is tree-like.

∎
InteractiveThe DPLL tree is a proof
node 15 of 15
x₆x₄¬x₇x₁₂¬x₁₂x₇¬x₄¬x₁₁x₁₁¬x₆¬x₁₁¬x₉x₉x₁₁21✕✕✕4✕✕1✕✕✕□
  • node with propagations (number)
  • conflict
  • model
  • positive / negative branch
Node 1 (root)
Assignment on arrival: ∅
Implications: none
Refutation clause: □, false under the assignment on arrival ✓
Extracted tree refutation
  1. ¬x₈ ∨ x₉ ∨ x₁₁ from the formula
  2. ¬x₉ ∨ x₁₁ ∨ ¬x₁₂ from the formula
  3. ¬x₈ ∨ x₁₁ ∨ ¬x₁₂ ⟵ 1, 2 on x₉
  4. x₇ ∨ ¬x₁₁ ∨ ¬x₁₂ from the formula
  5. x₇ ∨ ¬x₈ ∨ ¬x₁₂ ⟵ 3, 4 on x₁₁
  6. ¬x₁ ∨ x₉ ∨ ¬x₁₁ from the formula
  7. ¬x₁ ∨ ¬x₈ ∨ x₉ ⟵ 1, 6 on x₁₁
  8. ¬x₄ ∨ ¬x₉ ∨ x₁₂ from the formula
  9. ¬x₁ ∨ ¬x₄ ∨ ¬x₈ ∨ x₁₂ ⟵ 7, 8 on x₉
  10. ¬x₁ ∨ ¬x₄ ∨ x₇ ∨ ¬x₈ ⟵ 5, 9 on x₁₂
  11. x₁ ∨ x₇ ∨ ¬x₈ from the formula
  12. ¬x₄ ∨ x₇ ∨ ¬x₈ ⟵ 10, 11 on x₁
  13. x₁ ∨ ¬x₆ ∨ ¬x₇ from the formula
  14. ¬x₁ ∨ ¬x₄ ∨ ¬x₇ from the formula
  15. ¬x₄ ∨ ¬x₆ ∨ ¬x₇ ⟵ 13, 14 on x₁
  16. ¬x₄ ∨ ¬x₆ ∨ ¬x₈ ⟵ 12, 15 on x₇
  17. ¬x₄ ∨ x₈ ∨ x₁₀ from the formula
  18. ¬x₄ ∨ ¬x₆ ∨ x₁₀ ⟵ 16, 17 on x₈
  19. ¬x₄ ∨ ¬x₆ ∨ ¬x₁₀ from the formula
  20. ¬x₄ ∨ ¬x₆ ⟵ 18, 19 on x₁₀
  21. ¬x₁ ∨ ¬x₃ ∨ x₁₂ from the formula
  22. x₂ ∨ x₃ ∨ x₄ from the formula
  23. ¬x₁ ∨ x₂ ∨ x₄ ∨ x₁₂ ⟵ 21, 22 on x₃
  24. ¬x₂ ∨ ¬x₅ ∨ x₁₂ from the formula
  25. ¬x₁ ∨ x₄ ∨ ¬x₅ ∨ x₁₂ ⟵ 23, 24 on x₂
  26. ¬x₁ ∨ x₄ ∨ ¬x₅ ∨ ¬x₉ ∨ x₁₁ ⟵ 25, 2 on x₁₂
  27. ¬x₁ ∨ x₄ ∨ ¬x₅ ∨ ¬x₈ ∨ x₁₁ ⟵ 26, 1 on x₉
  28. x₅ ∨ ¬x₆ ∨ x₁₁ from the formula
  29. ¬x₁ ∨ x₄ ∨ ¬x₆ ∨ ¬x₈ ∨ x₁₁ ⟵ 27, 28 on x₅
  30. ¬x₃ ∨ x₄ ∨ ¬x₁₁ from the formula
  31. x₃ ∨ ¬x₁₁ ∨ x₁₂ from the formula
  32. x₄ ∨ ¬x₁₁ ∨ x₁₂ ⟵ 30, 31 on x₃
  33. x₄ ∨ x₇ ∨ ¬x₁₁ ⟵ 32, 4 on x₁₂
  34. ¬x₁ ∨ x₄ ∨ ¬x₆ ∨ x₇ ∨ ¬x₈ ⟵ 29, 33 on x₁₁
  35. x₄ ∨ ¬x₆ ∨ ¬x₇ from the formula
  36. ¬x₁ ∨ x₄ ∨ ¬x₆ ∨ ¬x₈ ⟵ 34, 35 on x₇
  37. ¬x₁ ∨ ¬x₆ ∨ x₈ from the formula
  38. ¬x₁ ∨ x₄ ∨ ¬x₆ ⟵ 36, 37 on x₈
  39. x₁ ∨ x₄ ∨ ¬x₆ from the formula
  40. x₄ ∨ ¬x₆ ⟵ 38, 39 on x₁
  41. ¬x₆ ⟵ 20, 40 on x₄
  42. x₄ ∨ ¬x₇ ∨ x₁₁ from the formula
  43. ¬x₁ ∨ ¬x₇ ∨ x₁₁ ⟵ 42, 14 on x₄
  44. ¬x₁ ∨ x₆ ∨ x₇ from the formula
  45. ¬x₁ ∨ x₆ ∨ x₁₁ ⟵ 43, 44 on x₇
  46. x₁ ∨ x₆ ∨ x₉ from the formula
  47. x₆ ∨ x₉ ∨ x₁₁ ⟵ 45, 46 on x₁
  48. x₃ ∨ ¬x₉ ∨ ¬x₁₀ from the formula
  49. x₆ ∨ ¬x₉ ∨ x₁₀ from the formula
  50. x₃ ∨ x₆ ∨ ¬x₉ ⟵ 48, 49 on x₁₀
  51. x₃ ∨ x₆ ∨ x₁₁ ⟵ 47, 50 on x₉
  52. ¬x₃ ∨ x₆ ∨ x₁₁ from the formula
  53. x₆ ∨ x₁₁ ⟵ 51, 52 on x₃
  54. x₆ ∨ x₁₀ ∨ ¬x₁₁ from the formula
  55. x₅ ∨ ¬x₈ ∨ ¬x₁₀ from the formula
  56. x₅ ∨ x₆ ∨ ¬x₈ ∨ ¬x₁₁ ⟵ 54, 55 on x₁₀
  57. x₆ ∨ x₈ ∨ ¬x₁₁ from the formula
  58. x₅ ∨ x₆ ∨ ¬x₁₁ ⟵ 56, 57 on x₈
  59. ¬x₅ ∨ x₆ ∨ ¬x₁₁ from the formula
  60. x₆ ∨ ¬x₁₁ ⟵ 58, 59 on x₅
  61. x₆ ⟵ 53, 60 on x₁₁
  62. □ ⟵ 41, 61 on x₆
DPLL rules
Nodes (shown / total)15 / 15
Decisions · propagations · pure14 · 31 · 0
Conflicts (red leaves)8
Unsatisfiable. The extracted refutation has 62 lines: 29 formula clauses and 33 resolution steps. Independent checker: valid ✓.
Play the search: the tree grows node by node, decisions are edges labeled with the chosen literal (solid for positive, dashed for negative), blue rings mark nodes with unit propagation (with the number propagated), and red leaves are conflicts. Click a node to see its incoming assignment, implications, and corresponding refutation clause, always false under that assignment; the root's is □\square. Disable unit propagation: the tree multiplies. Change the pigeonhole heuristic to ‘Fixed order’ (Orden fijo), and in the satisfiable fixed-order instance enable pure literals: the tree falls from 10 nodes to 4.

Three consequences of this theorem guide the rest of the lesson.

  1. A failed run is information. It is false that DPLL “only helps if it finds a model”: its search tree, traversed postorder, is an unsatisfiability proof checkable without repeating the search.
  2. DPLL is tree-like resolution. The extracted refutation uses each derived clause once (if needed twice, it is derived twice). This restricted system is tree-like resolution, and the refutation has at most DPLL tree size multiplied by O(n)O(n): each node contributes one resolution for its decision and, per propagated literal, another with its reason clause. The converse also holds: a tree-like refutation yields a DPLL run with suitable branches and no larger tree. Without learning, DPLL and tree-like resolution have equal power, and any lower bound for the latter applies to the former under any heuristic.
  3. Propagation order does not matter; the heuristic does. If propagation finds no conflict, the implied-literal set is the same in every order (the unit rule’s least fixed point). If it finds one, any other order also does (every literal implied before conflict lies in that least fixed point), so the tree does not change; which clause becomes empty, and thus the refutation, may vary. Branching-variable choice changes the tree: with 5 pigeons and 4 holes, fixed order needs 103 nodes and Jeroslow–Wang 47.

Self-checking certificates

A modern solver is a program of tens of thousands of lines with aggressive optimizations, and solvers have had bugs. So we do not take “unsatisfiable” on faith: we ask for a certificate. The theorem supplies the idea: while searching, the solver writes deduced clauses, and a much smaller independent checker verifies that each follows from earlier ones and the last is □\square. The standard DRAT format (deletion resolution asymmetric tautology) does not write resolution steps one by one. Each added clause CC is justified because unit propagation on previous clauses plus ¬C\lnot C conflicts (guaranteeing CC is derived by resolution, using exactly the resolutions seen in propagation), and the format also has a more general rule justifying preprocessing. SAT competitions have required these certificates for unsatisfiable answers since the mid-2010s, and formally verified checkers exist. See DRAT proofs; this course’s checker below fits in fifteen lines.

Proof complexity: pigeonhole

If every unsatisfiable formula has a refutation, the next question is its size. Proof complexity studies the shortest proof size in a given system as a function of formula size. Its motivation is fundamental: Cook and Reckhow proved in 1979 that a proof system in which every unsatisfiable formula has a polynomial-size refutation checkable in polynomial time exists if and only if NP=coNP\text{NP} = \text{coNP} (the class of “no” answers with short certificates, coNP). Proving superpolynomial lower bounds for increasingly strong systems is one attack on that question, and resolution was the first natural system to fall.

The pigeonhole formula PHP(n+1,n)\text{PHP}(n+1, n) says n+1n + 1 pigeons fit in nn holes without sharing. With variable pijp_{ij} for “pigeon ii is in hole jj”:

PHP(n+1,n)  =  ⋀i=1n+1(pi1∨⋯∨pin)  ∧  ⋀j=1n  ⋀1≤i<i′≤n+1(¬pij∨¬pi′j).\text{PHP}(n+1, n) \;=\; \bigwedge_{i=1}^{n+1} \big(p_{i1} \lor \cdots \lor p_{in}\big) \;\land\; \bigwedge_{j=1}^{n} \;\bigwedge_{1 \le i < i' \le n+1} \big(\lnot p_{ij} \lor \lnot p_{i'j}\big).

It has n(n+1)n(n+1) variables and (n+1)+n(n+12)(n + 1) + n\binom{n+1}{2} clauses: cubic size. It is unsatisfiable by the pigeonhole principle, and the human proof is one line: count occupied (pigeon, hole) pairs; there are at least n+1n + 1 by the first clauses and at most nn by the second.

Haken’s proof (1985) was the first exponential lower bound for general resolution (not only tree-like). Beame and Pitassi’s simplified version (1996) rests on three ideas worth knowing even without reproducing the calculations:

  1. Critical assignments. It suffices to consider assignments placing nn pigeons in nn distinct holes and leaving one out, ii. There are (n+1) n!(n+1)\,n!, each falsifying exactly one formula clause, that of pigeon ii. A correct refutation must “locate” each failure: each critical assignment traverses the refutation from □\square toward the leaves, always through a premise it also falsifies, to its pigeon’s clause.
  2. Wide clauses. Replacing each ¬pij\lnot p_{ij} with the disjunction of pi′jp_{i'j} with i′≠ii' \neq i (equivalent on critical assignments) makes each clause monotone, and every refutation is shown to contain a clause that, transformed this way, mentions on the order of n2n^2 variables: at some point the proof must reason about a constant fraction of pigeons at once.
  3. Random restrictions. If there were few wide clauses, randomly placing some pigeons in holes would eliminate them all with positive probability, leaving a refutation with no wide clauses of a smaller pigeonhole instance, forbidden by point 2.
InteractiveWhy pigeonhole is hard for resolution
A critical assignment
12345123456
Rows: pigeons; columns: holes. Pigeon 1 is left out and only its clause p1,1∨⋯∨p1,5p_{1,1} \lor \dots \lor p_{1,5} fails. There are (n+1) n!=720(n+1)\,n! = 720 such assignments.
  • pigeon in hole
  • falsified clause
5
Variables / clauses30 / 81
Pigeonhole: DPLL tree nodescalculating…
Pigeonhole: conflict leaves…
Pigeonhole: tree refutation lines…
Random with 30 variables: median nodes…
A human proves this by counting: each of the 66 pigeons occupies a different hole, so at least 66 holes are needed but there are only 55. Resolution cannot count: it only combines disjunctions of literals.
Measured live with the lesson's DPLL (unit propagation and Jeroslow–Wang). Red: tree nodes for PHP(n+1,n)\text{PHP}(n+1, n); purple: lines of the extracted tree-like refutation, only through n=6n = 6 due to size; blue: median tree size for random 3-SAT formulas with the same number of variables, n(n+1)n(n+1), in the hardest region (α=4.26\alpha = 4.26). The scale is logarithmic: a straight line would be exponential growth, and the red curve bends upward, close to n!n!. Beside the graph is a critical assignment: click to see others; exactly one clause always fails.

The figure’s counts are exact: the DPLL tree on PHP(n+1,n)\text{PHP}(n+1, n) has n!n! conflict leaves and 2 n!−12\,n! - 1 nodes (6, 24, 120, …, 362 880 conflicts for n=3,…,9n = 3, \dots, 9), whereas a random 90-variable formula at the threshold is solved with a few hundred nodes. The explanation is not pigeonhole size but that resolution cannot count: its lines are disjunctions of literals, and the claim “at most kk of these variables are true,” written this way, needs many clauses. A human reasons with numbers; resolution must reason by cases.

Difficulty depends on the system. In cutting planes (Cook, Coullard, and Turán, 1987), whose lines are linear inequalities with integer coefficients, the counting argument is written directly and pigeonhole has polynomial refutations. In extended resolution, which allows fresh variables defined by formulas (like Tseitin auxiliaries), Cook found polynomial refutations in 1976. In practice encoding matters as much as the system: as seen in problem encoding, breaking hole symmetry puts pigeonhole within reach of unit propagation without a single decision.

Random 3-SAT and the phase transition

Pigeonhole is hard because of its structure. What are “typical” formulas like? The most studied model has fixed clause length.

With few clauses per variable, almost every formula is satisfiable; with many, almost none. The surprising thing is how abrupt the change is. Experiments by Mitchell, Selman, and Levesque (1992) showed that satisfiability probability falls from 100% to 0% in a narrow window around α≈4.3\alpha \approx 4.3, narrowing as nn grows, and that DPLL cost peaks sharply in the same window: formulas are easy on the left (almost any path leads to a model), hard at the threshold, and easy again on the right (contradictions appear early). This behavior is the random SAT phase transition.

InteractiveThe 3-SAT phase transition
Fraction of satisfiable formulas
  • α ≈ 4.27 (empirical)
  • first moment: 5.19
Median DPLL tree size (nodes)
4.2
Formulas per point (K)
Formulas solved0 / 1440
At α = 4.2: satisfiable · median nodes
n = 50calculating
n = 100calculating
n = 150calculating
First moment with n = 100: E[N]=2n(7/8)αn\E[N] = 2^n (7/8)^{\alpha n}105.710^{5.7}
Critical region: the satisfiable fraction drops from nearly 1 to nearly 0, increasingly fast as nn grows, and finding a model or proving there is none costs more than anywhere else.
Real computation in the background: for each nn and grid α\alpha, KK formulas are generated and solved with the lesson's DPLL. Above, the satisfiable fraction: three curves fall around α≈4.27\alpha \approx 4.27 and steepen as nn grows (for such small nn, the halfway point is somewhat higher, around 4.4). Below, median tree size on a logarithmic scale: the easy–hard–easy peak falls in the same window, at α≈4.4\alpha \approx 4.4, and grows with nn. Move α\alpha to read values and expected model count E[N]\E[N], and request other formulas to see the noise.

The first-moment bound

An upper bound on the threshold comes from an expectation calculation. Let NN be the number of models of Fk(n,m)F_k(n, m). For a fixed assignment ν\nu, a random clause is falsified exactly when its kk signs oppose those of ν\nu, with probability 2−k2^{-k}; since clauses are independent, ν\nu satisfies the formula with probability (1−2−k)m(1 - 2^{-k})^m. Summing over 2n2^n assignments, by linearity of expectation,

E[N]=2n(1−2−k)m=(2 (1−2−k)α)n.\E[N] = 2^n \left(1 - 2^{-k}\right)^{m} = \left(2\,(1 - 2^{-k})^{\alpha}\right)^{n}.

By Markov’s inequality, P(F satisfacible)=P(N≥1)≤E[N]\Pr(F \text{ satisfacible}) = \Pr(N \ge 1) \le \E[N], which tends to 0 when the base is below 1, namely when

α>ln⁡2−ln⁡(1−2−k).\alpha > \frac{\ln 2}{-\ln(1 - 2^{-k})}.

For k=3k = 3 the ratio is ln⁡2/ln⁡(8/7)≈5.19\ln 2 / \ln(8/7) \approx 5.19: above it almost no formula is satisfiable. For large kk, −ln⁡(1−2−k)≈2−k-\ln(1 - 2^{-k}) \approx 2^{-k} and the bound is ≈2kln⁡2\approx 2^k \ln 2.

The bound is far from the observed threshold. Between 4.274.27 and 5.195.19, E[N]\E[N] grows exponentially with nn yet almost no formula has models: the mean is dominated by a few formulas with many (a lottery effect). Refinements of the same method lowered the upper bound to 4.48984.4898 (Díaz, Kirousis, Mitsche and Pérez-Giménez, 2009), and analysis of simple algorithms finding models with high probability gives lower bound 3.523.52 (Hajiaghayi and Sorkin, 2003; Kaporis, Kirousis and Lalas, 2006).

What is proved and what is not

  • The transition is sharp, proved by Friedgut (1999): for each k≥2k \ge 2 there is a sequence αk(n)\alpha_k(n) such that satisfiability probability moves from near 1 to near 0 in a window o(1)o(1) around it. His theorem does not rule out αk(n)\alpha_k(n) oscillating with nn without converging.
  • For k=2k = 2 the threshold exists and is exactly 1 (Chvátal and Reed, 1992; Goerdt, 1996). The first-moment bound ln⁡2/ln⁡(4/3)≈2.41\ln 2 / \ln(4/3) \approx 2.41 is much higher.
  • For large kk, Ding, Sly, and Sun proved the threshold exists and equals the statistical physics prediction 2kln⁡2−12(1+ln⁡2)+ok(1)2^k \ln 2 - \tfrac{1}{2}(1 + \ln 2) + o_k(1), for every kk above a constant k0k_0 not made explicit in the proof.
  • For k=3k = 3, value 4.2674.267 is the statistical physics cavity-method prediction (Mézard, Parisi, and Zecchina, 2002), consistent with all experiments. No proof that the threshold exists is known.

Bridge to CDCL

DPLL has a flaw visible in the refutation theorem: each subtree is forgotten when it closes. If the same cause of conflict appears in two branches, it is rediscovered twice because a tree-like proof cannot reuse a clause. Modern solvers (CDCL, conflict-driven clause learning) fix exactly this:

  • On conflict, instead of returning to the last decision, they analyze the conflict: resolve the empty clause backwards with reason clauses of propagated literals until obtaining a clause mentioning only one literal from the last decision level. This is our proof’s propagation step applied selectively (see 1UIP conflict analysis).
  • They learn that clause, adding it to the formula for propagation during the rest of the search. A learned clause is reused in many branches, so the resulting proof is a directed acyclic graph rather than a tree: general resolution.
  • They jump back several levels at once (nonchronological backjumping), choose variables by recent conflict activity (VSIDS), and occasionally restart search while retaining learned clauses.

The theoretical result is clean: CDCL with restarts polynomially simulates general resolution (Pipatsrisawat and Darwiche, 2011), while DPLL is limited to tree-like resolution, which can be exponentially worse. Conversely, CDCL inherits resolution lower bounds, so pigeonhole remains exponential for any CDCL solver, as measured with PySAT below.

Implementation from scratch

First, Davis–Putnam resolution and elimination, with model reconstruction from the completeness proof. Clauses are frozenset of integers in DIMACS convention (x3x_3 is 3 and ¬x3\lnot x_3, -3), and the variable eliminated at each step is the one causing the least set growth.

[ ]Davis–Putnam resolution and eliminationBrowser
from itertools import combinations
import time

def resolvente(C, D, v):
    """Resolvente de C (contiene v) y D (contiene -v) sobre la variable v."""
    assert v in C and -v in D
    return frozenset((C - {v}) | (D - {-v}))

def es_tautologia(C):
    return any(-l in C for l in C)

def davis_putnam(F):
    """Eliminación de variables. Devuelve (satisfacible, modelo o None, tamaños del conjunto)."""
    S = {frozenset(c) for c in F}
    S = {C for C in S if not es_tautologia(C)}
    pila, tam = [], [len(S)]
    while S and frozenset() not in S:
        def coste(v):                      # cuánto crece el conjunto al eliminar v
            p = sum(v in C for C in S)
            q = sum(-v in C for C in S)
            return p * q - p - q
        v = min(sorted({abs(l) for C in S for l in C}), key=coste)
        P = [C for C in S if v in C]
        N = [C for C in S if -v in C]
        R = {resolvente(C, D, v) for C in P for D in N}
        S = (S - set(P) - set(N)) | {C for C in R if not es_tautologia(C)}
        pila.append((v, P))
        tam.append(len(S))
    if frozenset() in S:
        return False, None, tam
    val = {}                               # reconstrucción hacia atrás
    verdadero = lambda l: val.get(abs(l), False) == (l > 0)
    for v, P in reversed(pila):            # v es verdadera solo si alguna C ∨ v lo exige
        val[v] = any(not any(verdadero(l) for l in C if abs(l) != v) for C in P)
    return True, val, tam

def php(p, h):
    """p palomas en h huecos; la variable de (i, j), desde 0, es i*h + j + 1."""
    x = lambda i, j: i * h + j + 1
    F = [[x(i, j) for j in range(h)] for i in range(p)]
    F += [[-x(a, j), -x(b, j)] for j in range(h) for a, b in combinations(range(p), 2)]
    return F

ejemplos = {
    "cuatro cláusulas": [[1, 2], [1, -2], [-1, 3], [-1, -3]],
    "ciclo": [[1, 2, 3], [-1, 2], [-2, 3], [-3, 1], [-1, -2, -3]],
    "palomar 3 en 2": php(3, 2),
    "satisfacible": [[1, 2], [-1, 3], [-2, -3], [3, 4], [-1, -4], [-2, 4]],
}
for nombre, F in ejemplos.items():
    sat, modelo, tam = davis_putnam(F)
    linea = f"{nombre:17s} {'SAT  ' if sat else 'UNSAT'} tamaños {tam}"
    if sat:
        n = max(abs(l) for c in F for l in c)
        nu = {v: modelo.get(v, False) for v in range(1, n + 1)}
        ok = all(any(nu[abs(l)] == (l > 0) for l in C) for C in F)
        linea += f"   modelo {[int(nu[v]) for v in nu]}, ¿satisface F? {ok}"
    print(linea)

for h in (3, 4):
    t0 = time.perf_counter()
    sat, _, tam = davis_putnam(php(h + 1, h))
    print(f"PHP({h + 1}, {h}): {tam[0]} cláusulas al empezar, máximo {max(tam)} durante la eliminación"
          f"  ({time.perf_counter() - t0:.2f} s)")

In the figure’s four examples, elimination finishes in three to six rounds and reconstructs a valid model in the satisfiable case. Pigeonhole already shows the memory problem: with 5 pigeons the set reaches 113 clauses, more than twice the starting 45 (with 6 pigeons it would grow from 81 to over 2400 and take too long in the browser).

Now DPLL with three rules, three heuristics, and line-by-line extraction of the theorem’s refutation: each node returns the line index whose clause its incoming assignment falsifies. Checker verifica is deliberately independent: it only knows what a resolvent is.

[ ]DPLL with certificatesBrowser
import random

def dpll(F, n, unit=True, pure=False, heur="jw"):
    """Devuelve ("SAT", modelo, estadísticas) o ("UNSAT", refutación, estadísticas).
    La refutación es una lista de líneas (cláusula, premisas): premisas None si la cláusula es de F,
    o (i, j) si es el resolvente de las líneas i y j. La última línea es la cláusula vacía."""
    F = [tuple(sorted(set(c), key=abs)) for c in F]
    val = [0] * (n + 1)                          # 0 libre, 1 verdadera, -1 falsa
    valor = lambda l: val[l] if l > 0 else -val[-l]
    lineas, de_F = [], {}
    est = dict(nodos=0, decisiones=0, propagaciones=0, puros=0, conflictos=0)

    def axioma(i):
        if i not in de_F:
            de_F[i] = len(lineas)
            lineas.append((frozenset(F[i]), None))
        return de_F[i]

    def resuelve(a, b, v):
        C, D = lineas[a][0], lineas[b][0]
        lineas.append((frozenset((C | D) - {v, -v}), (a, b)))
        return len(lineas) - 1

    def elige():
        puntos = {}
        for c in F:
            if any(valor(l) == 1 for l in c):
                continue
            libres = [l for l in c if valor(l) == 0]
            for l in libres:
                puntos[l] = puntos.get(l, 0.0) + (2.0 ** -len(libres) if heur == "jw" else 1.0)
        if heur == "orden":
            return min(abs(l) for l in puntos)
        v = max(sorted({abs(l) for l in puntos}), key=lambda v: puntos.get(v, 0) + puntos.get(-v, 0))
        return v if puntos.get(v, 0) >= puntos.get(-v, 0) else -v

    def nodo():
        """Un modelo (lista de literales) o el índice de una línea falsificada por la asignación de llegada."""
        est["nodos"] += 1
        impl = []                                # (literal, cláusula razón, o None si es puro)
        try:
            while True:
                conflicto, unitaria, todas = None, None, True
                for i, c in enumerate(F):
                    if any(valor(l) == 1 for l in c):
                        continue
                    todas = False
                    libres = [l for l in c if valor(l) == 0]
                    if not libres:
                        conflicto = i
                        break
                    if len(libres) == 1 and unitaria is None:
                        unitaria = (libres[0], i)
                if conflicto is not None:
                    est["conflictos"] += 1
                    k = axioma(conflicto)
                    break
                if todas:
                    return [v if val[v] >= 0 else -v for v in range(1, n + 1)]
                if unit and unitaria:
                    l, i = unitaria
                    val[abs(l)] = 1 if l > 0 else -1
                    impl.append((l, i))
                    est["propagaciones"] += 1
                    continue
                if pure:
                    signos = {}
                    for c in F:
                        if not any(valor(l) == 1 for l in c):
                            for l in c:
                                if valor(l) == 0:
                                    signos.setdefault(abs(l), set()).add(l > 0)
                    puros = [v if s == {True} else -v for v, s in sorted(signos.items()) if len(s) == 1]
                    if puros:
                        val[abs(puros[0])] = 1 if puros[0] > 0 else -1
                        impl.append((puros[0], None))
                        est["puros"] += 1
                        continue
                l = elige()                      # ramificación
                hijos = []
                for b in (l, -l):
                    est["decisiones"] += 1
                    val[abs(b)] = 1 if b > 0 else -1
                    r = nodo()
                    val[abs(b)] = 0
                    if isinstance(r, list):
                        return r
                    hijos.append(r)
                k1, k0 = hijos
                if -l in lineas[k1][0] and l in lineas[k0][0]:
                    k = resuelve(k1, k0, abs(l))
                else:
                    k = k0 if -l in lineas[k1][0] else k1   # la que no menciona la variable
                break
            for l, i in reversed(impl):          # propagaciones, de la última a la primera
                if i is not None and -l in lineas[k][0]:
                    k = resuelve(k, axioma(i), abs(l))
            return k
        finally:
            for l, _ in impl:
                val[abs(l)] = 0

    r = nodo()
    if isinstance(r, list):
        return "SAT", r, est
    return "UNSAT", poda(lineas, r), est

def poda(lineas, final):
    """Conserva las líneas de las que depende `final` y las renumera; `final` queda la última."""
    usadas, pila = set(), [final]
    while pila:
        i = pila.pop()
        if i not in usadas:
            usadas.add(i)
            if lineas[i][1]:
                pila.extend(lineas[i][1])
    orden = sorted(usadas)
    nuevo = {i: k for k, i in enumerate(orden)}
    return [(lineas[i][0], None if lineas[i][1] is None else tuple(nuevo[j] for j in lineas[i][1])) for i in orden]

def verifica(F, prueba):
    """Comprobador independiente: no sabe nada de DPLL, solo qué es un resolvente."""
    base = {frozenset(c) for c in F}
    for k, (C, prem) in enumerate(prueba):
        if prem is None:
            assert C in base, f"línea {k}: {set(C)} no está en la fórmula"
            continue
        i, j = prem
        assert i < k and j < k, f"línea {k}: usa líneas posteriores"
        A, B = prueba[i][0], prueba[j][0]
        piv = [l for l in A if -l in B]
        assert len(piv) == 1, f"línea {k}: {len(piv)} pares complementarios"
        assert C == (A | B) - {piv[0], -piv[0]}, f"línea {k}: no es el resolvente"
    assert prueba[-1][0] == frozenset(), "la última línea no es la cláusula vacía"
    return True

def aleatoria(n, m, k=3, semilla=0):
    rng = random.Random(semilla)
    return [[v if rng.random() < 0.5 else -v for v in rng.sample(range(1, n + 1), k)] for _ in range(m)]

casos = [("PHP(4, 3)", php(4, 3), 12), ("PHP(5, 4)", php(5, 4), 20), ("3-SAT, n = 20, m = 110", aleatoria(20, 110, semilla=3), 20)]
for nombre, F, n in casos:
    for unit in (True, False):
        res, prueba, est = dpll(F, n, unit=unit)
        ok = verifica(F, prueba) if res == "UNSAT" else None
        print(f"{nombre:23s} propagación {'sí' if unit else 'no'}: {res}, {est['nodos']:4d} nodos, "
              f"{est['conflictos']:3d} conflictos, refutación de {len(prueba):3d} líneas, verificada: {ok}")

Unit propagation shrinks the tree by a factor of 8 to 13 in the three cases. The refutation, by contrast, barely changes: with propagation it is longer than its tree (each propagated literal can add a resolution and its reason clause), but even somewhat shorter than without propagation (64 lines versus 69 for PHP(4, 3)). PHP(4, 3)‘s 11 nodes and 64 lines match the interactive, which implements the same algorithm in TypeScript.

With the solver written, compare heuristics and measure pigeonhole growth.

[ ]Heuristics and pigeonhole growthBrowser
G = aleatoria(25, 130, semilla=11)
print("nodos del árbol según la heurística")
for heur in ("orden", "frecuente", "jw"):
    a = dpll(php(5, 4), 20, heur=heur)[2]["nodos"]
    r, _, est = dpll(G, 25, heur=heur)
    print(f"  {heur:10s} PHP(5, 4): {a:4d}    3-SAT con 25 variables ({r}): {est['nodos']:3d}")

print("\npalomar PHP(n + 1, n), propagación unitaria y Jeroslow-Wang")
import math
for h in range(2, 7):
    r, prueba, est = dpll(php(h + 1, h), h * (h + 1))
    assert verifica(php(h + 1, h), prueba)
    print(f"  n = {h}: {est['nodos']:5d} nodos = 2·{h}! − 1 = {2 * math.factorial(h) - 1:5d};  "
          f"{est['conflictos']:4d} conflictos;  refutación de {len(prueba):5d} líneas")

Fixed order yields a tree over twice as large as Jeroslow–Wang for pigeonhole and over four times larger for the random formula. Pigeonhole shows its structure: exactly n!n! conflicts and 2 n!−12\,n! - 1 nodes. Unit propagation fills each pigeon’s last free hole itself, leaving enumeration of pigeon-to-hole assignments; the refutation grows proportionally, four to five times the tree from n=4n = 4 onward.

With libraries: sympy and PySAT

Sympy’s satisfiable with algorithm="dpll2" is DPLL with watched literals and clause learning: a small CDCL. Pass it integer-encoded CNF, as in the previous lesson, so it does not reconstruct a symbolic expression.

[ ]sympy versus our DPLLBrowser
import time, statistics
from sympy import Symbol
from sympy.logic.inference import satisfiable
from sympy.assumptions.cnf import EncodedCNF

def con_sympy(F, n):
    enc = EncodedCNF([set(c) for c in F], {Symbol(f"v{i}"): i for i in range(1, n + 1)})
    return satisfiable(enc, algorithm="dpll2") is not False

for h in (4, 5):
    F, n = php(h + 1, h), h * (h + 1)
    t0 = time.perf_counter(); s = con_sympy(F, n); ts = time.perf_counter() - t0
    t0 = time.perf_counter(); r = dpll(F, n)[0]; tn = time.perf_counter() - t0
    print(f"PHP({h + 1}, {h}): sympy {'SAT' if s else 'UNSAT'} en {ts:.3f} s;  nuestro DPLL {r} en {tn:.3f} s")

n, ts, tn = 50, [], []
for s in range(6):
    F = aleatoria(n, round(4.26 * n), semilla=100 + s)
    t0 = time.perf_counter(); a = con_sympy(F, n); ts.append(time.perf_counter() - t0)
    t0 = time.perf_counter(); b = dpll(F, n)[0]; tn.append(time.perf_counter() - t0)
    assert a == (b == "SAT"), "los dos resolvedores discrepan"
print(f"3-SAT con n = {n} en el umbral: mediana sympy {statistics.median(ts) * 1e3:.0f} ms, "
      f"nuestro DPLL {statistics.median(tn) * 1e3:.0f} ms (coinciden en las 6 respuestas)")

Answers agree and the timing difference is in constants: our DPLL scans all clauses at each step, while sympy uses watched literals, which inspect only clauses affected by each assignment (the trick studied as two watched literals). For pigeonhole, learning does not help: Haken’s bounds apply to any resolution-based method.

PySAT provides access to industrial CDCL solvers and also runs in the browser. Measure conflicts, machine-independent, against the n!n! of our DPLL, and solve random formulas of a size our Python DPLL could not handle.

[ ]PySAT: CDCL versus DPLLBrowser
import time, math
from pysat.solvers import Solver

def cdcl(F, nombre="cadical153"):
    with Solver(name=nombre, bootstrap_with=F) as s:
        t0 = time.perf_counter()
        r = s.solve()
        return r, s.accum_stats()["conflicts"], time.perf_counter() - t0

print("palomar: conflictos de CDCL frente a los n! de nuestro DPLL")
for h in range(5, 8):
    r, c, t = cdcl(php(h + 1, h))
    print(f"  n = {h:2d}: {'SAT' if r else 'UNSAT'}  CaDiCaL {c:7d} conflictos ({t:.2f} s)   n! = {math.factorial(h):8d}")

print("\n3-SAT aleatorio en el umbral (α = 4.26) con CaDiCaL")
for n in (100, 150):
    filas = [cdcl(aleatoria(n, round(4.26 * n), semilla=7 * n + s)) for s in range(3)]
    print(f"  n = {n}: " + ", ".join(f"{'SAT' if r else 'UNSAT'} {c} conflictos" for r, c, _ in filas))

On pigeonhole, CaDiCaL processes about 25 000 conflicts per second in the browser, five times our Python DPLL on 6 pigeons, but the number of conflicts is of the same order as n!n! and grows similarly: with more time, the series continues with 37 288 conflicts for n=8n = 8 (versus 8!=40 3208! = 40\,320), 319 668 for n=9n = 9, and 2 657 952 for n=10n = 10, about five minutes in the browser. Learning turns the tree proof into a general proof, and general resolution remains subject to Haken’s theorem. In random 3-SAT at the threshold, a few hundred variables already cost thousands of conflicts, growing rapidly with nn (with n=200n = 200, up to 13 000; with n=300n = 300, hundreds of thousands): random threshold instances are hard for all known solvers. Do not extrapolate in the opposite direction: industrial instances with millions of variables have very different structure (modularity, few variables deciding much) and CDCL often solves them in seconds.

Common mistakes

Exercises

ProofSoundness of the resolution rule
Prove: If an assignment ν\nu satisfies C∨xC \lor x and D∨¬xD \lor \lnot x, it satisfies C∨DC \lor D.
0
Let ν\nu be an assignment with ν⊨C∨x\nu \models C \lor x and ν⊨D∨¬x\nu \models D \lor \lnot x.

Step 1 of 4. Where do you start?

ProofRefutational completeness by branching
Prove: Every finite unsatisfiable clause set FF has a resolution refutation.
0
Induct on the number nn of variables of FF. For literal ℓ\ell, F∣ℓF|_\ell removes clauses containing ℓ\ell and deletes ¬ℓ\lnot\ell from the rest.

Step 1 of 4. Base case, n=0n = 0. Why is there a refutation?

QuizWhat the pure literal preserves
The pure-literal rule makes literal ℓ\ell appearing in FF true when ¬ℓ\lnot\ell does not appear, and removes clauses containing it. How are FF and the result F′F' related?
QuizContradictory?
What results from resolving x∨yx \lor y with ¬x∨¬y\lnot x \lor \lnot y?
NumericCost of eliminating a variable
A 30-clause set without tautologies contains xx in 4 clauses and ¬x\lnot x in another 5. After Davis–Putnam elimination of xx, how many clauses can result at most?
NumericResolutions in a tree without propagation
DPLL without unit propagation or pure literals terminates without a model with a tree of 40 conflict leaves. At most how many resolutions are in the extracted refutation?
NumericPigeonhole size
How many clauses does PHP(10,9)\text{PHP}(10, 9), 10 pigeons in 9 holes, have in the lesson's encoding?
NumericThe first-moment bound
In random 3-SAT with m=αnm = \alpha n clauses, the expected number of models is 2n(7/8)αn2^n (7/8)^{\alpha n}. Above what ratio α\alpha does it tend to 0 as n→∞n \to \infty? Round to two decimal places.
NumericThe first moment in 2-SAT
Repeat for random 2-SAT: above what ratio α\alpha does expected model count tend to 0? Round to two decimal places and compare with the actual threshold, 1.
QuizHard for resolution, easy for a human
Why does the pigeonhole principle require exponential-size resolution refutations when a human proves it in one line?
QuizWhat is known about the threshold
Which statements about random kk-SAT are proved?

More than one answer may be correct.

QuizWhat changes and what does not
Starting from the same unsatisfiable formula, what can change if DPLL processes unit clauses in a different order while keeping the branching heuristic?
CodeDPLL with a certificate
Implement dpll_cert(F, n), where F is a list of clauses (lists of DIMACS integers with variables from 1 to n). If F is satisfiable, return ('SAT', modelo), where modelo is a list of n literals (v or -v) satisfying every clause. Otherwise return ('UNSAT', prueba): a list of lines (clausula, premisas) where premisas is None if the clause is in F, or a pair (i, j) of indices of earlier lines of which it is a resolvent, and whose last clause is empty. Use unit propagation; the heuristic is up to you. Tests check the proof with an independent verifier.
def dpll_cert(F, n):
  """('SAT', modelo) o ('UNSAT', prueba) con prueba = [(clausula, premisas), ...]."""
  # tu código: propagación unitaria, ramificación y vuelta atrás,
  # y en cada nodo la cláusula falsificada por la asignación de llegada
  return ('SAT', list(range(1, n + 1)))
Shift+Enter to run

Summary

Key idea
Proving that there is no solution means constructing a refutation: a chain of resolutions ending in the empty clause. Resolution is sound and refutationally complete, DPLL produces tree-like refutations as a by-product of search, and simple formulas such as pigeonhole have exponentially long shortest refutations.
  • The resolution rule derives, from C∨xC \lor x and D∨¬xD \lor \lnot x, C∨DC \lor D; it is sound (case analysis on the pivot) and eliminates just one complementary pair.
  • It is refutationally complete: eliminating variables one by one (Davis–Putnam) preserves unsatisfiability and ends at □\square; for a satisfiable formula, reading the same elimination backward constructs a model. Its drawback is size: each elimination can add pq−p−qpq - p - q clauses.
  • DPLL branches instead of eliminating, with unit propagation (which preserves models) and pure literals (which preserve only satisfiability). It terminates because each call has one fewer free variable; the branching heuristic (Jeroslow–Wang, most frequent) determines tree size.
  • A failed DPLL run is a tree-like refutation: each node carries a clause falsified by its assignment, the root carries □\square, and an independent checker verifies it. This is the idea behind industrial solvers’ DRAT certificates.
  • Haken: every refutation of PHP(n+1,n)\text{PHP}(n+1, n) has exponential size, because resolution cannot count. DPLL needs exactly n!n! conflicts with our heuristic, and CDCL also grows exponentially.
  • In random 3-SAT, satisfiability drops sharply near α≈4.27\alpha \approx 4.27 (empirical) and DPLL cost peaks there. The first moment gives the bound α≤5.19\alpha \le 5.19; existence of the threshold is proved only for k=2k = 2 and large kk.
  • CDCL is DPLL that learns: conflict analysis is resolution with reason clauses, and reusing what is learned turns the tree proof into general resolution.