Resolution Theorem Proving: Robert Keller February 2011
Resolution Theorem Proving: Robert Keller February 2011
Resolution Theorem Proving: Robert Keller February 2011
Theorem Proving
Robert Keller
February 2011
What is this?
• Resolution is a special kind of theorem
proving used in:
• Propositional resolution:
• Needed to understand predicate resolution
iff original
formula
is valid
Negated ⊥
Formula Clauses
Formula
resolvents
negate clausify
Example
• Clause set:
• p ∨ ¬q
• ¬q ∨ ¬r
• q
• Why not?
We’d need p = r = F in order to satisfy all clauses,
but then there is no way to set q so that all clauses are
satisfied.
Conjunctive Normal Form
• A clause set is another way of representing a
propositional formula.
• is representable as
• Examples:
• p∧¬q ≡ ¬(q∨¬p)
• p→(q→r) ≡ (p∧q)→r
Equivalence of Clause Sets
• Two clause sets are called equivalent if they
are satisfied by the same set of valuations.
• both satisfiable, or
• both unsatisfiable
How General is the Clausal Form?
• Claim: Every propositional formula can be
represented in clausal form.
• Examples:
• p ∨ q in clausal form is {p ∨ q} (one clause)
Example: {¬p ∨ q, p, ⊥}
Conversion to Clausal Form
• We rely on rules that can be proved in
propositional logic:
• Commutative
• A∧B≡B∧A
• A∨B≡B∨A
• Distributive
• A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)
• A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)
• DeMorgan
• ¬(A ∧ B) ≡ ¬A ∨ ¬B
• ¬(A ∨ B) ≡ ¬A ∧ ¬B
Conversion to Clausal Form
1. Replace each ϕ → ψ with (¬ϕ ∨ ψ).
(¬p∧q∧¬r) F T F T
(¬p∧q∧r) F T T T
(p∧¬q∧¬r) T F F T
T F T F
(p∧q∧¬r) T T F T
(p∧q∧r) T T T T
{p ∨ ¬q}
Resolution Method
• Input: A reduced set of clauses.
ϕ ∨ ψ.
• Stop ⊥ ∈ S.
p ∨ ¬q q∨r ¬r ¬p
children
nodes are p
resolvents
⊥
Try resolving these clause sets:
• ¬p ∨ ¬q ∨ ¬r,
¬q ∨ r,
q ∨ s,
¬s,
p
• p ∨ ¬q ∨ r,
q ∨ r,
¬p
Sometimes a DAG is more appropriate
than a tree for showing all options
p∨q p ∨ ¬q ¬p ∨ ¬q ¬p ∨ q
p ¬q ¬p q
We avoid identifying
⊥ ⊥ the two ⊥ nodes,so as
not to confuse the two
sets of antecedents.
Useful Editing Short-cuts
• Uncomplemented Literal Lemma
• ¬p ∨ q ∨ r,
¬q ∨ r,
q ∨ s,
¬s,
p
• r occurs only uncomplemented.
• The clause set is unsatisfiable iff the following set is:
• q ∨ s,
¬s,
p
• and this set is unsatisfiable iff ¬s is unsatisfiable
(which it isn’t).
Further Editing Short-Cuts
• Unit Clause Lemma:
• http://www.cs.unm.edu/~mccune/prover9/
• ∀X p(X)
∧∀X ∀Y q(X, Y)
∧∀X ∀Y (¬q(X, X) ∨ p(X))
• ¬man(X) ∨ mortal(X)
• man(socrates)
• ¬mortal(socrates)
¬q(X, X) ∨ p(X)
¬p(Z) ∨ r(Z, Y)
• For one thing, the identity of the variables is
independent in each.
• For another, the arguments are generally
terms, not just simple variables:
¬q(X, X) ∨ p(f(X))
¬p(X) ∨ r(g(X), c)
Example of What Resolution Must Do
p(X, c) p(Y, Y)
p(f(X), Y) p(Z, Y)
• p(Y, f(Y))
⏐ ⏐ ⏐ ⏐
p(Y, f(Y))
Example
• p(X, f(X)) vs. p(f(Y), Y) initial
• S := {[p(X, f(X)), p(f(Y), Y)]}
• µ := {}
• p(f(Y), f(f(Y)))
⏐ ⏐ ↓ occur check fails, not unifiable
p(f(Y), Y)
Example
• p(X, g(Z), X) vs. p(f(Y), Y, W) initial
• S := {[p(X, g(Z), X), p(f(Y), Y, W)]}
• µ := {}
$ /opt/local/bin/swipl
Welcome to SWI-Prolog
X = f(g(Z)),
Y = g(Z),
W = f(g(Z))
Try These
τ1 τ2 mgu
(or not unifiable)
p(X, f(X), d) p(c, f(c), Y)
p(f(g(X)), Z) p(g(Y), Y)
¬man(socrates) man(socrates)
⊥
Example Resolving Predicate Clauses
• clause 1: p(X, g(Z), X) ∨ q(X, h(Z))
• clause 2: ¬p(f(Y), Y, W) ∨ r(f(Y), g(W))
• These are already renamed apart.
¬p(Z) p(g(b))
[g(b)/Z]
⊥
Unit Preference
• As with propositional resolution,
resolving with unit clauses first is a
good heuristic.
Try This Set
1. ¬e(X) ∨ q(X) ∨ s(X, f(X))
2. ¬e(X) ∨ q(X) ∨ r(f(X))
3. p(a)
4. e(a)
5. ¬s(a, Y) ∨ p(Y)
6. ¬p(X) ∨ ¬q(X)
7. ¬p(X) ∨ ¬r(X)
Remember to treat clauses as sets.
• q(b, X) ∨ p(X) ∨ q(b, a)
• ¬q(Y, a) ∨ p(Y)
• These are already renamed apart.
• Modified clauses:
• q(b, a) ∨ p(a) ∨ q(b, a)
• ¬q(b, a) ∨ p(b)
P(f(y)) ∨ ¬Q(f(y))
• P(x) ∨ P(y)
• ¬P(a) ∨ ¬P(b)
• Without factoring, generate:
• P(y) ∨ ¬P(b)
• P(x) ∨ ¬P(a)
• and more similar clauses,
but never the empty clause.
Case Where Factoring is Necessary
• P(x) ∨ P(y)
• ¬P(a) ∨ ¬P(b)
• With factoring, get factor p(x) from first
clause, then generate:
• ¬P(b)
• ⊥
Clausal Form for Predicate Logic
• Often, we’ll want to prove a sequent of
the form
• ∀x ∀y (…)
• ∀x ∀y (…)
|– ___
• For premises of the form ∀x ∀y (…) where … has no
quantifiers, we can just drop the quantifiers.
4. No boletus is a mushroom.
5. Specimen b is a boletus.
2. ∀X boletus(X) → fungus(X)
3. ∀X toadstool(X) → poisonous(X)
4. ∀X boletus(X) → ¬mushroom(X)
5. boletus(b)
6. Therefore: poisonous(b)
Mushroom Clauses
1. ¬fungus(X) ∨ mushroom(X) ∨ toadstool(X)
2. ¬boletus(X) ∨ fungus(X)
3. ¬toadstool(X) ∨ poisonous(X)
4. ¬boletus(X) ∨ ¬mushroom(X)
5. boletus(b)
-boletus(x) | fungus(x).
-toadstool(x) | poisonous(x).
-boletus(x) | -mushroom(x).
boletus(b).
Goal:
poisonous(b).
Prover9 Output for Mushrooms
Checking Unifiability with Prover9
• In contrast to Prolog,
Prover9 does use an occur-check.
unification succeeds unification fails due to occur-check
Proof:
Clausal Form for Predicate Logic
• Often, we’ll want to prove a sequent of the form
• ∀x ∀y (…),
• ∀x ∀y (…)
|– ∀x ∀y (…)
∃x ∃y ¬(…).
∀y p(y) |– ∀y p(x)
p(y)
∃x ¬p(x)
we use a trick:
¬p(b)
There is an interpretation that satisfies ¬p(b) iff there is one that satisfies
the original formula ∃x ¬p(x).
∀y p(y) |– ∀x p(x)
p(y)
¬p(b)
p(b, y)
• Conclusion clause:
¬p(x, c)
• Premise clause:
¬a(c) ∨ b(d)
• Conclusion clauses:
a(x)
¬b(x)
• “F is onto”: ∀y ∃x F(x, y)
• “G is onto”: ∀z ∃y G(y, z)
• “H is onto”: ∀z ∃x H(x, z)
Translation to Clausal Form
• ∀y ∃x F(x, y) becomes F(f(x), y) [f is a Skolem function]
• ∀z ∃y G(y, z) becomes G(g(z), z) [g is a Skolem function]
• Drop ∀ quantifiers.
prefix matrix
Completion of Conversion
• ∀x ∀y ∀z ∃u(¬p(x, z) ∨ ¬p(y, z) ∨ q(x, y, u))
• ∀x e(f(x, u), x)
becomes
e(f(x, u), x)
• ∀x e(f(x, i(x)), u)
becomes
e(f(x, i(x)), u)
Example: Equality Theory Clauses
• We need to axiomatize equality predicate e, e.g.
• ∀x e(x, x)
becomes
e(x, x)
• ∀x ∀y e(x, y) → e(y, x)
becomes
¬e(x, y) ∨ e(y, x)
etc.
Example of Group Theory Clauses with Negated Conclusion
8. ¬e(i(i(b)), b)
Proviso is introduced
by prefixing
ʻWHERE x NOTIN G ISʼ
in Jape.
For equivalence, we need the
converse of each rule: ∀∧ Rule b.
Otherwise, there is
no way to get G by itself.
Justification of Rules
Using Natural Deduction: ∀∨ Rule a.
Justification of Rules
Using Natural Deduction: ∀∨ Rule b.
Justification of Rules
Using Natural Deduction: ∃∨ a.
Non-empty universe assumption, needed in 7-11
Justification of Rules
Using Natural Deduction: ∃∨ b.
Justification of Rules
Using Natural Deduction: ∃∧ a.
Justification of Rules
Using Natural Deduction: ∃∧ b.