Maps to: Stanford CS 257 Introduction to Automated Reasoning (Winter 2026), Lecture 7 · Tue 01/27/2026 · FOL: semantics, normal forms, resolution, unification I (Hanna Lachnitt). Reading: Bradley & Manna (CC) §2.2–2.5; Enderton (MI) §2.2 up to “Definability in a Structure”. Basis: The Stanford slides are on Canvas and not public. This lecture follows the 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 semantics half of First-order Logic: Syntax and Semantics;
- the first parts of Proof systems for First-order Logic: semantic arguments, PNF and clausal form, resolution with INST.
“The slides” below means those decks. Reused from them:
- interpretations, the term and formula semantics, the set-theory and family examples;
- entailment and validity, the entailment exercise;
- invariance, the deduction theorem, the free-variable theorems;
- the quantifier rules of semantic arguments and their three examples, the termination example;
- the transformation to clausal form with its running example; Skolemization;
- the INST rule and the unification-based resolvent example.
These notes add:
- a finite model finder that grounds formulas to propositional logic and calls Lecture 5’s CDCL solver;
- machine checks of every example, which find:
- a clause-form step order that is unsound for ⇔;
- a mislabelled rule on the termination slide;
- a precise reading of the people-slide typo;
- a tableau prover for FOL, tried on Pelletier’s problems;
- unification (Robinson; Martelli–Montanari), with the occurs check and exponential blow-up measured.
The experiments and their code were designed for these notes and do not reflect what was said in class. Code:
code/lecture07/(5 scripts + 2 modules; Python standard library only, matplotlib optional; from 2 to about 25 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:
- Define an interpretation of a signature, and compute the value of terms and the truth of formulas in it.
- Define satisfiability, validity, entailment and equivalence in FOL, and state the invariance, deduction and free-variable theorems.
- Find counter-models with a finite model finder, and explain why “no counter-model up to size n” is not a proof.
- Write semantic-argument proofs with the quantifier rules, and explain why proof search for FOL cannot always terminate.
- Transform a sentence into clausal form (NNF, prenex, PCNF, Skolemization), and explain why the result is only equisatisfiable.
- Compute a most general unifier, explain the occurs check, and say why unification, not instantiation, makes first-order resolution practical.
0.2 Prerequisites and scope
| Assumed | Introduced here | Developed later |
|---|---|---|
| FOL syntax, FV, capture-avoiding substitution (Lecture 6) | interpretations, truth, validity | theories: restricting the interpretations (Lecture 8, 10 on) |
| semantic arguments for PL (Lecture 1) | quantifier rules, FOL tableaux | Herbrand’s theorem (Lectures 8, 17) |
| CNF, Tseitin, CDCL (Lectures 2, 5) | finite model finding by SAT | bit-blasting, model checking (Lectures 9, 16) |
| resolution for PL (Lecture 2) | clausal form, unification | the resolution prover (Lecture 8) |
0.3 Map
§1 interpretations: giving the symbols a meaning ← code 01
§2 truth, validity, entailment, and the slides' theorems ← code 01, 02
§3 searching for models: a finite model finder built on CDCL ← code 02
§4 semantic arguments with quantifiers; why proof search may not terminate ← code 03
§5 normal forms: prenex, Skolem, clausal ← code 04
§6 unification ← code 05
§7 first-order resolution: the idea ← code 05
§8 summary §9 common pitfalls §10 exercises §11 further reading §12 next lecture
0.4 Notation
| Symbol | Meaning |
|---|---|
| , , , | an interpretation; the domain of sort σ, the function for , the value of |
| with interpreted as | |
| / | satisfies / falsifies |
| , , | entailment, validity, equivalence |
| a substitution; applies it | |
| mgu | most general unifier |
| the Skolem symbol for |
0.5 The code of this lecture
fol_semantics.py contains:
Structureandevaluate, plusterm_stepsfor step-by-step term evaluation;find_model, a finite model finder: grounding, symmetry breaking for constants, Tseitin (Lecture 2), CDCL (Lecture 5), and a re-check of every model;enumerate_structures, brute force for tiny cases;semantic_argument, a tableau prover with a fair strategy;- normal forms:
nnf,pnf_steps,skolemize,clausal_form.
unify.py contains:
- substitutions:
apply,compose,is_instance_of; - Robinson’s algorithm, in eager and triangular modes;
- Martelli–Montanari’s rules (
unify_mm), with a trace; match, and the blow-up family.
1. Interpretations: giving the symbols a meaning
A signature (Lecture 6) fixes vocabulary. An interpretation of Σ (and of a sort context Γ) fixes meaning:
- each sort σ gets a non-empty set , its domain;
- each function symbol of rank gets a total function ; predicates are functions into ;
- each variable in Γ gets an element .
Every interpretation also treats three things the same way: Bool is , ⊤ and ⊥ are fixed, and is identity. Equality is one of the few symbols with a built-in meaning.
One signature, many meanings. The slides interpret a small set-theory signature in two ways:
- : elements are numbers, sets are sets of numbers, and is ∈;
- : both sorts are numbers, and means ” divides ”.
Script 01 evaluates the same formulas in both, with the domains cut to 4 elements:
| formula | ||
|---|---|---|
| member(e1, s2) | true | false |
| member(e3, s2) | false | false |
| member(e0, s0) | true | true |
| ∃s:Set. ∀e:Elem. member(e, s) | true | true |
There are infinitely many interpretations of any signature. That is why “true” is never a property of a formula alone: it is a relation between a formula and an interpretation.
Two details that matter later.
- Domains are non-empty. So holds (§2).
- Functions are total. In the slides’ family signature, and must give a father and a mother to everyone. Script 01 completes the slides’ partial tables with ancestors, and in a finite domain someone must then be their own ancestor (the pigeonhole principle). Section 3 shows that “everyone has a father and a mother” is therefore a valid sentence: a fact about the logic, not about families.
2. Truth, validity, entailment
Terms are evaluated from the inside out: is given, and . Script 01 reproduces the slides’ family example:
pa(ma(x)) = pa(ma(Jim)) = pa(Jill) = Jay
Formulas follow the propositional rules for the connectives, plus two new clauses:
fol_semantics.evaluate is exactly this definition. Over a finite domain, the quantifier clauses become a loop. Over an infinite domain they cannot be computed: this is the first sign of undecidability.
Definitions.
- Satisfiable: some satisfies .
- Valid: every satisfies .
- Entailment : every that satisfies all of Φ also satisfies α.
- Equivalence : each entails the other.
As in propositional logic, α is valid iff ¬α is unsatisfiable.
The slides’ exercise (script 01) asks for interpretations that satisfy three formulas. The script counts all structures of sizes 1–3 for one binary predicate , and asks the model finder for the smallest model:
| formula | satisfying structures, size 1 / 2 / 3 | smallest model |
|---|---|---|
| ∀x. ∀y. x = y | 2/2, 0/16, 0/512 | size 1 (any Q) |
| ∀x. ∀y. Q(x, y) | 1/2, 1/16, 1/512 | size 1, Q everywhere |
| ∀x. ∃y. Q(x, y) | 1/2, 9/16, 343/512 | size 1, Q(0,0) |
| ∀x. ∃y. (Q(x, y) ∧ x ≠ y) | 0/2, 4/16, 216/512 | size 2 |
The slides’ theorems. Script 01 checks each instance on random formulas over all 132 structures of sizes 1–2 of a small signature:
| theorem | instances checked | held |
|---|---|---|
| Invariance: if , agree on Σ and on FV(α), then | 71,383 | 71,383 |
| Deduction: iff | 150 | 150 |
| Free variables 1: | 61 | 61 |
| Free variables 2: | 61 | 61 |
This is evidence, not proof. ⊨ ranges over all interpretations, including infinite ones, and the slides prove the theorems by structural induction. A failure would have proved a bug, which makes such checks cheap insurance.
Invariance has an important corollary: the truth of a sentence does not depend on the variable assignment.
3. Searching for models
3.1 A finite model finder built on SAT
To show that , it suffices to exhibit one interpretation that satisfies Φ and falsifies α: a counter-model. If one exists with a finite domain, it can be found by trying sizes 1, 2, 3, …
For a fixed domain , everything unknown about a structure is a finite table. Ground the formulas into propositional logic (Grounder):
- Predicates: one Boolean variable for each predicate and argument tuple .
- Functions: one Boolean variable for each function , argument tuple and candidate value . Constraints say that exactly one candidate value holds per argument tuple: functions are total and single-valued.
- Quantifiers: becomes a conjunction over the domain, a disjunction.
- Nested terms: a term like is evaluated symbolically, case by case on the possible values of .
- Equality of two domain elements is just identity.
The resulting propositional formula goes through Tseitin’s transformation (Lecture 2) to Lecture 5’s CDCL solver. A model is decoded into a Structure and re-checked with evaluate, so a bug in the grounding could not produce a wrong answer silently.
This is the design of MACE-style finders (McCune’s MACE, Claessen and Sörensson’s Paradox).
3.2 The slides’ entailment exercise
Script 02 runs both searches on each item: a counter-model search, and a proof search (the semantic arguments of §4):
| entailment | slides | counter-model | semantic argument |
|---|---|---|---|
| ∀v1. p(v1) ⊨ p(v2) | ✓ | none ≤ 4 | VALID |
| p(v1) ⊨ ∀v1. p(v1) | ✗ | size 2 | COUNTERMODEL |
| ∀v1. p(v1) ⊨ ∃v2. p(v2) | ✓ | none ≤ 4 | VALID |
| ∃v2. ∀v1. q(v1, v2) ⊨ ∀v1. ∃v2. q(v1, v2) | ✓ | none ≤ 4 | VALID |
| ∀v1. ∃v2. q(v1, v2) ⊨ ∃v2. ∀v1. q(v1, v2) | ✗ | size 2 | BUDGET |
| ⊨ ∃v1. (p(v1) ⇒ ∀v2. p(v2)) | ✓ | none ≤ 4 | VALID |
Two invalid items.
- Item 2: the free of the premise is one particular element, whose value is part of , while speaks about all elements. The counter-model has true of one element only.
- Item 5: the witness may depend on . In the counter-model , every element has a partner, but no element is everyone’s partner.
One subtlety. Free variables in an entailment are part of the interpretation. To search for a counter-model, they must be closed existentially (“is there an , including values for the free variables, with …”). Read universally, item 2’s counter-model would be missed. entailment_countermodel does this.
Item 6 is the “drinker paradox”: in every non-empty bar there is someone such that, if they drink, everyone drinks. It sounds false and is valid.
3.3 The people slide, decoded
Lecture 6 found that item 8 of the people slide, as printed, is a well-formed sentence. Only semantics can show what it says. Script 02 asks for models of each size:
| formula | model of size 1? | size 2? | size 3? | |
|---|---|---|---|---|
| item 8 as printed | ∀x. ¬∃y. ¬∃z. (x ≐ pa(y) ∧ z ≐ ma(z)) | yes | no | no |
| item 8 as intended | ∀x. ¬(∃y. x ≐ pa(y) ∧ ∃z. x ≐ ma(z)) | no | yes | yes |
The two negations of the printed version cancel. It says : everyone is the father of everyone. That forces a one-person world in which the single person is their own father. The intended sentence has no one-element model, since the single person would be both father and mother.
Item 1, “everyone has a father and a mother” (), has no counter-model up to size 4. The semantic argument proves it valid in 18 lines, taking , . Total functions make it a truth of logic.
3.4 Algebra by model finding
Script 02 searches for small algebraic structures:
| problem | smallest model | propositional variables (last size) | conflicts for sizes 1, 2, … | time (s) |
|---|---|---|---|---|
| non-commutative monoid | 3 | 1,084 | 1, 1, 7 | 0.1 |
| group with an element of order 2 and one of larger order | 4 | 4,478 | 1, 1, 5, 15 | 0.5 |
| group of > 2 self-inverse elements | 4 | 4,494 | 0, 1, 1, 0 | 0.3 |
| non-commutative group | 6 | 32,524 | 1, 1, 6, 40, 361, 445 | 20.1 |
These structures are, respectively:
- the smallest non-commutative monoid ( with for );
- the cyclic group of order 4;
- the Klein four-group;
- the symmetries of a triangle, the smallest non-abelian group.
Where the time goes. Most of the work goes into showing that no smaller model exists: 361 conflicts to show there is no non-commutative group of order 5. Domain elements are interchangeable, so every failed attempt has symmetric copies. Symmetry breaking removes some of them. Requiring the -th constant to take a value loses no model up to isomorphism. On the group search above it cut the conflicts from 1, 3, 16, 24 to 1, 1, 5, 15.
3.5 The limits
- Only infinite models. “A strict order in which every element has a larger one” is satisfiable (ℕ with <), but every finite strict order has a largest element. Script 02’s finder reports no model up to size 7. No finite model finder can ever succeed here.
- “No counter-model ≤ n” is not validity. “Among any five elements, two are equal” has no counter-model up to size 4 and one of size 5.
These limits are not accidental. By Church’s and Turing’s theorems (1936), validity in FOL is undecidable. No algorithm answers “valid?” for every formula.
What remains is a semi-decision procedure. If α is valid, a proof exists and proof search finds it (§4, Lecture 8). A finite counter-model, if one exists, is found by model search. Running both in parallel decides every formula that has a proof or a finite counter-model. The formulas with only infinite counter-models escape both searches.
4. Semantic arguments with quantifiers
The slides extend Lecture 1’s semantic arguments to FOL. The propositional rules (a)–(k) are unchanged, and four quantifier rules are added:
| rule | from | derive | term |
|---|---|---|---|
| (m) | any term (may be used again and again) | ||
| (n) | any term | ||
| (o) | a fresh constant | ||
| (p) | a fresh constant |
Why fresh?
- From we only know that some element has . A new name assumes nothing else about it.
- Reusing an existing term would assume that this element has , which is unsound.
- A universal statement holds for every element, so (m) and (n) may use any term.
The substitutions must be capture-avoiding (Lecture 6, §7).
The slides’ examples, by machine (script 03; fol_semantics.semantic_argument). Examples 1 and 2 match the slides line for line. Example 3:
1. I ⊭ ∃x. ∀y. Q(x, y) ⇒ ∀y. ∃x. Q(x, y) assumption
2. I ⊨ ∃x. ∀y. Q(x, y) by (h) on 1
3. I ⊭ ∀y. ∃x. Q(x, y) by (h) on 1
4. I ⊨ ∀y. Q(x0, y) by (o) on 2, fresh x0
5. I ⊭ ∃x. Q(x, y0) by (p) on 3, fresh y0
6. I ⊨ Q(x0, x0) by (m) on 4 with x0
7. I ⊨ Q(x0, y0) by (m) on 4 with y0
8. I ⊭ Q(x0, y0) by (n) on 5 with x0
9. I ⊨ ⊥ by (i) on 7, 8
Line 6 is the price of fairness. The prover instantiates a ∀ with every term on the branch, because it cannot know which one will close it.
The strategy. Apply α-rules and δ-rules (o)/(p) first, each δ-rule once per formula. Then split on β-rules, preferring splits whose branches close at once. Then run one round of γ-instances (m)/(n) with every ground term on the branch, and repeat. The result is fair: every applicable instance is eventually applied. By the slides’ completeness theorem (Gödel 1929, for formulas without equality), fairness means every valid formula is eventually proved.
Soundness and completeness. The slides state both: a closed tree proves validity, and every valid formula without equality has one. Completeness does not give termination.
Termination: what the slide shows, and what is true. The slides illustrate non-termination with , which is invalid. They apply the rule for to line 1 again and again, producing , and label the steps “(m)”. The rule for is (p).
A δ-rule never needs a second application. With one application, the branch is complete after two lines and yields a counter-model (one element, false), which is what script 03 shows.
The slide’s conclusion is still right, with a different example. On , every new element needs a new successor, and the branch grows forever (). Yet a one-element counter-model exists ().
A tableau builds only Herbrand-style models, in which distinct terms are distinct elements. It cannot discover that may equal . No strategy terminates on all invalid formulas, since validity is undecidable.
How strong is it? Script 03 runs 21 of Pelletier’s classic problems (1986):
- 20 are proved, most in under 100 lines and a few milliseconds. P29 needs 839 lines, P43 (without equality) 2,515.
- P26 is not proved within 5,000 lines, nor within 20,000 (tried while developing). Its ⇔ between quantified formulas splits branches early, and every branch re-instantiates every ∀ with every term.
Lecture 8’s resolution prover, which instantiates only by unification, takes P26 as a test.
5. Normal forms: prenex, Skolem, clausal
Resolution works on clauses, so first-order sentences must be brought into clausal form: universally closed CNF. The slides’ pipeline, run by script 04 on the running example :
- Rename apart: .
- Eliminate ⇒, ⇔: .
- NNF, which needs the quantifier dualities and : .
- Prenex: move quantifiers outward with . This is sound because, after renaming apart, is not free in β. One rewrite at a time, as on the slides:
∃x. (p(x) ∧ ¬q(x)) ∨ ∃y. ¬p(y) ∨ ∀z. q(z) ∃x. (p(x) ∧ ¬q(x) ∨ ∃y. ¬p(y) ∨ ∀z. q(z)) ∃x. (p(x) ∧ ¬q(x) ∨ ∀z. (∃y. ¬p(y) ∨ q(z))) ∃x. ∀z. (p(x) ∧ ¬q(x) ∨ ∃y. ¬p(y) ∨ q(z)) ∃x. ∀z. (p(x) ∧ ¬q(x) ∨ ∃y. (¬p(y) ∨ q(z))) ∃x. ∀z. ∃y. (p(x) ∧ ¬q(x) ∨ ¬p(y) ∨ q(z)) - PCNF, distributing in the matrix: .
- Skolemize: each becomes a new function applied to the universally quantified variables before it, giving . This is exactly the slides’ result.
Equivalence and equisatisfiability. Steps 1–5 preserve equivalence. Skolemization preserves only satisfiability:
- becomes ;
- a structure with true of one element and pointing to another satisfies the first and not the second (script 04).
Every model of the clause set is a model of the sentence: just ignore the Skolem symbols. Every model of the sentence can be expanded to a model of the clause set: interpret as a witness. So the sentence is unsatisfiable iff its clause set is, which is all refutation needs.
To prove ⊨ α, clausify ¬α and derive the empty clause (Lecture 8). Script 04 checks this on 300 random sentences: both have a model of size ≤ 3 or neither, 300/300; every model of a clause set satisfies the sentence, 268/268.
The order of steps 1 and 2 matters. The same check with the slides’ order, rename apart before eliminating ⇔, gives 299/300. The failing sentence is , which is unsatisfiable because α ⇔ α is valid.
What goes wrong. Eliminating copies α and β, so the renamed quantifiers appear twice with the same bound names. Pulling them out then lets one capture the other’s variable. The clause set is satisfiable: a counter-example to the pipeline.
The fix is to rename apart after eliminating ⇔. fol_semantics.clausal_form does this by default and keeps the slides’ order as an option. The slides’ running example has no ⇔, so it is not affected.
The prenex form is not unique. The slides pull out before , so “depends” on and becomes the function . But never mentions . Pulling ∃ first gives the prefix and only constants .
On 300 random sentences (script 04), with 712 Skolem symbols in total:
| pull first | Skolem constants | Skolem functions | mean arity |
|---|---|---|---|
| the right operand (the slides) | 247 | 465 | 1.64 |
| the left operand | 250 | 462 | 1.64 |
| ∃ before ∀ | 273 | 439 | 1.53 |
Real clausifiers go further with miniscoping: they push quantifiers inward first, so that each ∃ sits under as few ∀ as possible. Fewer Skolem arguments make proofs easier.
6. Unification
6.1 Why
Ground resolution needs complementary literals, like and . The slides’ first answer for variables is the rule
for any term . Script 05 replays the slides’ derivation with it:
| clause | rule | |
|---|---|---|
| C1–C3 | {¬P(z), Q(z)}, {P(a)}, {¬Q(x)} | input |
| C4 | {¬P(a), Q(a)} | INST on C1 with z ← a |
| C5 | {Q(a)} | RESOLVE C2, C4 |
| C6 | {¬Q(a)} | INST on C3 with x ← a |
| C7 | {} | RESOLVE C5, C6 |
INST must guess , and with function symbols there are infinitely many terms. The slides call it “not constrained enough”.
The alternative is to compute, from the two literals themselves, the least instantiation that makes them complementary.
6.2 Unifiers
A substitution σ is a unifier of and if . It is a most general unifier (mgu) if every unifier τ is an instance of it: for some θ.
Robinson’s theorem (1965). If two terms have any unifier, they have an mgu, and an algorithm computes it.
Robinson’s algorithm (unify). Keep a list of pairs that must become equal, and take one pair at a time:
- identical: drop it;
- variable vs term : if occurs in , fail (the occurs check). Otherwise bind and apply the binding everywhere;
- same function symbol : add the pairs ;
- different symbols: fail (clash).
unify f(x, f(x, y)) with f(g(z), f(g(a), z)): {x ← g(a), y ← a, z ← a}
decompose f(x, f(x, y)) =? f(g(z), f(g(a), z))
bind x ← g(z)
decompose f(g(z), y) =? f(g(a), z)
decompose g(z) =? g(a)
bind z ← a
bind y ← a
Martelli and Montanari (1982) present the same algorithm as six rules on sets of equations:
| rule | transformation |
|---|---|
| Delete | is removed |
| Decompose | becomes the equations |
| Conflict | with : fail |
| Swap | becomes |
| Eliminate | given , substitute in all other equations |
| Check | with in : fail |
The rules can be applied in any order. They terminate in a solved form, which is the mgu, or in failure. This is a small instance of Lecture 3’s idea: a rule system plus a strategy is a procedure. Script 05 traces both algorithms.
6.3 Checked
Script 05 generates 2,000 random problems over , , , with variables , , . The outcomes are 563 unifiable, 1,157 clashes and 280 occurs-check failures.
- Agreement: eager Robinson, triangular Robinson and Martelli–Montanari agree on all 2,000, up to renaming.
- Correctness: every result is a unifier, and every result is idempotent ().
- Generality: brute force finds 847 ground unifiers. Each one satisfies for the computed mgu σ, so each is an instance of it.
The mgu represents all solutions at once. That is why resolution with unification never needs to consider any other instance.
6.4 The occurs check
Do and unify? That needs and , so . Only the infinite term would do, and the occurs check rejects it.
Without the check, the clauses and would resolve to the empty clause. Yet they are satisfiable: script 05’s model finder gives a 2-element model ( swaps the elements, and is “is the image of”). Dropping the check makes resolution unsound. Prolog omits it for speed, which is one reason Prolog is not a sound theorem prover.
6.5 The size of an mgu
Unifying with binds to a term with symbols. Script 05:
| n | size of (tree) | size (DAG) | eager: occurs-check visits | triangular: visits |
|---|---|---|---|---|
| 6 | 127 | 7 | 246 | 48 |
| 12 | 8,191 | 13 | 16,368 | 168 |
| 18 | 524,287 | 19 | 1,048,554 | 360 |

The size depends on the representation. The mgu has only distinct subterms, so written as a DAG it is small.
The textbook algorithm applies every binding everywhere and checks occurrences in the expanded terms, so its work grows like the tree. Triangular bindings fix this: keep , unapplied, follow chains on lookup, and memoize the occurs check. The work is then linear here. Martelli and Montanari give an almost-linear algorithm, and Paterson and Wegman (1978) a linear one.
Matching is one-way unification: only the pattern’s variables are bound. It decides subsumption (Lecture 8).
7. First-order resolution: the idea
Unification turns resolution into a rule on clauses with variables:
The two clauses are first renamed apart: different clauses never share variables. The slides’ example is The literals unify by , which gives (script 05). One resolution step with unification stands for infinitely many ground steps.
Lecture 8 completes the rule set with factoring (merging unifiable literals of one clause) and builds a resolution prover with the given-clause loop, subsumption and proof output. It also states what resolution can and cannot do:
- it is refutationally complete: every unsatisfiable clause set has a refutation;
- it is not a decision procedure: on satisfiable sets it may run forever.
8. Summary
- An interpretation gives each sort a non-empty domain, each symbol a total function or relation, and each free variable a value. Equality is identity. Truth is defined by structural induction, with ∀ and ∃ ranging over the domain.
- Validity, entailment, equivalence are defined over all interpretations. Invariance means a sentence is true or false in an interpretation, with no assignment needed. The slides’ theorems hold on every instance script 01 tried.
- A finite model finder grounds formulas for a fixed domain size and calls CDCL. It produced counter-models for the invalid entailments and decoded the people-slide typo. It found the smallest non-commutative monoid (3) and group (6) and the Klein group, with symmetry breaking for speed. It cannot find infinite models, and “no counter-model ≤ n” is not a proof.
- Semantic arguments with quantifier rules are sound and complete, but not terminating: validity in FOL is undecidable. The slide’s non-termination example terminates once (p) is applied only once; is a true non-terminating case. 20 of 21 Pelletier problems are proved.
- Clausal form: NNF, then prenex, then PCNF, then Skolemize. It is equisatisfiable, not equivalent. Rename apart after eliminating ⇔, or the pipeline is unsound. Pulling ∃ first gives smaller Skolem functions.
- Unification computes the most general instance making two terms equal. Robinson and Martelli–Montanari agree on 2,000 random problems, and every ground unifier is an instance of the mgu. The occurs check is necessary for soundness. Eager substitution can blow up exponentially; triangular bindings avoid that.
- Resolution with unification is the rule Lecture 8 turns into a prover.
9. Common pitfalls
- Empty domains. FOL domains are non-empty, so . Some logics allow empty domains; ours does not.
- Partial functions. always denotes someone. “Everyone has a father” is valid, not a modelling choice.
- Free variables in entailments. They are part of the interpretation. For counter-models, close them existentially; for validity, universally.
- “No counter-model found, so valid.” Only if a proof is found. Counter-models may be large, or infinite.
- The quantifier precedence. means under the slides’ convention. This bit the author while writing script 02.
- Skolemization changes meaning. Only satisfiability is preserved. Never Skolemize a formula you want to prove valid; Skolemize its negation.
- Rename apart before eliminating ⇔. It must come after (§5).
- Unifying without renaming apart. and do not unify as written ( vs ), but after renaming, and do. Clauses never share variables.
- Dropping the occurs check makes resolution unsound (§6.4).
10. Exercises
Answers are collapsed; try each exercise first.
1. (evaluation) In the family structure of §2 ( = Jim, = Joe), evaluate step by step.
Answer
, as script 01 prints.
2. (counter-model) Give a counter-model to .
Answer
Take two elements, with true of 1 and true of 0. Every element has or , but neither holds for all. Script 03’s model finder returns exactly this.
3. (validity) Prove with semantic arguments. Which assumption about interpretations does the proof use?
Answer
- , by (h)
- , by (h)
- Introduce a constant (any term will do), then by (m) on 2
- , by (n) on 3
Step 4 uses the existence of a term, which mirrors the non-empty domain. In an empty domain would be true and false.
4. (the drinker) Prove informally by cases.
Answer
- If everyone drinks, any works: the consequent is true.
- If someone, , does not drink, take : the antecedent is false.
The domain is non-empty, so in both cases a witness exists.
5. (clausal form) Clausify , the negation of item 5 of the entailment exercise.
Answer
- NNF: .
- Prenex, ∃ first where possible: .
- Skolemize: and .
- Clauses: , .
Miniscoping would give , since the second conjunct does not mention .
6. (Skolem) Show that and are equisatisfiable but not equivalent, as a pair of structures.
Answer
Every model of satisfies , with as the witness. Conversely, a model of becomes a model of when is interpreted as a witness.
But the structure with domain {0, 1}, , satisfies and not . This is script 04’s example.
7. (step order) Explain in two sentences why renaming apart before eliminating ⇔ can make clausification unsound. Give the smallest example you can.
Answer
becomes , so every quantifier in α or β now occurs twice with the same name. Pulling both copies to the front puts one in the scope of the other, and occurrences get captured.
Example: , §5.
8. (unification) Compute mgus, or explain the failure: (a) and ; (b) and ; (c) and .
Answer
- (a) . Then , so . mgu .
- (b) , then : the occurs check fails, so there is no unifier.
- (c) , , . mgu .
9. (most general) Show that is a unifier of and but not most general. What is the mgu?
Answer
It is a unifier: both sides become . The mgu is , and the given unifier is its instance under . It is not most general, because is a unifier that is not an instance of it.
10. (model finding, programming) Use find_model to find the smallest model of: “a binary relation that is reflexive, symmetric, not transitive”. Then add “every element is related to exactly two elements”.
Answer sketch
First part. Write the axioms:
- ;
- ;
- .
The smallest model has 3 elements: a path 0–1–2 plus loops.
Second part. Add “exactly two neighbours”, counting the element itself. Then plus exactly one other neighbour must hold, and that relation is transitive. So no model exists. Check this up to size 6.
This is a small taste of how model finders support mathematical exploration.
11. (tableau, programming) Extend semantic_argument with the substitution rule for equality, “from and derive ”, restricted to ground terms on the branch. Which formulas with equality does it now prove?
Answer sketch
Apply the rule when a branch contains and a literal containing ; add the rewritten literal, with fairness as for γ-rules.
Valid examples now provable include and ; symmetry also follows, using reflexivity. The real solution is paramodulation and superposition (Lecture 8, further reading).
11. Further reading
- A. Bradley, Z. Manna, The Calculus of Computation, §2.2–2.5: semantics, semantic arguments, normal forms.
- H. Enderton, A Mathematical Introduction to Logic, §2.2: structures, truth and models, carefully.
- J. A. Robinson, “A Machine-Oriented Logic Based on the Resolution Principle”, JACM 1965: unification and resolution.
- A. Martelli, U. Montanari, “An Efficient Unification Algorithm”, ACM TOPLAS 1982.
- F. Baader, W. Snyder, “Unification Theory”, Chapter 8 of the Handbook of Automated Reasoning (2001): all algorithms, with complexity.
- F. J. Pelletier, “Seventy-Five Problems for Testing Automatic Theorem Provers”, JAR 1986.
- W. McCune, “Mace4 Reference Manual and Guide” (2003); K. Claessen, N. Sörensson, “New Techniques that Improve MACE-style Finite Model Finding” (2003): finite model finding by SAT.
- A. Nonnengart, C. Weidenbach, “Computing Small Clause Normal Forms”, Handbook of Automated Reasoning (2001): miniscoping and better clausification.
12. Next lecture
Lecture 8: resolution and unification II, first-order theories. We build prover.py, a resolution prover with:
- factoring;
- the given-clause loop;
- subsumption;
- proof output that an independent checker verifies.
We run it on the slides’ examples, on Pelletier’s problems (including P26), and on group theory: “every group in which is commutative”. We then meet first-order theories: restricting interpretations to the intended ones, axiomatizing them, and what completeness and decidability of a theory mean. The model finder from this lecture returns there as a counter-model generator for theories.