# Artificial Intelligence 9. Resolution Theorem Proving

## Presentation on theme: "Artificial Intelligence 9. Resolution Theorem Proving"— Presentation transcript:

Artificial Intelligence 9. Resolution Theorem Proving
Course V231 Department of Computing Imperial College Jeremy Gow

The 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

A More Concise Version E.g. for A = {1, 2, 7} first clause is L1  L2  L7

Resolution Proving Knowledge base of clauses Resolve pairs 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

Empty 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

Resolution 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)

Aristotle’s 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)

Aristotle’s 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

Resolution Proof Tree (Proof 1)

Resolution Proof Tree (Proof 2)

Reading 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.

Russell & Norvig Example

¬A  ¬C  B becomes (A  C)  B
Reminder: 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

R&N Example: Kowalski NF

R&N Example: Proof Tree

R&N Example: Prover9 Input

R&N Example: Prover9 Proof

Equality 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 X=X, X=YY=X, etc. Special axiom for every predicate/function: X = Y  P(X) = P(Y)

Equality & Demodulation
Alternative solution: rewrite with equalities Demodulation inference rule X=Y, A[S] Subst(, A[Y]) Two input clauses (one an equality X=Y) 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) = 

Heuristic 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

Unit 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 Doesn’t reduce branching rate for medium problems

Set 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

Input 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

Subsumption Clause C subsumes clause D Naive check for subsumption
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

Subsumption 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

Applications: 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

Applications: Theory Formation
Simon’s 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…..]

Inductive Theorem Proving
Deduction by mathematical induction Induction over many different structures Allows reasoning about recursion/iteration Useful for hardware/software verification Don’t confuse inductive learning (next lecture)

Interactive Theorem Proving
Necessary to interact with humans in order to prove theorems of any difficulty Mathematician’s assistant Let a theorem prover do simple tasks while you develop a theory (e.g., Buchberger’s Theorema) Guided theorem prover User follows and guides computer proof attempt Needs visualisation tools for proof trees

Higher 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 Paulson’s group in Cambridge Has been used for verification tasks E.g. verification of crytographic protocols Uses induction and interactive control

Proof Planning Initially Alan Bundy’s 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

Databases & 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 champion: Vampire (Voronkov & Riazonov)