Maps to: Stanford CS 257 Introduction to Automated Reasoning (Winter 2026), Lecture 2 · Thu 01/08/2026 · Propositional logic: normal forms, SAT solving, resolution (Caroline Trippel). Homework 1 was released that day. Reading: Bradley & Manna, The Calculus of Computation (CC) §1.6–1.7; Enderton, A Mathematical Introduction to Logic (MI) §1.6. Basis: The Stanford slides are on Canvas and not public. This lecture follows the official topic list and reading, and two public decks of the Iowa course CS:4980 (Cesare Tinelli, Spring 2024): Normal Forms in Propositional Logic and Decision Procedures for Satisfiability in Propositional Logic. Both state that they are adapted from slides by Clark Barrett, Caroline Trippel and Andrew (Haoze) Wu at Stanford. “The slides” below means those decks. Their examples are reused here:
- the exercises and ;
- the NNF blow-up of ;
- the naming of and its “32 vs 4 copies of ”;
- the seven-name clausal-form table;
- the DIMACS example;
- the resolution refutation of ;
- the four Davis–Putnam transformations and the two complete DP runs.
These notes add proofs (termination of NNF, the parity lower bound, correctness of Tseitin and Plaisted–Greenbaum, soundness and refutational completeness of resolution, correctness of DP with model reconstruction), the modeling patterns of §8, and four experiments that measure every claim. The experiments and their code were designed for these notes and do not reflect what was said in class. Code:
code/lecture02/(4 scripts + 3 modules; Python standard library only, matplotlib optional; about 2 to 12 seconds each) 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:
- Convert a formula to NNF, DNF and CNF by rewriting, and explain when each conversion is linear and when it explodes.
- Prove that some formulas (parity) have no small equivalent CNF, and explain why converting to DNF cannot be a shortcut to SAT.
- Define equisatisfiability, apply Tseitin’s transformation by hand, prove it correct, and explain what the Plaisted–Greenbaum variant saves and loses.
- Use a SAT solver for a validity question correctly (encode the negation).
- Read and write the DIMACS format, and use the vocabulary of clause sets: literal, complement, unit, Horn, tautology, subsumption, empty clause vs empty set.
- Apply the resolution rule, write and check a resolution refutation, and prove resolution sound and refutationally complete.
- Run the Davis–Putnam procedure by hand, reconstruct a model from it, and explain its memory explosion.
- Explain, with measured numbers, why the pigeonhole formulas are hard for every resolution-based method.
0.2 Prerequisites and scope
| Assumed (Lecture 1) | Introduced here | Developed later |
|---|---|---|
| formulas as trees, structural induction | normal forms, rewriting to completion | rewriting systems for theories (Lectures 10–13) |
| interpretations, satisfiability, equivalence | equisatisfiability, projection of models | Skolemization keeps only equisatisfiability too (Lecture 7) |
| the semantic-argument method | resolution, saturation, DP | proof systems in general (Lecture 3), DPLL (Lecture 4), CDCL (Lecture 5) |
| the adder miter and its exponential wall | Tseitin encoding of circuits, DIMACS | bit-blasting (Lecture 16), model checking (Lecture 9) |
0.3 Map
§1 why normal forms; equivalent vs equisatisfiable
§2 negation normal form: rules, termination, the ⇔ blow-up, polarity ← code 01
§3 DNF and CNF by distribution; the parity lower bound; why DNF is no shortcut ← code 01
§4 Tseitin's transformation and Plaisted–Greenbaum; correctness; validity via negation ← code 02
§5 clause sets: vocabulary, the DIMACS format ← code 02
§6 resolution: the rule, refutations and their checking, completeness, saturation, pigeonholes ← code 03
§7 the Davis–Putnam procedure: four transformations, model reconstruction, memory ← code 04
§8 modeling with clauses: cardinality constraints and benchmark families
§9 summary §10 common pitfalls §11 exercises §12 further reading §13 next lecture
Suggested order: §1–§3 → run 01 → §4–§5 → run 02 → §6 → run 03 → §7 → run 04 → §8.
0.4 Notation (additions to Lecture 1)
| Symbol | Meaning |
|---|---|
| , | literals: a variable or its negation |
| the complement of : and | |
| clauses: disjunctions of literals, written as sets | |
| the empty clause (unsatisfiable) | |
| a clause set (a conjunction of clauses); is the empty clause set (satisfiable) | |
| and are equisatisfiable (both satisfiable or both unsatisfiable) | |
| can be derived from by resolution | |
| DIMACS literals: variable is the integer , is |
0.5 The code of this lecture
Three new modules extend logic.py from Lecture 1 (imported, not copied, through the small helper course_path.py):
cnf.py— theCNFclass (integer literals with names, printing, DIMACS reading and writing), truth tables of clause sets for cross-checks, NNF, a step-by-step rewriting engine for the slides’ rules, DNF/CNF by distribution with a size budget, and Tseitin / Plaisted–Greenbaum.sat_families.py— problems as clause sets: pigeonholes, graph coloring, n-queens, Sudoku, random k-SAT, the adder miters of Lecture 1, parity chains, cardinality constraints. (The planned name wasencodings.py; that is the name of a Python standard-library package, so the file could never have been imported.)resolution.py— the resolution rule, derivations, refutation printing, an independent proof checker, saturation (a complete decision procedure), unit resolution, and the Davis–Putnam procedure with model reconstruction.
Lectures 4 and 5 build their solvers on cnf.py and test them on sat_families.py.
1. Why normal forms?
1.1 The lesson of Lecture 1
Lecture 1 ended with two decision procedures and a measured disappointment. The semantic-argument method has ten rules, one per connective and sign, and on random CNF formulas it needed 44,254 lines where a truth table needs 16 rows. One reason: the cases of a β-rule overlap, and nothing in the method knows which subformulas have already been satisfied.
A reasoning engine works best on a small, uniform input language. If every input has the same shape, the engine needs fewer rules, its data structures can be specialized, and its invariants are easier to state and prove. This is the job of a normal form: a restricted sub-language into which every formula can be translated.
Intuition. Think of a compiler. Source programs are written in a rich language with loops, functions and expressions nested in any way. The compiler first lowers them into a simple intermediate representation (three-address code, SSA). Optimizations then deal with only a few instruction shapes. Normal forms are the intermediate representation of automated reasoning.
1.2 Three normal forms, two kinds of translation
The slides name three normal forms used everywhere:
| Normal form | Shape | Typical use |
|---|---|---|
| NNF (negation normal form) | only ; only in front of atoms | first step of the other two; polarity reasoning |
| DNF (disjunctive normal form) | a disjunction of cubes (conjunctions of literals) | satisfiability is trivial; model enumeration |
| CNF (conjunctive normal form) | a conjunction of clauses (disjunctions of literals) | the input format of SAT solvers |
There are two ways to translate into a normal form, and the difference between them is the main idea of this lecture:
- Equivalent translation: the result has exactly the same models, over the same variables. Every formula has an equivalent NNF, DNF and CNF — but the DNF and CNF can be exponentially larger (§3).
- Equisatisfiable translation: the result may use new variables; it is satisfiable exactly when the input is. Tseitin’s transformation produces an equisatisfiable CNF of linear size (§4).
For a SAT solver, which only answers “satisfiable or not?” (and, if so, gives a model), equisatisfiability is enough — provided the models can be translated back, which Tseitin’s can (§4.3).
2. Negation normal form
2.1 Definition and the rewrite rules
A formula is in NNF if it uses only , and appears only in front of atoms (, , ). The slides’ grammar:
To convert, apply these rewrite rules to the formula and its subformulas, in any order, until none applies (“to completion”):
| Rule | Rewrite | Why it is allowed |
|---|---|---|
| ⇔ elimination | definition of ⇔ | |
| ⇒ elimination | truth table of ⇒ | |
| ¬ into ∧ | De Morgan | |
| ¬ into ∨ | De Morgan | |
| ¬¬ elimination | double negation | |
| ¬⊥, ¬⊤ | , | truth tables |
Each rule replaces a subformula by an equivalent one, so by the substitution of equivalents (Lecture 1, §6.3) every step preserves the meaning of the whole formula. The rules of DNF and CNF (§3) are of the same kind.
Script 01 runs the rules step by step. On the slides’ first exercise:
start ¬(p ∨ ¬q ⇒ r)
⇒ elimination ¬(¬(p ∨ ¬q) ∨ r)
¬ into ∨ ¬¬(p ∨ ¬q) ∧ ¬r
¬¬ elimination (p ∨ ¬q) ∧ ¬r
On the second, becomes in six steps: a single conjunction containing both and , so the formula is unsatisfiable.
2.2 Why the rewriting stops
“Apply the rules until none applies” is only a procedure if it always stops. Could the rules undo each other forever? The standard way to prove termination is a measure: a natural number that every rewrite step strictly decreases. Natural numbers cannot decrease forever, so no rewrite sequence is infinite.
Define a weight by structural recursion (Lecture 1, §3.4):
Write and and check each rule:
| rule | weight before | weight after |
|---|---|---|
| ⇔ elimination | — smaller by 1 | |
| ⇒ elimination | ||
| ¬ into ∧, ¬ into ∨ | — much smaller, since | |
| ¬¬ elimination | ||
| ¬⊤, ¬⊥ |
Every rule decreases the weight of the subformula it rewrites. Every line of the definition is strictly increasing in and , so a smaller subformula makes the whole formula smaller, wherever the rewrite happens. Hence every rewrite step lowers the weight of the whole formula, and the rewriting terminates, in any order. The exponentials are what make the ¬-pushing rules decrease: a ¬ above a big subformula is “expensive”, and pushing it down splits it into cheaper pieces.
The code does not rewrite step by step (except to show traces). It computes the NNF in one recursive pass that carries a polarity (§2.4); structural recursion terminates by construction.
2.3 How large is the NNF?
The slides state:
Theorem 1. Every formula without ⇔ has an equivalent NNF with a linear increase in size (e.g. in the number of variable occurrences).
Indeed, without ⇔ no rule copies a subformula: ⇒ elimination and De Morgan only move and add ¬ symbols. Script 01 (Part 2) checks it on 5,000 random formulas with ¬, ∧, ∨, ⇒: the number of variable occurrences was unchanged in all 5,000, and the size grew by a factor of at most 1.47.
With ⇔ it is different: becomes , with two copies of each side, one positive and one negative. Nested ⇔ multiply the copies. On the balanced ⇔ trees of script 01 (depth 2 is the slides’ ):
| depth | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| variable occurrences in the input | 2 | 4 | 8 | 16 | 32 | 64 |
| variable occurrences in the NNF | 4 | 16 | 64 | 256 | 1,024 | 4,096 |
| NNF tree size | 9 | 39 | 159 | 639 | 2,559 | 10,239 |
| NNF DAG size | 7 | 23 | 55 | 119 | 247 | 503 |
The slides’ example goes from 4 variable occurrences to 16. In general the NNF of a depth- ⇔ tree has occurrences for variables: quadratic in the input, and for a chain of nested ⇔ (each ⇔ inside the next) it is exponential in the chain length.
The last row is the first hint of the cure. Every subformula appears in the NNF in only two versions, positive and negative. If equal subformulas are stored once (a DAG, Lecture 1 §10.6), the NNF stays linear: 503 nodes at depth 6 instead of 10,239. Tseitin’s transformation (§4) turns this sharing into clauses.
2.4 Polarity: computing the NNF in one pass
Instead of rewriting until nothing changes, the code computes the NNF in one recursive pass that carries a polarity: nnf(g, positive) returns the NNF of , nnf(g, negative) the NNF of .
and similarly for ∨ and ⇔. This view introduces a notion used again in §4.4: the polarity of a subformula occurrence. An occurrence is positive if it sits under an even number of negations (counting the left side of ⇒ as a negation), negative if under an odd number, and it has both polarities under ⇔. Polarity tells which direction of truth matters: making a positive subformula more true can only make the whole formula more true (monotonicity), and conversely for negative ones.
3. DNF and CNF, and why they explode
3.1 Definitions and the distributive laws
A cube is a conjunction of literals; a DNF is a disjunction of cubes. A clause is a disjunction of literals; a CNF is a conjunction of clauses:
To convert an NNF to DNF, apply the distributive law of ∧ over ∨ (and flatten nested conjunctions and disjunctions); for CNF, the dual law of ∨ over ∧:
Each step copies . That copy is the source of the explosion. On the slides’ first exercise the DNF needs one distribution step, copying into both cubes: , while the NNF is already a CNF.
The code works on sets rather than formula trees, which is the same computation, organized:
The second line is the distributive law: . Tautological clauses () and duplicates are dropped on the way, which changes nothing semantically.
3.2 Measured: three linear families, three exponential normal forms
Script 01 (Part 3) converts three families whose formulas grow linearly:
| n | 2 | 4 | 6 | 8 | 10 | 12 |
|---|---|---|---|---|---|---|
| : size | 7 | 15 | 23 | 31 | 39 | 47 |
| … its CNF: clauses | 4 | 16 | 64 | 256 | 1,024 | 4,096 |
| parity : size | 3 | 7 | 11 | 15 | 19 | 23 |
| … its CNF: clauses | 2 | 8 | 32 | 128 | 512 | 2,048 |
| … its CNF: literals | 4 | 32 | 192 | 1,024 | 5,120 | 24,576 |
| : its DNF, cubes | 4 | 16 | 64 | 256 | 1,024 | 4,096 |

Every equivalent normal form doubles with each . The first family is the textbook example: a clause of the CNF must pick one of from every pair, and all choices are needed.
3.3 Is it the method’s fault? The parity lower bound
Maybe a cleverer algorithm would find a smaller equivalent CNF? For parity, provably not.
Proposition. Every CNF equivalent to (or to its negation, the ⇔ chain) has at least clauses.
Proof. Drop tautological clauses; they change nothing. Let be a clause of an equivalent CNF, and suppose does not mention some variable . is not a tautology, so some interpretation falsifies it. Then falsifies the whole CNF, so makes the parity function false. Flip the value of in : is still false (it does not mention ), so the CNF is still false — but the parity function is now true. Contradiction. So every clause mentions all variables, and is then false in exactly one row of the truth table. Each of the false rows of the parity function must be excluded by some clause, so there are at least clauses. ∎
Script 01 confirms the shape for : 128 clauses, every clause has all 8 variables, and the truth table has 128 false rows.
The conversion also works harder than its output suggests. Under ⇔, the NNF contains both versions of every subformula, and distribution combines one with the other; almost all the products are tautologies that are thrown away. Script 01 counts the clause pairs combined: 1,751 for (128 clauses produced), 355,675 for (2,048 clauses) — the work grows about 4-fold per variable while the output doubles.
3.4 Why not just convert to DNF?
A DNF is satisfiable iff at least one cube is free of complementary literals — a linear scan. Dually, a CNF is valid iff every clause is a tautology. Script 01 (Part 4) checks both tests against truth tables on 2,000 random formulas: 2,000/2,000 agreement each.
So why not convert every formula to DNF and decide satisfiability in linear time? Because the conversion does the hard work. A 3-CNF with clauses over disjoint variables has cubes: 59,049 for (script 01). In general, if DNF conversion were polynomial, SAT would be in P. The slides’ conclusion:
| DNF | CNF | |
|---|---|---|
| satisfiability | linear time | NP-complete |
| equivalent conversion | exponential in the worst case | exponential in the worst case |
| equisatisfiable conversion | — | linear (Tseitin, §4) |
Modern SAT solvers expect CNF-like input. They choose to tackle the hardness of the satisfiability problem at run time, where clever search often avoids the worst case, rather than at transformation time, where the worst case is unavoidable.
3.5 Why CNF is the natural input format
Beyond the existence of a linear equisatisfiable conversion, CNF fits how problems are stated:
- Constraints accumulate conjunctively. A specification is a list of requirements, each of which must hold. “Every pigeon sits in a hole” is one clause per pigeon; “no two pigeons share a hole” is one clause per pair (§8).
- A clause is a local, checkable requirement. Under a partial assignment a clause is satisfied, falsified, or “waiting”; when all but one literal are false, the last one is forced (a unit clause). This makes propagation cheap — the engine of DPLL and CDCL (Lectures 4–5).
- Learning adds clauses. A solver that learns from a conflict expresses the lesson as one more clause; the input language is closed under what the solver produces.
4. Tseitin’s transformation: equisatisfiable and linear
4.1 Naming subformulas
The slides’ recipe for a “space-efficient CNF transformation”, from Tseitin (1968):
- Take a non-literal subformula of the formula .
- Introduce a new name for it: a fresh variable.
- Add a definition .
- Replace in by .
Repeat until every formula is small, then convert each small definition to CNF by the standard method — which is cheap, because each definition has a fixed shape. On the slides’ chain , naming every inner ⇔ gives
The slides claim that the CNF of by distribution contains 32 copies of , and the CNF of the named set only 4. Script 02 (Part 2) counts:
| conversion | vars | clauses | literals | occurrences of |
|---|---|---|---|---|
| distribution | 6 | 32 | 192 | 32 |
| Tseitin | 11 | 21 | 61 | 4 |
(The parity CNF has 32 clauses and each mentions every variable, §3.3. Of the named set, only the 4 clauses of mention .)
4.2 The clause patterns
Applied systematically, naming gives every non-literal subformula its own variable , writes the definition , where is the literal that stands for (a variable, its negation, or ‘s name), and finally asserts the root’s literal. Each definition becomes a fixed handful of clauses:
| definition | ” ⇒ definition” | “definition ⇒ ” |
|---|---|---|
| , | ||
| , | ||
| , | ||
| , | , | |
You can derive every line yourself: is , which distributes into two clauses; is .
The slides’ worked example is , the negation of a valid formula. Script 02 (Part 1) reproduces the slides’ table exactly, with names in pre-order ( is the whole formula):
| name | subformula | definition | clauses |
|---|---|---|---|
| , | |||
| , , | |||
| , , | |||
| , , | |||
| , , | |||
| , , | |||
| , , |
plus the root clause : 10 variables, 21 clauses, and unsatisfiable, as it must be. Solvers do not name negations: simply becomes the literal . That saves one name and two clauses here (9 variables, 19 clauses, root clause ).
4.3 Why it is correct
Write for the clause set: all definition clauses plus the root unit clause. is the set of variables of .
Theorem (Tseitin). (a) If , then restricted to satisfies . (b) Every interpretation of with extends in exactly one way to a model of . Hence , and the two have the same number of models.
Proof. (a) By structural induction on the named subformulas , bottom-up: if satisfies the definition clauses, then . For a leaf-level gate, the clauses of say exactly that has the value of ; for higher gates, the induction hypothesis says the child names already carry the children’s values. So , and the root clause makes it true. (b) Extend by for every named . All definitions hold, and the root literal is true because . The extension is unique, because the definitions force every name’s value. ∎
Two consequences matter in practice:
- Model translation is free: a model of returned by a solver, restricted to , is a model of . This is why a SAT solver can answer satisfiability questions about arbitrary formulas and still return meaningful counterexamples.
- Model counting is preserved (full Tseitin only), which model counters rely on.
Script 02 (Part 3) checks all claims by truth table on 3,000 random formulas with up to 12 connectives (some with constants):
| check | holds for |
|---|---|
| full Tseitin: satisfiable iff the formula is | 3,000 / 3,000 |
| full Tseitin: projected models = models of | 3,000 / 3,000 |
| full Tseitin: #models(clauses) = #models() | 3,000 / 3,000 |
| Plaisted–Greenbaum: projected models = models of | 3,000 / 3,000 |
| Plaisted–Greenbaum: #models(clauses) > #models() | 1,292 / 3,000 |
Size. Each distinct subformula costs one variable and at most four clauses of at most three literals, so is linear in the number of distinct subformulas — the DAG size. Shared subformulas get one name.
4.4 Plaisted–Greenbaum: only the direction you need
Look again at the two columns of the clause table. If a subformula occurs only positively (§2.4), the formula can only become more true when is replaced by something stronger than . So it suffices to say (“if the name is true, the subformula really is true”); the other direction never helps satisfy the formula. Dually, a negative occurrence needs only ; an occurrence under ⇔ needs both.
Plaisted and Greenbaum (1986) proved that this halved encoding is still equisatisfiable, and its models still project onto models of — script 02 confirms both on all 3,000 formulas. What is lost is uniqueness: a name is now only bounded on one side, so a model of can extend in several ways. That raised the model count in 1,292 of the 3,000 formulas. PG saved 4.71 clauses per formula on average there, and about 10% on the adder miters below, where most gates sit under ⊕ (that is, under ⇔, which needs both directions).
4.5 A pitfall: validity needs the negation
Tseitin’s transformation preserves satisfiability, not validity. The valid formula becomes
which has 2 models out of 4: setting false falsifies it. Script 02 (Part 4) found that all 226 valid formulas among 2,000 random ones have a non-valid Tseitin encoding. The correct way to ask a SAT solver whether is valid is the duality of Lecture 1:
which agreed with the truth table on 2,000/2,000 formulas. Every verification tool asks its questions this way: the “bad behaviour” is encoded, and UNSAT means “no bad behaviour exists”.
4.6 The adder miters of Lecture 1, revisited
Lecture 1’s equivalence check of two adders hit an exponential wall: the miter has truth-table rows. Script 02 (Part 5) converts the ripple-carry vs majority-carry miter both ways:
| bits | 1 | 2 | 4 | 6 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|---|---|
| formula tree size | 38 | 101 | 414 | 1,483 | 5,468 | 1.3e6 | 8.6e10 | 3.7e20 |
| formula DAG size | 20 | 37 | 71 | 105 | 139 | 275 | 547 | 1,091 |
| CNF by distribution: clauses | 4 | 16 | 256 | 4,096 | – | – | – | – |
| Tseitin: variables | 7 | 21 | 49 | 77 | 105 | 217 | 441 | 889 |
| Tseitin: clauses | 15 | 57 | 137 | 217 | 297 | 617 | 1,257 | 2,537 |
| Plaisted–Greenbaum: clauses | 13 | 49 | 121 | 193 | 265 | 553 | 1,129 | 2,281 |

By distribution the clause count is : the exponential wall of Lecture 1 moved from time to space. By naming, every gate costs a constant number of clauses: about 40 per bit, 2,537 clauses for two 64-bit adders. The majority carry whose formula tree had 10,485,751 nodes at 20 bits (Lecture 1, §10.6) becomes 136 variables and 289 clauses.
The input is now small. Whether it can be solved fast is a different question, taken up by the rest of this lecture (resolution, DP) and by Lectures 4–5.
Run it.
python3 02_tseitin.py(about 4 seconds): the slides’ table, the copies of , the correctness checks, the validity pitfall, the adder sizes and the DIMACS output of §5.
5. Clause sets
5.1 Clauses as sets
From now on the slides work only with clause sets. A clause is identified with the set : order and repetition do not matter. A clause set is satisfiable iff some interpretation makes at least one literal of every clause true. Example from the slides: is satisfied by .
Two edge cases deserve to be memorized, because they are opposite:
| object | meaning | satisfiable? | why |
|---|---|---|---|
| the empty clause | a disjunction of nothing | no | no literal can be made true (“no options to choose”) |
| the empty clause set | a conjunction of nothing | yes | there is nothing to satisfy (“no constraints”) |
Vocabulary used for the rest of the course:
| term | meaning | example |
|---|---|---|
| unit clause | exactly one literal | : must be false |
| tautology | contains and | : true in every interpretation, can be dropped |
| Horn clause | at most one positive literal | , i.e. |
| subsumes | subsumes : every model of satisfies , so is redundant | |
| pure literal | occurs in , does not | §7 |
| clausal form of | a clause set equisatisfiable with | the output of Tseitin |
The slides distinguish CNF (an equivalent conjunction of clauses) from clausal form (an equisatisfiable set of clauses). The big advantage of clausal form: any formula can be converted in almost linear time.
5.2 The DIMACS format
The standard text format for clause sets, read by practically every SAT solver:
c example.cnf comment lines start with c
p cnf 3 2 problem line: p cnf <#variables> <#clauses>
1 -3 0 p1 ∨ ¬p3 (a literal is a signed variable index; 0 ends the clause)
2 3 -1 0 p2 ∨ p3 ∨ ¬p1
Variables are numbered from 1, is , and cannot be a literal because . Our to_dimacs additionally writes c var i name comments so that parse_dimacs can restore the names (other tools ignore comments). Script 02 (Part 6) writes the 64-bit ripple-carry vs or-carry miter: 826 variables, 2,348 clauses, 3,176 lines, and reads it back unchanged.
The same integer representation is used inside the code of the course: the complement of literal l is -l, and its variable is abs(l). All solvers since the 1990s do this; it makes the most frequent operation, “is this literal false?”, a single array lookup.
6. Resolution
6.1 One rule
On clause sets, a single inference rule suffices for a complete refutation method. The resolution rule (Robinson 1965; for propositional clauses already in Davis–Putnam 1960):
The conclusion is a resolvent, the pivot. The slides’ example: and resolve on to .
Intuition. Case analysis on the pivot. If is true, the second clause must be satisfied by something in ; if is false, the first by something in . Either way, something in is true. The pivot has been “used up” and disappears.
Soundness. , by exactly that case analysis. Script 03 (Part 1) checks it on 20,000 random clashing pairs: 20,000/20,000. The converse (resolvent ⊨ premises) held for only 594: resolution derives consequences; it does not preserve equivalence.
One pivot at a time. and clash on two variables. Resolving on gives , on gives : tautologies, useless but harmless. Removing both pivots at once would give — yet the set has 2 models. That step would be unsound, and it is a classic exam mistake.
6.2 Refutations, and how to check one
A resolution derivation of from is a sequence of clauses, each either in or a resolvent of two earlier ones, ending with . A refutation is a derivation of . Since each derived clause is entailed by and is unsatisfiable, a refutation proves that is unsatisfiable.
The slides’ example, as found and printed by script 03 (Part 2):
1. {p1, p2} input
2. {p1, ¬p2} input
3. {¬p1, p3} input
4. {¬p1, ¬p3} input
5. {p1} resolve 1, 2 on p2
6. {p3} resolve 5, 3 on p1
7. {¬p3} resolve 5, 4 on p1
8. {} resolve 6, 7 on p3
Finding a refutation may take a long search; checking one is easy. The function check_refutation trusts nothing: for each line it re-checks that an input line really is an input clause, that a resolvent line cites two earlier lines whose pivot clashes, and that the clause is exactly their resolvent; finally that the last line is . Script 03 shows it accepting the proof above and rejecting four tampered copies (wrong resolvent, forward reference, made-up input, missing final line), each with a precise message.
This asymmetry — hard to find, easy to check — is what makes proofs useful as certificates. When a SAT solver answers UNSAT, it can emit a proof that a tiny, trusted program re-checks (Lecture 5). Lecture 3 turns “a proof is something a fast program can check” into the definition of a proof system.
6.3 Refutational completeness
Resolution cannot derive every consequence: from it derives nothing, yet . What it can do is refute every unsatisfiable set.
Theorem (refutational completeness). If a finite clause set is unsatisfiable, then .
The proof rests on a lemma that is also the heart of the Davis–Putnam procedure (§7). For a variable , let be the clauses of containing , those containing , and
Lemma (elimination). is satisfiable iff is. Moreover, does not mention .
Proof. (⇒) Every clause of is in or a resolvent of clauses of , hence entailed. (⇐) Let satisfy ( need not assign ). If every with is true under , set false: then is satisfied by those remainders and by . Otherwise some has false under . Take any . If their resolvent is not a tautology, it is in and true under ; its -part is false, so is true. If it is a tautology, some literal has ; is false, so is true. Either way every is true, so setting true satisfies (by ) and (by the remainders). ∎
Proof of the theorem. Eliminate the variables of one by one. Each step preserves unsatisfiability (lemma) and removes one variable. When no variable is left, the clause set is either (satisfiable — impossible) or . So was produced, and every clause produced along the way is a resolvent of clauses produced earlier: that is a resolution refutation. ∎
6.4 Saturation: resolution as a decision procedure
The slides turn the rule into a satisfiability proof system with states ( collects discarded tautologies) and four rules:
Apply Clash or Resolve until the empty clause appears (UNSAT) or neither applies (SAT). It terminates: over variables there are at most different clauses (each variable absent, positive or negative), and each Resolve adds a new one. It is correct: soundness gives the UNSAT direction; refutational completeness gives the SAT direction (if were unsatisfiable, would be derivable, and a saturated set contains everything derivable). Lecture 3 makes “sound, complete, terminating” precise for any such system.
The code (saturate) adds two standard refinements:
- Given-clause loop with shortest-first order. Clauses wait in a queue; the shortest waiting clause is resolved against all processed ones. Short clauses are strong (a unit cuts every clause containing ), and is the shortest of all.
- Forward subsumption. A new resolvent is dropped if an existing clause is a subset of it. This keeps completeness: a subsumed clause can never be needed in a refutation that its subsuming clause could not replace.
Script 03 (Part 3) on 2,000 random 2-CNF and 3-CNF sets (3–8 variables): saturation agreed with the truth table 2,000/2,000 times (1,318 satisfiable, 682 unsatisfiable), and all 682 refutations passed the independent checker. Subsumption matters a lot on satisfiable sets, which must be closed under all their consequences before SAT can be declared:
| vars | clauses | subsumption | kept | generated |
|---|---|---|---|---|
| 4 | 12 | yes / no | 27 / 30 | 306 / 396 |
| 5 | 15 | yes / no | 53 / 138 | 1,002 / 10,250 |
| 6 | 18 | yes / no | 86 / 477 | 2,069 / 152,159 |
(Measured while developing the code, not printed by the scripts: plain saturation of satisfiable random 3-CNF over 8 variables kept 6,050 of the 6,560 possible non-empty clauses over 8 variables, after computing 31.8 million resolvents in about 40 seconds.)
6.5 Unit resolution: fast but incomplete
Unit resolution restricts one premise to be a unit clause : from and derive . It is what unit propagation does in every modern solver. Alone, it is not refutationally complete: is unsatisfiable but has no unit clause, so the rule never applies. Script 03 found that unit resolution refuted 0 of the 682 unsatisfiable random 2- and 3-CNF sets (none contains a unit clause), but all 300 unsatisfiable random Horn sets: for Horn clauses unit resolution is complete, which is why Horn-SAT is decidable in linear time (Dowling and Gallier 1984).
The slides’ remark points ahead: modern SAT solvers use unit resolution plus backtracking search. Guessing a value for a variable creates a unit clause, and unit resolution takes over. That is DPLL (Lecture 4).
6.6 How long must a refutation be? The pigeonhole formulas
says that pigeons sit in holes, one pigeon per hole: variables (“pigeon in hole ”), one clause per pigeon, and for every hole and pair of pigeons. A human sees the contradiction instantly — by counting. Script 03 (Part 4) runs saturation:
| holes | vars | clauses | kept | generated | proof steps (DAG) | proof steps (tree) | truth-table rows |
|---|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 6 | 3 | 2 | 2 | |
| 2 | 6 | 9 | 62 | 120 | 12 | 14 | |
| 3 | 12 | 22 | 1,141 | 8,020 | 66 | 201 | |
| 4 | 20 | 45 | 39,256 | 1,361,092 | 362 | 3,456 | |
| 5 | 30 | 81 | > 60,000 (stopped) | – | – | – |

The input grows like ; the resolvents generated grow ×40, ×67, ×170 per extra hole. This is not a weakness of our implementation:
Theorem (Haken 1985). Every resolution refutation of contains clauses.
Resolution reasons clause by clause and cannot express “count the pigeons”. Since the search of DPLL and CDCL can be read as resolution proofs (Lectures 4–5), no such solver can be fast on these formulas. Stronger proof systems (cutting planes, extended resolution) have short pigeonhole proofs; Lecture 3 places them in a hierarchy.
6.7 Proofs as DAGs, proofs as trees
A derived clause can be used many times. Written as a DAG, it is derived once; written as a tree, it is re-derived at every use. The two shapes correspond to two classes of solvers: a DPLL search tree yields a tree-like refutation (Lecture 4), a CDCL run a DAG-like one (Lecture 5). Script 03 (Part 5), on random unsatisfiable 3-CNF with 7 clauses per variable (averages over 5 instances):
| vars | clauses | kept by saturation | proof steps (DAG) | proof steps (tree) | tree / DAG |
|---|---|---|---|---|---|
| 6 | 42 | 139 | 17.0 | 29.2 | 1.67 |
| 8 | 56 | 273 | 25.6 | 61.4 | 2.34 |
| 10 | 70 | 510 | 34.4 | 170.2 | 5.14 |
| 12 | 84 | 827 | 38.2 | 194.4 | 4.64 |
The refutations are a small fraction of what saturation keeps — most of the search is wasted on clauses the proof never uses — and the tree versions are several times longer. On the pigeonholes the gap reached ×9.5 (3,456 vs 362 steps at ). It is known that tree-like resolution can require exponentially longer proofs than general resolution on some families, one theoretical reason why CDCL beats DPLL.
Run it.
python3 03_resolution.py(about 12 seconds).
7. The Davis–Putnam procedure
7.1 Four satisfiability-preserving transformations
Davis and Putnam (1960) gave the first procedure that did something smarter than truth tables. It repeatedly applies four transformations, each of which preserves satisfiability (not equivalence):
| transformation | premise | effect | justification |
|---|---|---|---|
| unit propagation (1-literal rule) | a unit clause | remove every clause containing ; remove from every other clause | must be true: clauses with are satisfied, can no longer help |
| pure-literal elimination | occurs, does not | remove every clause containing | any model can be changed to make true without breaking a clause |
| tautology elimination | remove | is true in every interpretation | |
| elimination by resolution | occurs positively and negatively | replace by all non-tautological resolvents on | the elimination lemma (§6.3) |
The first two shrink the set; the third removes useless clauses; the fourth removes a variable for good but may multiply clauses. Repeated, they end either with (UNSAT) or with (SAT).
Script 04 (Part 1) replays the slides’ examples. Unit propagation (the slide prints the second clause as , but its stated result requires , so we use that):
start {p1}, {¬p1, p4}, {¬p1, p2, p3}
UP p1 {p4}, {p2, p3}
UP p4 {p2, p3}
Elimination of : becomes . The slides ask: if a variable occurs positively in 3 clauses and negatively in 3, how many clauses after elimination? Up to , replacing 6.
The slides’ two complete runs:
DP example 1 DP example 2
start {¬p2, p5}, {p1, p2, p3}, {p2, ¬p3, ¬p6} start {p1, p2}, {p1, ¬p2}, {¬p1, p3}, {¬p1, ¬p3}
Res p2 {p1, p3, p5}, {¬p3, p5, ¬p6} Res p2 {p1}, {¬p1, p3}, {¬p1, ¬p3}
Res p3 {p1, p5, ¬p6} UP p1 {p3}, {¬p3}
PL p1 ∅ -> SAT Res p3 {} -> UNSAT
Our automatic strategy (unit propagation first, then pure literals, then the cheapest elimination) finishes example 1 with three pure literals and no resolution at all.
7.2 A model, not just “SAT”
DP never assigns variables, so where does a model come from? From the records of the run, undone in reverse order:
- a unit or pure literal : make true;
- an eliminated variable : give still-unassigned variables of its removed clauses the value false, then choose the value of that satisfies all of . One exists: the resolvents, which later steps have already satisfied, say exactly that (the (⇐) direction of the lemma, now run as an algorithm).
On example 1 this gives . Script 04 (Part 2) checks DP on 2,000 random clause sets: both elimination orders agreed with the truth table 2,000/2,000 times, and all 1,241 reconstructed models satisfied their input. The same reconstruction is used by modern preprocessors that eliminate variables before search.
7.3 The memory explosion
Each elimination replaces clauses by up to : a quadratic step, repeated once per variable. The slides warn that for large formulas this “can quickly exhaust the available memory”. Script 04 (Part 3) measures the peak number of clauses DP holds, on random 3-CNF, for two densities and two elimination orders: min_product eliminates the variable with the fewest possible resolvents first; first uses a fixed order. Runs are stopped (B) before an elimination that would push the total number of clause pairs combined above 2,000,000.
| clauses/var | order | vars | outcome (3 instances) | peak clauses |
|---|---|---|---|---|
| 2 | min_product | 20 / 60 / 100 | all SAT | 40, 40, 40 / 120, 120, 403 / 200, 1,636, 200 |
| 4.26 | min_product | 10 | S S S | 78, 66, 61 |
| 4.26 | min_product | 15 | S S U | 503, 468, 602 |
| 4.26 | min_product | 20 | S U S | 2,047, 1,953, 2,972 |
| 4.26 | min_product | 25 | B B B | > 8,798, > 6,947, > 6,855 |
| 2 | first | 20 | S S S | 83, 88, 238 |
| 2 | first | 30 | S B S | 566, > 9,072, 786 |
| 2 | first | 40 | B B B | > 13,655, > 10,565, > 7,010 |
| 4.26 | first | 15 | S S B | 1,748, 2,482, > 5,005 |

Three lessons:
- Sparse instances are easy. At 2 clauses per variable with a good order, the peak is usually the input itself, even at 100 variables (one instance peaks at 1,636 clauses): most eliminations remove more clauses than they add.
- Dense random instances explode. Near 4.26 clauses per variable — the hardest region for random 3-SAT, as Lecture 4 will measure — the peak grows 4 to 8 times per 5 extra variables, and at 25 variables every run exceeds the budget.
- The order matters as much as the instance. On the same instances, the fixed order is stopped at 40 variables where
min_productneeds at most 208 clauses. Finding the best order is NP-hard: the cost of DP is governed by the induced width (treewidth) of the variable graph along the elimination order (Dechter and Rish 1994), so practical tools use greedy heuristics.
7.4 Where DP shines, and where it drowns
Script 04 (Part 4):
| instance | clauses | status | unit steps | eliminations | peak clauses |
|---|---|---|---|---|---|
| implication chain, 1,000 vars | 1,001 | UNSAT | 1,000 | 0 | 1,001 |
| pigeonhole, 3 holes | 22 | UNSAT | 1 | 11 | 22 |
| pigeonhole, 4 holes | 45 | UNSAT | 1 | 19 | 113 |
| pigeonhole, 5 holes | 81 | UNSAT | 1 | 29 | 2,402 |
| 8-bit adder miter (Tseitin) | 276 | UNSAT | 2 | 96 | 348 |
| 16-bit adder miter (Tseitin) | 572 | UNSAT | 2 | 200 | 828 |
| 32-bit adder miter (Tseitin) | 1,164 | UNSAT | 2 | 408 | 1,788 |
- Implication chains need unit propagation only.
- The adder miters — hopeless for truth tables beyond about 12 bits in Lecture 1 — are decided with a peak at most 1.6 times the input, even at 32 bits. Circuits are “thin”: every variable meets only a few others, so a greedy order keeps every elimination small. This is DP’s strength.
- Pigeonholes are its weakness: every variable meets many others, and the peak grows ×5 from 3 to 4 holes and ×21 from 4 to 5. DP is a resolution procedure, so Haken’s bound applies.
Notice the contrast with saturation (§6.6): on , saturation kept 39,256 clauses; DP never held more than 113. A good strategy for applying the same rule makes an enormous difference — a theme of Lecture 3.
7.5 From DP to DPLL, and DP today
DP keeps the whole, growing problem in memory. Davis, Logemann and Loveland (1962) replaced the elimination step with splitting: choose a literal , check recursively, and if that fails, check . The unit clause immediately triggers unit propagation. Memory stays linear; the price is backtracking time. That procedure, DPLL, is Lecture 4, and its descendant CDCL is Lecture 5.
Variable elimination did not disappear. Modern solvers run it as preprocessing, eliminating a variable only when that does not increase the number of clauses (“bounded variable elimination”, Eén and Biere 2005, as reported in the SAT literature), and reconstruct the model exactly as in §7.2.
Run it.
python3 04_davis_putnam.py(about 6 seconds).
8. Modeling with clauses
Clauses are a modeling language. Most encodings combine a few patterns, provided by sat_families.py:
Cardinality constraints. “At least one of ” is one clause. “At most one” has two standard encodings:
| encoding | new variables | clauses | idea |
|---|---|---|---|
| pairwise | 0 | for every pair | |
| sequential counter (Sinz 2005) | = “one of the first is true”; a true forbids every earlier one through |
Both have the same models on (the second after projecting away the , checked by truth table for in sat_families.py). The sequential one is equisatisfiable in the sense of §4: linear instead of quadratic, at the cost of new variables.
Benchmark families used from now on:
| family | variables | clauses | satisfiable? |
|---|---|---|---|
| pigeonhole | never | ||
| graph -coloring | depends on the graph | ||
| -queens | “exactly one per row, at most one per column and diagonal” | for and | |
| 9 × 9 Sudoku | 729 | 11,988 + one unit clause per given | for a proper puzzle |
| random -CNF | , each over distinct random variables | likely iff is small | |
| adder miters | about 14 per bit | about 40 per bit (Tseitin) | iff the adders differ |
Testing an encoding the way Lecture 1 did — counting its models and comparing with an independent count — catches most mistakes. The self-test of sat_families.py does this: -queens has 1, 0, 0, 2 solutions for , a triangle has 6 proper 3-colorings and no 2-coloring, the 3-bit adder miter is unsatisfiable and its buggy version is not.
9. Summary
- Normal forms give reasoning engines a small, uniform input language. NNF, DNF and CNF exist for every formula, but the equivalent DNF and CNF can be exponentially larger; NNF is linear except under ⇔.
- For some formulas the blow-up is unavoidable: every CNF of parity has clauses. DNF makes satisfiability trivial, which is exactly why its conversion must be expensive.
- Equisatisfiability is enough for SAT. Tseitin’s transformation names every subformula, adds a fixed handful of clauses per name, and gives a linear-size clause set whose models project exactly onto the models of the input (full Tseitin even preserves the count). Plaisted–Greenbaum keeps only the direction the polarity needs.
- To decide validity with a SAT solver, encode the negation: iff is unsatisfiable.
- Clause sets have a standard vocabulary (unit, Horn, tautology, subsumption; is unsatisfiable, satisfiable) and a standard file format, DIMACS.
- Resolution is one sound rule that is refutationally complete; saturation turns it into a decision procedure. Refutations are certificates: easy to check by an independent program.
- Unit resolution is fast and complete for Horn clauses but incomplete in general; DPLL completes it with splitting.
- Davis–Putnam eliminates variables by resolution, propagates units and pure literals, and reconstructs a model. It shines on thin, structured instances (adders) and drowns in memory on dense ones; the elimination order is crucial.
- Pigeonhole formulas need exponentially long resolution proofs (Haken): a limit for every resolution-based solver, measured here on saturation and DP.
10. Common pitfalls
| Pitfall | Why it is wrong | Correct view |
|---|---|---|
| “Tseitin’s output is equivalent to the input” | It has new variables; an interpretation of the old ones can be extended wrongly | It is equisatisfiable; models project onto models (§4.3) |
| Checking validity as “is valid?” | is never valid if it names anything (all 226 valid formulas tested) | Check that is unsatisfiable (§4.5) |
| Confusing and | One is a clause, the other a clause set | : unsatisfiable; : satisfiable (§5.1) |
| Resolving on two pivots at once | is satisfiable | One pivot per step; double clashes give tautologies (§6.1) |
| “Resolution derives every consequence” | From it derives nothing, though | It is refutationally complete: it derives from every unsatisfiable set |
| “Unit propagation decides SAT” | It cannot even start without a unit clause | Complete only for Horn clauses; DPLL adds splitting |
| Expecting a smarter algorithm to find a small CNF for parity | Every equivalent CNF has clauses (§3.3) | Use Tseitin (21 clauses for 6 variables) |
| Converting to DNF to “solve” SAT | The DNF itself can be exponential ( cubes) | DNF-SAT is easy because the conversion is hard |
| Believing DP’s cost depends only on the instance | Fixed order: stopped at 40 variables; greedy order: ≤ 208 clauses on the same instances | The elimination order (treewidth) decides |
Naming a module encodings.py (or random.py, logic.py in another project…) | A standard-library module of the same name wins | Choose names that do not shadow the standard library |
11. Exercises
Answers are collapsed; try each exercise first.
1. (normal forms) Convert to NNF, then to CNF and to DNF by the rewrite rules. Check with rewrite_trace(parse("..."), CNF_RULES) and cnf_by_distribution.
Answer
NNF: becomes , and becomes , so the NNF is .
CNF: the rewrite rules alone give four clauses, . Removing the repeated literals in the third and the tautological fourth clause (what cnf_by_distribution does) leaves . The first clause is even subsumed by the third, so is an equivalent, smaller CNF.
DNF: , after dropping the contradictory cubes and .
2. (termination) In the weight of §2.2, why must be exponential in ? Try and find the rule that fails. Then explain why the definition must be strictly increasing in each argument.
Answer
With , De Morgan maps , of weight , to , of weight : the weight increases, because the single ¬ became two. The exponential makes one ¬ above a large subformula cost more than two ¬ above its halves (). Strict monotonicity is needed because rules are applied inside a context: if ignored, say, the left argument of ∧, a rewrite inside it would not change the total weight, and the argument would not show that the whole formula gets lighter.
3. (lower bound) Prove that every CNF equivalent to has at least clauses.
Answer
For every choice of one variable from each pair , let make the chosen variables false and the others true. Every pair then has a false member, so falsifies the formula, hence some clause of the CNF. We show that different choices give different clauses. Suppose one clause is false under both and , with ; pick a pair where they differ, say is false in and true in (and the opposite). A false clause contains no true literal, so contains none of (each is true under one of the two interpretations). Now change by making both and true: the result satisfies the formula (pair is true), but , which does not mention , is still false — so the CNF is false there, contradicting equivalence. Hence the clauses are pairwise distinct. ∎
4. (Tseitin) Give the Tseitin clauses for and for an -ary . How many clauses does a -ary AND need with binary ANDs instead?
Answer
: (the ⇔ pattern with negated). : for each , plus : clauses, one new variable. With binary ANDs: new variables and clauses. Solvers prefer the -ary form.
5. (Tseitin vs PG) Show by a concrete formula that Plaisted–Greenbaum does not preserve the model count. Why does that not hurt satisfiability?
Answer
Take , both subformulas positive. Name for and for . PG keeps only “name ⇒ definition”: and the root . Under , both and satisfy all clauses: one model of , two models of the clauses. (Full Tseitin adds , which forces .) Satisfiability is not hurt: a model of extends by giving every name the value of its subformula; conversely, in any model of the PG clauses a true name forces its subformula true, and since the names occur only positively, the original formula is at least as true as the clauses claim.
6. (validity) A colleague checks that a 32-bit multiplier is commutative by running a SAT solver on and reports “SAT, so it is correct”. What is wrong?
Answer
Satisfiability of the property only shows that some input makes the outputs equal (e.g. ). Correctness is validity: the right query is , and the expected answer is UNSAT; a SAT answer would come with a counterexample input.
7. (resolution) Refute by resolution. Check your proof with check_refutation.
Answer
From and on : . With the three implications form a cycle , so all three variables are equal. From and : ; with : . Then with : ; with : . From and : ; with : ; with : . Eight resolution steps. Shorter refutations exist: saturate finds one with 5 steps — print it with format_refutation.
8. (proof) Prove the elimination lemma’s (⇐) direction for the case where all resolvents are tautologies.
Answer
Then . Let satisfy it. If some has false under , then for every the (tautological) resolvent contains a complementary pair , , and is false, so is true: every is true; set true. Otherwise every is true; set false. Either way is satisfied.
9. (Horn) Prove that unit resolution is refutationally complete for Horn clauses.
Answer
Saturate under unit resolution without deriving . Let be the set of variables with a unit clause ; define iff . Take any clause . If contains a negative literal with , it is satisfied. Otherwise all its negative literals have derived; resolving with these units leaves either (impossible: we assumed it was not derived) or the single positive literal of (Horn: at most one), which is then a unit, so and is satisfied. So is a model, i.e. if the set is unsatisfiable, unit resolution derives .
10. (DP) Run DP by hand on eliminating , then , then . How many clauses at each stage? Then reconstruct a model or explain why none exists.
Answer
Eliminate : (4). Eliminate : (3). Unit propagation of (or eliminate ): , then : UNSAT. No model. (Indeed forces , and forces both and .)
11. (encoding) Encode “exactly two of are true” as clauses without new variables. How many clauses? Verify by counting models (there must be ).
Answer
“At most two”: for every 3-subset, (4 clauses). “At least two”: for every 3-subset, (if at most one were true, some 3-subset would be all false) — 4 clauses. Total 8 clauses, 6 models. count_models_cnf(make_cnf([...])) confirms.
12. (sequential counter) Prove that the sequential at-most-one encoding forbids for , and allows every assignment with at most one true .
Answer
If is true then is true (), and ; the clause then forbids . Conversely, if only is true (or none), set true exactly for (none if no is true): every clause holds.
13. (programming) Add backward subsumption to saturate: when a new clause is kept, delete every kept clause that has not been used yet. Measure kept clauses and time on . Is the procedure still complete?
Answer
Completeness is preserved (a subsumed clause is redundant). Implementation detail: deleted clauses may already be cited by the proof, so either keep them for proof extraction but skip them in later resolution steps, or delete only clauses that have not been used yet. The kept-clause count on should drop; measure by how much. The exponential growth itself (Haken) cannot go away.
14. (programming) davis_putnam chooses variables by min_product. Implement min_degree (the variable occurring in the fewest clauses) and compare peak clauses on the instances of script 04, Part 3.
Answer
Add a branch to choose_elimination_var computing counts[v] + counts[-v]. On sparse random instances both heuristics behave similarly; near 4.26 clauses per variable the product-based one usually keeps the peak lower, because it accounts for both sides of the elimination. Report what you measure.
12. Further reading
- Textbooks
- A. Bradley, Z. Manna, The Calculus of Computation, Springer 2007, §1.6 (normal forms), §1.7 (equisatisfiability, resolution, DPLL).
- D. Kroening, O. Strichman, Decision Procedures, 2nd ed., 2016, Ch. 1 (Tseitin’s encoding in §1.3) and Ch. 2.
- A. Biere, M. Heule, H. van Maaren, T. Walsh (eds.), Handbook of Satisfiability, 2nd ed., IOS Press 2021: Ch. 2 (CNF encodings, by S. Prestwich), Ch. 7 (proof complexity, by S. Buss and J. Nordström), Ch. 9 (preprocessing, by A. Biere, M. Järvisalo and B. Kiesl).
- D. Knuth, The Art of Computer Programming, Vol. 4B (2022), “Satisfiability”: encodings, resolution, and the pigeonhole problem.
- Papers mentioned
- G. Tseitin, “On the complexity of derivation in propositional calculus”, 1968 (English translation 1983).
- D. Plaisted, S. Greenbaum, “A structure-preserving clause form translation”, Journal of Symbolic Computation, 1986.
- M. Davis, H. Putnam, “A computing procedure for quantification theory”, Journal of the ACM, 1960.
- M. Davis, G. Logemann, D. Loveland, “A machine program for theorem-proving”, Communications of the ACM, 1962.
- J. A. Robinson, “A machine-oriented logic based on the resolution principle”, Journal of the ACM, 1965.
- A. Haken, “The intractability of resolution”, Theoretical Computer Science, 1985.
- W. Dowling, J. Gallier, “Linear-time algorithms for testing the satisfiability of propositional Horn formulae”, Journal of Logic Programming, 1984.
- R. Dechter, I. Rish, “Directional resolution: the Davis–Putnam procedure, revisited”, KR 1994.
- N. Eén, A. Biere, “Effective preprocessing in SAT through variable and clause elimination”, SAT 2005.
- C. Sinz, “Towards an optimal CNF encoding of Boolean cardinality constraints”, CP 2005.
- Slides: C. Tinelli, Normal Forms in Propositional Logic and Decision Procedures for Satisfiability in Propositional Logic, Iowa CS:4980, Spring 2024 (adapted from Stanford CS 257 slides by Barrett, Trippel and Wu).
13. Next lecture
Lecture 3 (Proof systems, guest lecture by Clark Barrett) steps back and asks what all these procedures have in common.
- Truth tables, semantic arguments, resolution saturation and DP are all proof systems: states, rules with premises and conclusions, derivation trees.
- What must be proved before such a system can be trusted: soundness (rules preserve satisfiability), completeness, termination — and how a strategy turns non-deterministic rules into an algorithm (the gap between saturation and DP on the pigeonholes is a strategy effect).
- Proof systems as certificates: the Cook–Reckhow definition, a checker for Hilbert-style proofs, and a comparison of proof sizes across systems.
- Code:
proof_systems.pyimplements rules as functions on states, explores all derivations of small states to check soundness, completeness and termination by machine, and replays the lecture’s examples.