Title: Artificial Intelligence 9. Resolution Theorem Proving
1Artificial Intelligence 9. Resolution Theorem
Proving
- Course V231
- Department of Computing
- Imperial College
- Jeremy Gow
2The Full Resolution Rule
- If Unify(Pj, Qk) ? ( makes them unifiable)
- P1 ? ? Pm, Q1 ? ? Qn
- Subst(?, P1 ? (no Pj) ? Pm ? Q1 ? (no Qk)
... ?Qn) - Pj and Qk are resolved
- Arbitrary number of disjuncts
- Relies on preprocessing into CNF
3A More Concise Version
- E.g. for A 1, 2, 7 first clause is L1 ? L2 ?
L7
4Resolution Proving
- Knowledge base of clauses
- Start with the axioms and negation of theorem in
CNF - Resolve pairs of clauses
- Using single rule of inference (full resolution)
- Resolved sentence contains fewer literals
- Proof ends with the empty clause
- Signifies a contradiction
- Must mean the negated theorem is false
- (Because the axioms are consistent)
- Therefore the original theorem was true
5Empty Clause means False
- Resolution theorem proving ends
- When the resolved clause has no literals (empty)
- This can only be because
- Two unit clauses were resolved
- One was the negation of the other (after
substitution) - Example q(X) and q(X) or p(X) and p(bob)
- Hence if we see the empty clause
- This was because there was an inconsistency
- Hence the proof by refutation
6Resolution as Search
- Initial State Knowledge base (KB) of axioms and
negated theorem in CNF - Operators Resolution rule picks 2 clauses and
adds new clause - Goal Test Does KB contain the empty clause?
- Search space of KB states
- We want proof (path) or just checking (artefact)
7Aristotles Example (Again)
- Socrates is a man and all men are mortal
Therefore Socrates is mortal - Initial state
- 1) is_man(socrates)
- 2) ?is_man(X) ? is_mortal(X)
- 3) is_mortal(socrates) (negation of theorem)
- Resolving (1) (2) gives new state
- (1)-(3) 4) is_mortal(socrates)
8Aristotles Example Search Space
1) is_man(socrates) 2) ?is_man(X) ?
is_mortal(X) 3) is_mortal(socrates)
- 1) is_man(socrates)
- 2) ?is_man(X) ? is_mortal(X)
- 3) is_mortal(socrates)
- 4) is_mortal(socrates)
1) is_man(socrates) 2) is_man(X) ?
is_mortal(X) 3) is_mortal(socrates) 4)
is_man(socrates)
1) is_man(socrates) 2) ?is_man(X) ?
is_mortal(X) 3) is_mortal(socrates) 4)
is_mortal(socrates) 5) False
1) is_man(socrates) 2) ?is_man(X) ?
is_mortal(X) 3) is_mortal(socrates) 4)
is_man(socrates) 5) False
9Resolution Proof Tree (Proof 1)
10Resolution Proof Tree (Proof 2)
11Reading Proof Tree 2
- You said that all men were mortal. That means
that for all things X, either X is not a man, or
X is mortal CNF step. If we assume that
Socrates is not mortal, then, given your previous
statement, this means Socrates is not a man
first resolution step. But you said that
Socrates is a man, which means that our
assumption was false second resolution step, so
Socrates must be mortal.
12Russell Norvig Example
13Reminder Kowalski NF
- Can reintroduce ? to CNF, e.g.
- A ? C ? B becomes (A ? C) ? B
- Kowalski normal form
- (A1 ?? An) ? (B1 ?? Bn)
- Resolve in KNF using KNF style rules
- e.g. Binary resolution
- A?B, B?C
- A?C
14RN Example Kowalski NF
15RN Example Proof Tree
16RN Example Prover9 Input
17RN Example Prover9 Proof
18Equality Axioms
- is_pres(obama) and is_pres(b_obama)
- will not unify (syntactically different)
- unification algorithm does not allow this
- Even if we add to the knowledge base
- obama b_obama
- Solution add equality axioms to KB
- XX, XY?YX, etc.
- Special axiom for every predicate/function
- X Y ? P(X) P(Y)
19Equality Demodulation
- Alternative solution rewrite with equalities
- Demodulation inference rule
- XY, AS
- Subst(?, AY)
- Two input clauses (one an equality XY)
- Unify X with a subterm S of other
- Apply unifier to clause with subterm Y (not S)
- Also works unifying with Y and putting in X
Unify(X, S) ?
20Heuristic Strategies
- Pure resolution search tends to be slow
- For interesting problems
- Many clauses in the initial knowledge base
- Each step adds a new clause (which can be used)
- Num. of possible resolution combinations explodes
- Selection Heuristics
- Intelligently choose which pair to resolve
- Pruning Heuristics
- Forbid certain pairs
21Unit Preference Strategy
- Prefer to resolve unit clauses
- Contain only a single literal
- Selection heuristic
- Searching for smallest (empty) clause
- Resolving with the unit clauses keeps small
- Very effective early on for simple problems
- Doesnt reduce branching rate for medium problems
22Set of Support Strategy
- Distinguished subset of KB clauses
- Set of support (SOS) clauses
- Every step must involve SOS (pruning heuristic)
- Must be careful not to lose completeness
- Example SOS strategy
- Initial SOS is negated theorem
- Add new clauses to SOS
- Hence False will be deduced (strategy is
complete) - Many provers use SOS, e.g. Prover9
23Input Resolution Strategy
- Special case of SOS strategy
- SOS clauses in the initial knowledge base
- Clearly reduces search space
- Every resolution must involve an original clause
- So number of possible resolutions grows slowly
- Not complete for first order logic
- But complete for Horn-clauses, e.g. Prolog
24Subsumption
- Clause C subsumes clause D
- if C is more general (D is more specific)
- Naive check for subsumption
- Select C2, a subset of literals of C
- Find Unify(C2, D) ?
- ? does not add anything to D (only renames vars)
- Example
- p(george) ? q(X) subsumed by p(A) ? q(B) ? r(C)
- Substitution A/george, X/B
- Second clause is more general
25Subsumption Strategy
- Check each new clause is not subsumed by KB
- Complete strategy
- Specific clauses can be inferred from general
ones - So we can throw specific clauses away
- Reduced search space still contains False
- Can be inefficient
- expense must be outweighed by the reduction in
the search space
26Applications Axioms for Algebras
- Bill McCune and Larry Wos
- Argonne National Laboratories
- FO resolution provers EQP, Otter, Prover9
- Robbins Problem (axioms of Boolean algebras)
- Stated 60 years ago, mathematicians failed
- 1996 EQP solved in 8 days in 1996 (human work)
- General application to algebraic axiomatisations
- Generate possible axioms for algebras
- Prove new axioms equivalent to old
27Applications Theory Formation
- Simons HR system Automated Theory Formation
- Used in mathematical (and bioinformatics) domains
- Theories concepts, examples, conjectures,
proofs - HR uses Otter to prove conjectures it makes
- Effective in algebraic domains
- See notes for anti-associative algebra results
- Otter not so effective in number theory
- Used as a triviality filter (discard theorems
it can prove) - Example conjectures made by HR (and proved by
Simon) - Sum of divisors is prime ? number of divisors is
prime - Sum of divisors of a square is an odd number
- Perfect numbers are pernicious and many
more..
28Inductive Theorem Proving
- Deduction by mathematical induction
- Induction over many different structures
- Allows reasoning about recursion/iteration
- Useful for hardware/software verification
- Dont confuse inductive learning (next lecture)
29Interactive Theorem Proving
- Necessary to interact with humans in order to
prove theorems of any difficulty - Mathematicians assistant
- Let a theorem prover do simple tasks while you
develop a theory (e.g., Buchbergers Theorema) - Guided theorem prover
- User follows and guides computer proof attempt
- Needs visualisation tools for proof trees
30Higher Order Theorem Proving
- Deduction in higher order logics
- See lecture 4
- Allows more natural and succinct statements
- Logics much less well-behaved
- HOL theorem prover
- Larry Paulsons group in Cambridge
- Has been used for verification tasks
- E.g. verification of crytographic protocols
- Uses induction and interactive control
31Proof Planning
- Initially Alan Bundys group in Edinburgh
- Human proofs often follow a similar structure
- Express this as a outline plan
- Methods represent a patterns of deduction
- Outline plan guides proof search
- Results in specific plan for theorem
- Critics deal with common problems
- Particularly useful for inductive theorems
- Proof of base case and step case follow pattern
32Databases Competitions
- TPTP library (Sutcliffe Suttner)
- Thousands of Problems for Theorem Provers
- Benchmarks for first order provers
- HR is only non-human to add to this library
- Annual CASC competition (Sutcliffe et al.)
- Which is fastest/most accurate FO prover on
planet? - Uses blind selection from the TPTP library
- 2002-08 champion Vampire (Voronkov Riazonov)