Maps to: Stanford CS 257 Introduction to Automated Reasoning (Winter 2026), Lecture 10 · Thu 02/05/2026 · First-order theories: overview and DPLL(T) (Hanna Lachnitt). The take-home midterm covers Lectures 1–10. Reading: Bradley & Manna (CC) Chapter 3 (first-order theories); congruence closure is CC Chapter 9. Basis: The Stanford slides are on Canvas and not public. This lecture follows two public Iowa decks (CS:4980, Cesare Tinelli, Spring 2024), which say they are adapted from slides by Clark Barrett, Caroline Trippel and Andrew (Haoze) Wu (Stanford):
- the second half of Satisfiability Modulo Theories: common theories, quantifier-free fragments;
- Combining Theory Solvers with SAT Solvers: eager and lazy approaches, the very lazy loop, the CDCL(T) rules, theory propagation, the architecture.
The third Iowa deck on theory solvers (congruence closure) is not machine-readable, so §3 is written from CC Chapter 9 and from Nieuwenhuis and Oliveras (2005, 2007). “The slides” below means the Iowa decks.
These notes add:
- a small SMT solver,
smt.py, on top of Lecture 5’s CDCL solver: Boolean abstraction, congruence closure with explanations and backtracking, the very lazy loop, online CDCL(T) with three levels of theory propagation, and Ackermann’s eager reduction;- the slides’ derivations reproduced by the code;
- families where every approach struggles (diamonds, translation validation);
- checkable answers: models re-evaluated on the input, refutations checked by DRUP plus an independent check of every theory lemma.
The experiments and their code were designed for these notes and do not reflect what was said in class. Code:
code/lecture10/(4 scripts + 1 module; Python standard library only; 1 to 20 seconds each) Reading time: 3–4 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Name the common SMT theories and say what “quantifier-free fragment” means, and why SMT focuses on it.
- Build the Boolean abstraction of a formula and explain why it over-approximates.
- Decide a conjunction of EUF literals by congruence closure, and explain an equality or a conflict.
- Run the very lazy SMT loop and say why blocking with explanations beats blocking with models.
- State the CDCL(T) rules T-CONFLICT, T-PROPAGATE and T-EXPLAIN, and trace them on an example.
- Say what a theory solver must provide (incremental, backtrackable, explaining, propagating).
- Perform Ackermann’s reduction with transitivity constraints, and compare eager and lazy SMT.
- Check an SMT solver’s answers: models by evaluation, refutations by DRUP plus theory-lemma checks.
0.2 Prerequisites and scope
| Assumed | Introduced here | Developed later |
|---|---|---|
| CDCL, learning, backjumping, DRUP (Lecture 5) | CDCL(T), theory lemmas, theory propagation | — |
| first-order theories, T-validity (Lecture 8) | the SMT theories, quantifier-free fragments | arithmetic (Lectures 11–12), arrays and strings (13), bit-vectors (16) |
| Tseitin (Lecture 2) | Boolean abstraction | — |
| equality, functions (Lectures 6–8) | congruence closure, Ackermann’s reduction | combining theories (Lecture 18) |
0.3 Map
§1 first-order theories for SMT ← code 01
§2 from formulas to conjunctions: DNF, the Boolean abstraction, eager vs lazy ← code 01
§3 congruence closure: deciding EUF conjunctions, with explanations ← code 02
§4 the very lazy approach ← code 03
§5 CDCL(T) ← code 03
§6 the eager approach: Ackermann's reduction; hard families ← code 01, 04
§7 applications and trust: translation validation, certificates ← code 04
§8 summary §9 common pitfalls §10 exercises §11 further reading §12 next lecture
0.4 Notation
| Symbol | Meaning |
|---|---|
| , | a theory and entailment in it (Lecture 8) |
| EUF () | equality with uninterpreted functions: all interpretations of the signature |
| the propositional variables of the atoms (the slides’ numbering); | |
| , , | CDCL states: trail, clause set, conflict clause (Lecture 5) |
| and are in the same congruence class | |
| the representative of ‘s class |
0.5 The code of this lecture
One module, smt.py:
parse(Lecture 6’s parser) andAbstraction: atoms, the skeleton, and its clauses. A skeleton that is already a CNF keeps its clauses, so the numbering matches the slides; anything else goes through Tseitin.CongruenceClosure: union-find, signature table, use lists, proof-forest explanations, backtracking by an undo log.EUF: a theory solver with three levels of disequality propagation.lazy_offline: the very lazy loop, blocking whole models or explanations.CDCLT: Lecture 5’sCDCLSolver, subclassed with theory hooks, plussolve(formula, ...).ackermannandsolve_eager: the eager approach.check_model_euf,naive_euf_unsatandcheck_unsat: certificates.- the benchmark generators
diamond,random_eufandhoisting.
1. First-order theories for SMT
1.1 Why theories
Lecture 8 ended with theories: a signature plus a class of intended interpretations. In practice the questions are of this kind:
- “can
i + 1 > nhold on this path whilea[i]is read?”; - “do these two circuits, written with 64-bit adders and memories, compute the same thing?”
Bit-blasting everything into SAT is possible, as Lecture 9 did for small counters, but it loses structure:
- a 64-bit multiplier becomes thousands of clauses;
- an array becomes as many variables as it has cells;
- "" becomes a hard SAT problem when it is a one-line contradiction for an arithmetic procedure.
Satisfiability modulo theories keeps the theory atoms as they are and decides them with specialized procedures.
1.2 The common theories
The slides list the theories SMT has traditionally focused on. These are theories whose quantifier-free fragment is decidable, often efficiently:
| theory | signature | intended models | satisfiability of the quantifier-free fragment (as the slides state) |
|---|---|---|---|
| EUF, the “empty theory” | any symbols, = | all interpretations | decidable, conjunctions in polynomial time (congruence closure); with quantifiers: only semi-decidable (it is FOL) |
| reals, | , numerals | the real numbers | full theory decidable (doubly exponential); linear fragment: conjunctions in polynomial time |
| integers, | , numerals | the integers | not even semi-decidable with (Hilbert’s tenth problem); linear (Presburger) decidable, worst case triply exponential |
| arrays, | read, write | read-over-write axioms (+ extensionality) | full theory undecidable; several decidable fragments |
| bit-vectors, strings, … | — | — | Lectures 13, 16 |
A fragment is a syntactic restriction:
- the quantifier-free fragment: no quantifiers; free symbols act as constants;
- the linear fragment of arithmetic: multiplication only by numerals.
As in propositional logic, is -valid iff is -unsatisfiable. SMT solvers therefore speak only of satisfiability.
EUF in examples. EUF interprets = as equality and leaves every function symbol uninterpreted: may be any function. Script 01, Part 1:
| formula φ | φ | ¬φ | so φ is |
|---|---|---|---|
| (the slides) | UNSAT | SAT | unsatisfiable |
| UNSAT | SAT | unsatisfiable | |
| UNSAT | SAT | unsatisfiable | |
| SAT | UNSAT | valid | |
| SAT | SAT | satisfiable: need not be injective |
A model of an EUF formula is a partition of its terms into classes, with every function mapping classes to classes consistently. For the model is the classes , , .
Why “uninterpreted” is useful. If a property holds for every , it holds for the real as well. Verification tools exploit this. They replace a complicated operation (a multiplier, a hash function, a floating-point unit) by an uninterpreted symbol, keeping only “equal inputs give equal outputs”. §7 shows an example.
2. From formulas to conjunctions
2.1 Theorem 1: DNF
Theory solvers decide conjunctions of literals. The slides’ Theorem 1 says this is enough.
Theorem 1. For every theory , -satisfiability of quantifier-free formulas is decidable iff -satisfiability of conjunctions of literals is decidable.
The proof: convert to DNF and check every disjunct. Correct, and exponential. Script 01, Part 3, on the diamond formulas
| n | atoms | DNF disjuncts | T-consistent |
|---|---|---|---|
| 4 | 17 | 16 | 0 |
| 10 | 41 | 1,024 | 0 |
Every one of the disjuncts must be refuted by the theory solver. The SAT solver’s job is to avoid this enumeration.
2.2 The Boolean abstraction
Replace every atom by a propositional variable. For the slides’ running example script 01, Part 2 prints:
| variable | atom |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 |
The skeleton is , with clauses .
Atoms are normalized first: and must get the same variable, otherwise only the theory would know they are related.
The skeleton has 3 models, and the theory refutes all of them:
| Boolean model | T-consistent? | T-inconsistent core |
|---|---|---|
| 1, ¬2, ¬3, ¬4 | no | 1, ¬2 |
| 1, ¬2, 3, ¬4 | no | 1, ¬2 |
| 1, 2, 3, ¬4 | no | 1, 3, ¬4 |
So the abstraction over-approximates:
- an unsatisfiable skeleton proves the formula unsatisfiable;
- a satisfiable skeleton proves nothing until the theory has checked the model.
2.3 Eager or lazy
The slides contrast two ways to use SAT technology:
| eager | lazy | |
|---|---|---|
| idea | translate into an equisatisfiable propositional formula; any SAT solver | SAT solver on the abstraction; a theory solver refines it |
| pros | the best SAT solver off the shelf | theory-specific reasoning; modular (a new theory = a new theory solver); scales much better |
| cons | care in encoding; tends not to scale | designing theory solvers is hard; the SAT solver needs extensions for a good interplay |
| systems (the slides) | UCLID | Bitwuzla, cvc5, MathSAT, Yices, Z3 |
§3–§5 build the lazy approach and §6 the eager one. Experiments on both, including a case where the eager one wins, are in §6.
3. Congruence closure
3.1 The problem
Given a conjunction of equalities and disequalities over terms with uninterpreted functions, is it satisfiable? The equalities generate the smallest relation that is:
- an equivalence (reflexive, symmetric, transitive);
- a congruence: if then .
The conjunction is satisfiable iff no disequality has . Then the classes themselves form a model.
Only the formula’s terms matter. Congruence closure computes the relation on the subterms of the input only. If is asserted and does not occur, nothing is said about it, and nothing needs to be.
3.2 The algorithm
CongruenceClosure follows Nelson and Oppen (1980) and Downey, Sethi and Tarjan (1980). It has five parts:
- Nodes. Every subterm is a node; an application knows its children.
- Union-find.
find(x)returns the representative of ‘s class. Merging links the smaller class under the larger, which keeps paths short. - Signatures. The signature of is . A table maps signatures to nodes, so congruent applications are found by one lookup.
- Use lists. When class is merged into , only the applications that use a member of can change signature. Only they are re-hashed, and any collision becomes a new pending merge.
- Disequalities are stored. After every merge they are checked.
Script 02, Part 1, on the slides’ example :
assert 1: a = b merge a, b classes: {a, b}
assert 2: f(a) = b merge f(a), b
merge g(f(a)), g(a) (congruence) classes: {a, b, f(a)}, {g(a), g(f(a))}
assert 3: g(a) ≠ g(f(a)) CONFLICT -- explanation: 2, 1, 3
3.3 Explanations
CDCL(T) needs more than “inconsistent”. It needs a small set of asserted literals that causes the inconsistency, because that set becomes a learned clause.
Every merge adds an edge to a proof forest, labelled with its reason:
- either an asserted equality (its tag);
- or a congruence (the two applications).
The edges of one class form a tree, so two equal terms are joined by a unique path. To explain :
- collect the tags on the path;
- for each congruence edge , explain recursively.
Bradley and Manna’s example (script 02, Part 2): from (tag A), congruence gives and . Adding (tag B) collapses everything into one class:
| equality | explained by |
|---|---|
| A, B | |
| A | |
| B |
The disequality (tag C) then conflicts with explanation {A, B, C}. That is the lemma , three literals however many merges happened.
3.4 Backtracking and cost
Inside CDCL(T) the theory solver must undo assertions whenever the SAT solver backjumps. Our closure never compresses paths and logs every change (unions, signature entries, disequalities), so undoing is popping the log (script 02, Part 3). Real solvers use the same “trail” idea as CDCL itself.
Cost (script 02, Part 4, random conjunctions with equalities over a tenth of the terms):
| terms | merges | by congruence | union-find | naive fixpoint |
|---|---|---|---|---|
| 400 | 47 | 7 | 0.001 s | 0.019 s |
| 800 | 94 | 14 | 0.001 s | 0.080 s |
| 1,600 | 203 | 43 | 0.002 s | (skipped) |
Both compute the same classes. The naive fixpoint compares every pair of applications in each pass; Downey–Sethi–Tarjan is .
Run it:
python3 02_congruence_closure.py(about 1 s), withfigures/02_cc_scaling.png.

4. The very lazy approach
The simplest combination uses the SAT solver and the theory solver as black boxes:
repeat:
M := SAT(clauses); UNSAT -> φ is T-unsatisfiable
if the atom literals of M are T-consistent -> φ is T-satisfiable
else add a blocking clause ¬(the T-inconsistent literals)
Script 03, Part 1, on the slides’ example:
| blocking clause = ¬(whole model) | blocking clause = ¬(theory explanation) | |
|---|---|---|
| SAT call 1 | 1, ¬2, ¬3, ¬4 → add {¬1, 2, 3, 4} | 1, ¬2, ¬3, ¬4 → add {¬1, 2} |
| SAT call 2 | 1, ¬2, 3, ¬4 → add {¬1, 2, ¬3, 4} | 1, 2, 3, ¬4 → add {¬1, ¬3, 4} |
| SAT call 3 | 1, 2, 3, ¬4 → add {¬1, ¬2, ¬3, 4} | UNSAT |
| SAT call 4 | UNSAT |
With explanations the lemmas are exactly the slides’ and .
With whole models we need 4 SAT calls, the slides 3. The slides’ SAT solver returned the partial model . Ours assigns every atom, and a longer blocking clause excludes fewer models.
The loop has two weaknesses:
- The models. Whole-model blocking can enumerate exponentially many models.
- Restarts. Every SAT call starts from scratch and forgets what it learned.
On the diamonds of §6, whole-model blocking needs 50 SAT calls for , against 8 with explanations, and becomes impractical from on.
5. CDCL(T)
5.1 The rules
The slides extend abstract CDCL (Lecture 5) with three rules that consult the theory:
T-Conflict turns a T-inconsistent part of into a conflict clause, a theory lemma: valid in , so adding it is sound. T-Propagate adds literals the theory entails. T-Explain resolves a conflict clause with the lemma behind a propagated literal.
The slides’ correctness theorems carry over from CDCL:
| theorem | statement (the slides) |
|---|---|
| strong termination | an execution is finite if LEARN/FORGET are applied finitely often and RESTART with increasing periodicity |
| refutation soundness | ending in UNSAT means is T-unsatisfiable |
| refutation completeness | ending with = no means is T-satisfiable and |
5.2 How CDCLT implements them
CDCLT subclasses Lecture 5’s CDCLSolver and changes four things:
- After every unit-propagation fixpoint, the new atom literals on the trail are sent to the theory solver (
eager=True; witheager=Falseonly complete assignments are checked). - T-CONFLICT: the theory’s explanation becomes the clause , which is handed to the unchanged 1-UIP conflict analysis. If the conflict lies entirely below the current level (a theory checked late), the solver backjumps to the conflict’s level first.
- T-PROPAGATE: an entailed literal with explanation goes on the trail with the reason clause . Conflict analysis then resolves through it exactly as through an input clause. That is T-EXPLAIN, at no extra cost.
- Backjumping calls
theory.backtrack_to(trail length).
The slides’ warning applies: no pure-literal rule. A literal pure in the skeleton may still be forced by the theory.
5.3 The slides’ derivations, reproduced
Script 03, Part 2. Without T-PROPAGATE (the slides’ “better lazy approach”):
PROPAGATE 1 from clause {1}
PROPAGATE ¬4 from clause {¬4}
DECIDE •¬2 (level 1)
T-CONFLICT {¬1, 2}
LEARN+BACKJUMP {2}, back to level 0
PROPAGATE 3 from clause {3, ¬2}
T-CONFLICT {¬1, ¬3, 4}
CONFLICT on {¬1, ¬3, 4} at level 0 -> FAIL: UNSAT
With T-PROPAGATE (the slides’ “theory propagation example”):
PROPAGATE 1, ¬4
T-PROPAGATE 2 because 1 ⊨_T 2 (c = g(a) ⇒ f(c) = f(g(a)), by congruence)
T-PROPAGATE ¬3 because 1, ¬4 ⊨_T ¬3 (g(a) = c, c ≠ d ⇒ g(a) ≠ d)
CONFLICT on {3, ¬2} at level 0 -> FAIL: UNSAT
No decision at all: “T-propagation eliminates search altogether in this case” (the slides).
5.4 Equalities are cheap, disequalities are not
The slides’ exercise, , contrasts two levels of propagation. EUF offers three (script 03, Part 3):
| disequality propagation | decisions | conflicts | T-conflicts | T-propagations |
|---|---|---|---|---|
| none (slides’ Scenario 1) | 1 | 2 | 2 | 0 |
| simple: , for an asserted | 1 | 2 | 2 | 0 |
| full (slides’ Scenario 2) | 0 | 1 | 0 | 2 |
Entailed equalities are cheap. One find per side.
Entailed disequalities may need congruence. entails , because would force . The simple rule misses this.
The full rule tentatively asserts each unassigned equality, looks for a conflict, and undoes it. Its explanation for is just , smaller than the slides’ “1, ¬4”. It costs one tentative merge per unassigned atom per call.
Two small observations on the slides:
- With the “true first” decision phase, Scenario 1 reproduces the slides’ table line by line.
- The slides annotate its second T-CONFLICT “as 1, ¬3, ¬4 ⊨ ⊥”. The lemma refutes .
5.5 All variants on random formulas
Script 03, Part 4, 60 random EUF formulas (4 constants, 20 atoms, 80 clauses; 29 SAT, 31 UNSAT):
| configuration | SAT calls | conflicts | T-conflicts | T-propagations |
|---|---|---|---|---|
| very lazy, block models | 468 | 5,525 | 408 | 0 |
| very lazy, block explanations | 136 | 1,062 | 76 | 0 |
| CDCL(T), theory at complete assignments | 60 | 668 | 87 | 0 |
| CDCL(T), theory at every fixpoint | 60 | 656 | 96 | 0 |
| CDCL(T) + T-propagation (simple) | 60 | 592 | 66 | 134 |
| CDCL(T) + T-propagation (full) | 60 | 525 | 43 | 240 |
All six agree on all 60 formulas, and every model was checked against the input. On formulas this small, “eager” theory checks change little. Propagation converts theory conflicts into propagations.
5.6 What a theory solver must provide
The slides’ architecture slide, as implemented by TheorySolver:
| requirement | method | why |
|---|---|---|
| check T-satisfiability of conjunctions of literals | assert_lit, check | the core job |
| be incremental | assert_lit one literal at a time | the trail grows literal by literal |
| be backtrackable | backtrack_to(pos) | CDCL backjumps constantly |
| produce explanations | conflicts as lists of tags | conflicts become learned clauses |
| compute propagations | propagate() | guide the search |
| produce models | model(), value_of | for SAT answers and their check |
Lectures 11–13 provide exactly this interface for linear arithmetic (simplex), integers and arrays.
6. The eager approach
6.1 Ackermann’s reduction
The slides’ eager example, (script 01, Part 4):
- Eliminate functions (Ackermann 1954). Replace each application by a fresh constant, and , and add functional consistency: .
- Eliminate equalities. Introduce a propositional variable for each pair of constants (, and by naming), plus transitivity for every triple.
translated input: e1_2 ∨ ¬e2_3 (f#1 = a ∨ ¬(a = f#2))
functional consistency: e0_2 ⇒ e1_3 (b = a ⇒ f#1 = f#2)
transitivity (12 over 4 constants): e0_1 ∧ e1_2 ⇒ e0_2 ...
CDCL: SAT
The result is equisatisfiable with the input. With constants there are transitivity clauses: cubic. (The slides note “not all transitivity cases are needed”; sparse encodings exist.)
6.2 Diamonds: where eager wins
Script 04, Part 1:
| n | very lazy (explanations) | CDCL(T) conflicts | eager clauses | eager conflicts |
|---|---|---|---|---|
| 4 | 28 calls | 21 | 7,747 | 4 |
| 8 | 283 calls | 281 | 62,149 | 8 |
| 10 | – | 1,069 | 121,426 | 10 |
| 14 | – | 16,787 | 333,292 | 14 |
The lazy methods grow like ; the eager one needs exactly conflicts.
Why. CDCL(T)‘s proofs are resolution proofs over the input atoms plus theory lemmas over those atoms. Every lemma speaks about one way through the diamonds, and refuting all ways with such lemmas is exponential.
The eager encoding has a variable for every pair of constants, including . Its transitivity clauses derive that fact from either side of diamond , after which the proof is linear. The price is the cubic encoding: half a million clauses at .
Plan vs reality. The plan was to show that adding the atoms (as tautologies ) rescues CDCL(T). It does not: the conflicts are identical (281 at ). The theory solver’s explanations still mention only the original equalities, so no learned clause ever uses the new atoms. A short proof exists, but our solver never produces the lemmas it needs. Real solvers create new atoms inside the search, together with lemmas that mention them: splitting on demand (Barrett, Nieuwenhuis, Oliveras and Tinelli 2006), and the interface equalities of theory combination (Lecture 18).
6.3 When eager loses
On random formulas the roles flip. Every function application becomes a constant (27 to 38 per formula), and the transitivity constraints dominate. Script 04 runs the first 10 random formulas of script 03:
- CDCL(T) needs 0.03 s and 80 conflicts in all;
- the eager procedure needs 6.0 s and 100 conflicts, with 80,539 to 230,830 clauses per formula.
The hoisting family of §7 shows the same blow-up: 634,775 clauses for 6 stages. Neither approach dominates, which is why both survive. Solvers apply Ackermann’s reduction selectively; Z3, for example, has tactics that do it for bit-vector formulas.
7. Applications and trust
7.1 Translation validation
Did an optimizer preserve the meaning of a program? Pnueli, Siegel and Singerman (1998) check each compilation instead of the compiler. Script 04, Part 2 validates hoisting a common call out of a conditional:
original: x_{i+1} = if q(x_i) then f(g(x_i)) else f(h(x_i))
optimized: y_{i+1} = f(if q(y_i) then g(y_i) else h(y_i)) x_0 = y_0 = a; is x_n = y_n?
are uninterpreted. An UNSAT answer for therefore proves the optimization correct for every implementation of them:
| stages | CDCL(T) | decisions | conflicts | certificate | eager clauses |
|---|---|---|---|---|---|
| 2 | UNSAT | 6 | 4 | ok | 18,565 |
| 4 | UNSAT | 39 | 30 | ok | 177,670 |
| 6 | UNSAT | 160 | 131 | ok | 634,775 |
| 8 | UNSAT | 787 | 624 | ok | – |
The growth is exponential again, for the diamonds’ reason: the intermediate facts are not atoms. With the branches swapped in stage 1 the answer is SAT. The counter-model, a partition of the terms in which is false everywhere, is checked against the input.
7.2 Can we trust the answers?
SAT answers. Evaluate the input formula in the theory model. Re-evaluating the whole formula, not the clauses, also catches bugs in the abstraction and in Tseitin.
UNSAT answers. These split into two independent claims:
- Every theory lemma is -valid: its negation, a conjunction of literals, is unsatisfiable.
naive_euf_unsatre-checks each lemma with a deliberately simple fixpoint closure that shares no code withCongruenceClosure. - The propositional part. Lecture 5’s DRUP checker verifies that the proof derives the empty clause from the input clauses plus the lemmas.
Script 04, Part 3:
- 48 formulas: 19 SAT answers, all models checked;
- 29 UNSAT answers with 182 distinct theory lemmas, all re-checked, and every DRUP proof verified.
On the slides’ example the certificate is two lemmas, and , and the DRUP proof . Tampering with a lemma is caught: lemma (1, 2) is not T-valid.
Production solvers emit such proofs (cvc5 in the Alethe and LFSC formats, Z3 as proof objects). Checking the theory steps is the hard part.
8. Summary
- SMT decides quantifier-free formulas over theories: EUF, arithmetic, arrays, bit-vectors, strings. Theory solvers decide conjunctions of literals, and Theorem 1 (DNF) shows that suffices in principle, at exponential cost.
- The Boolean abstraction replaces atoms by variables. It over-approximates: the theory must check every candidate model.
- Congruence closure decides EUF conjunctions with union-find, signatures and use lists. Its proof forest yields small explanations, and an undo log makes it backtrackable.
- The very lazy loop blocks inconsistent models. Blocking explanations instead of models cut SAT calls from 468 to 136 on our random set.
- CDCL(T) adds T-CONFLICT, T-PROPAGATE and T-EXPLAIN to CDCL. Lemmas enter as conflict and reason clauses, so 1-UIP learning and backjumping work unchanged. On the slides’ example, theory propagation removes all decisions.
- Equality propagation is cheap; disequality propagation may need congruence (complete but costly).
- Eager SMT (Ackermann + transitivity) uses a plain SAT solver. It wins on diamonds ( conflicts against ) and loses badly when there are many function instances (cubic encodings).
- SMT answers can be certified: models by evaluation, refutations by DRUP plus independent theory-lemma checks.
9. Common pitfalls
- Forgetting to normalize atoms. and must get the same variable. Otherwise the SAT solver may set them differently, and only a theory check can repair it.
- Treating a SAT skeleton as SAT. The abstraction over-approximates; only a T-consistent model counts.
- Using the pure-literal rule in CDCL(T). A literal pure in the skeleton may still be forced by the theory.
- Blocking clauses that are too long. Whole models exclude almost nothing; explanations exclude every model that contains the inconsistent core.
- Explanations that are not subsets of the trail. Every literal of a theory lemma must be currently true, or the “conflict clause” is not conflicting. Axioms (such as ) must not appear in explanations.
- Theory conflicts found late. If the theory runs only at complete assignments, a conflict may lie entirely below the current decision level. Backjump to its level before analysing it.
- Ackermann without transitivity. The equality variables must form an equivalence relation, or UNSAT answers become wrong.
- Assuming a short proof means a fast solver. Diamonds have short proofs over the right atoms, and our CDCL(T) still needs conflicts.
10. Exercises
1. (congruence closure) Run congruence closure by hand on . Which merges happen, and what is the explanation of the conflict?
Answer
Nodes. , , , .
The merges.
- Asserting merges and .
- The signature of becomes , the same as that of . Congruence merges with , hence with .
The conflict. The disequality now conflicts. Its explanation is {, the disequality}: the congruence edge’s argument pairs are , explained by the asserted equality, and , which is trivial.
2. (abstraction) Why must be refuted by the theory and not by the SAT solver? Give its abstraction and its theory lemma.
Answer
The abstraction. Atoms 1: , 2: , 3: . The skeleton is satisfiable.
The theory step. EUF encodes as / . From , congruence merges and , so , a conflict.
The lemma. .
3. (very lazy) Prove that the very lazy loop with explanation blocking terminates. Bound the number of SAT calls.
Answer
Each call removes a model. Every blocking clause excludes the current model: it falsifies the model’s own literals.
The bound. There are at most assignments to the atoms, so the loop ends after at most that many calls. Explanations make each clause exclude many models at once, but the worst case stays exponential, as the diamonds show.
4. (CDCL(T)) In the slides’ example without propagation, why does conflict analysis learn the unit clause , and why is the backjump to level 0?
Answer
The conflict clause. The T-conflict clause is . Literal 1 is at level 0, and is the decision at level 1.
Learning. The clause has exactly one literal of the current level, so it is already asserting: 1-UIP learns it unchanged.
Learning a unit. Level-0 literals are left out of learned clauses, so the clause learned is .
The backjump. A unit learned clause backjumps to level 0, where 2 is propagated.
5. (propagation) Give an EUF conjunction where the “simple” disequality rule propagates something and an example where only the “full” rule does.
Answer
Simple. Assert and . The atom is then entailed false by the simple rule: , , and is asserted.
Full only. Assert with unassigned. Only a congruence argument shows that is entailed false, which is the slides’ exercise.
6. (Ackermann) Apply Ackermann’s reduction to . List the fresh constants, the functional-consistency constraints, and explain why the result is unsatisfiable.
Answer
Fresh constants. and .
Functional consistency. .
The translated input. .
Why it is unsatisfiable. From (symmetric), consistency gives , which contradicts .
7. (eager size) How many transitivity clauses does the eager encoding of diamond() contain? Check against script 01’s table for .
Answer
Counting the constants. : constants.
Counting the clauses. . For : and , as in the table.
8. (certificates) Why is it not enough to check the DRUP proof against the input clauses alone? What exactly does the lemma check guarantee?
Answer
Why the input alone is not enough. The input clauses are only the abstraction. They are usually propositionally satisfiable, and the refutation needs the theory lemmas as extra axioms.
What the lemma check adds. It proves each lemma -valid. So input ∧ lemmas is -equivalent to the input, and its propositional unsatisfiability implies the input’s -unsatisfiability.
9. (programming) Make the new atoms useful. When EUF.propagate finds an unassigned atom with , the reason clause already mentions it. Change explain so that, when an equality atom between two terms on the path is currently asserted, its tag is used for that segment instead of the original edges. Measure diamonds with the extra atoms .
Answer sketch
The change. Keep, for each asserted equality atom, its nodes. In _path (or in a post-pass), replace the sub-path between two nodes by the asserted tag whenever is asserted.
What to expect. Explanations then mention , and learned clauses can be about them. Measure whether the conflicts on diamonds drop from towards . This is related to the “explanation quality” problem studied by Nieuwenhuis and Oliveras.
10. (programming) Implement sparse transitivity for ackermann: build the graph whose edges are the equalities that occur, make it chordal (Bryant and Velev 2002), and add transitivity constraints only for its triangles. Compare clause counts on diamonds and random formulas.
Answer sketch
The graph. The vertices are the constants, and the edges are the pairs that occur after function elimination (input equalities and functional-consistency equalities).
Chordal completion. Eliminate vertices in some order (e.g. minimum degree), adding fill-in edges between the neighbours of each eliminated vertex.
The constraints. Add the three transitivity clauses for every triangle of the chordal graph.
What to expect. Correctness: an assignment that is transitive on a chordal graph extends to an equivalence relation. On diamonds the graph is nearly a path, and the count drops from cubic to linear.
11. Further reading
- G. Nelson, D. C. Oppen, “Fast Decision Procedures Based on Congruence Closure”, JACM 1980; P. Downey, R. Sethi, R. Tarjan, “Variations on the Common Subexpression Problem”, JACM 1980.
- R. Nieuwenhuis, A. Oliveras, “Proof-Producing Congruence Closure”, RTA 2005; and “Fast Congruence Closure and Extensions”, Information and Computation 2007.
- R. Nieuwenhuis, A. Oliveras, C. Tinelli, “Solving SAT and SAT Modulo Theories: From an Abstract Davis–Putnam–Logemann–Loveland Procedure to DPLL(T)”, JACM 2006: the abstract framework of the slides.
- C. Barrett, R. Nieuwenhuis, A. Oliveras, C. Tinelli, “Splitting on Demand in SAT Modulo Theories”, LPAR 2006.
- W. Ackermann, Solvable Cases of the Decision Problem, North-Holland 1954; R. E. Bryant, M. N. Velev, “Boolean Satisfiability with Transitivity Constraints”, ACM TOCL 2002.
- A. Pnueli, M. Siegel, E. Singerman, “Translation Validation”, TACAS 1998.
- C. Barrett, R. Sebastiani, S. Seshia, C. Tinelli, “Satisfiability Modulo Theories”, Chapter 33 of the Handbook of Satisfiability (2nd ed. 2021).
- D. Kroening, O. Strichman, Decision Procedures, Chapters 3 (equality and EUF) and 11 (DPLL(T)).
12. Next lecture
Lecture 11: linear real arithmetic and the simplex method. EUF needed union-find; arithmetic needs linear algebra.
- We build the general simplex method in the form SMT solvers use (Dutertre and de Moura 2006): bounds on variables, a tableau that never changes its constraints, Bland’s rule for termination, and Farkas explanations for conflicts.
- Strict inequalities need an infinitesimal δ.
- We plug it into
smt.pyas a theory solver, with the same interface asEUF.