Title: COSC 4350 and 5350 Artificial Intelligence
1COSC 4350 and 5350Artificial Intelligence
- Propositional Logic and Resolution (Part II)
- Theorem Proving by Resolution
- Dr. Lappoon R. Tang
2Overview
- What is automated theorem proving?
- Proof System What is it?
- Theorem Prover What is it?
- Resolution Theorem Proving
- Resolution a rule of inference
- As a mechanism for proving theorems implemented
as a search algorithm
3Readings
4Revision The Rules of Inference (Proof by
Refutation)
- To prove X, assume X is NOT true (i.e. not(X) is
true), and show that it leads to a contradiction - Example prove that there is no greatest integer
- Proof
- Assume the greatest integer is N
- Since N1 is also an integer
- But N1 gt N
- !!
5What is Automated Theorem Proving?
- It is a branch of research in AI that concerns
the following issues - Can I create a system that can automatically
prove if a statement is true or not? - If so, how can I make sure that the system will
run efficiently?
6Why would Automated Theorem Proving be Desirable?
- Q Why would it be nice to have a theorem
- prover?
- False A Because we can pass all Math
- classes easily
- True A In some cases, we can automatically
verify - if a certain design is correct (e.g. a CPU)
7Proof System What is it?
- A proof system axioms rules of inference
- In other words, a proof system is a mathematical
system that defines two things - Axioms things assumed to be true from the very
onset (e.g. 1 gt 0) - Rules of inference how to derive new facts from
existing facts and axioms (e.g. 1gt 0 gt 2 gt 1) - So, the purpose of a proof system is to give us a
methodology of deriving true statements that are
guaranteed to be true that is, constructing
proofs. ?
8Proof What is it?
- Since we know what a proof system is, defining
the meaning of a proof is easy - A proof is a finite list of true statements
- starting with the axioms or proven facts (aka
theorems) and ending at the true statement that
one wants to derive - In such a way that a new true statement is
derived from some set of previously proven true
statements using a rule of inference
9Proof System An Example
- Axioms
- 1 gt 0 (1)
- If X gt Y, then X 1 gt Y 1 (2)
- Rules of Inference
- Modus Ponens (MP)
- Modus Tollens (the inverse of MP)
- Prove that 3 gt 2.
- Proof
- 1. 1 gt 0 (Axiom 1)
- 2. If 1 gt 0, then 2 gt 1 (Axiom 2, X1, Y0)
- 3. 2 gt 1 (By MP applied on fact 1, 2)
- 4. If 2 gt 1, then 3 gt 2 (Axiom 2, X2, Y1)
- 5. 3 gt 2 Done! ? (MP applied on fact 3, 4)
10Proof System In Real Life
- Actually, all the proofs that we did in our
calculus classes implicitly relied on all the
axioms in set theory and in Peano arithmetic (aka
Peano axioms) AND the rule of inference used was
Modus Ponens - Just that your teacher might not have told you
about all these things in the background - One reason is probably because they were
developed in the 19th century or earlier ?
11Soundness and Completeness of a Proof System
- Soundness if the system proves that something is
true, then it really is true - The system doesnt derive contradictions
- Completeness if something is really true, it can
be proven using the system - The system can be used to derive all the true
mathematical statements one by one
12What is a Theorem Prover?
- A program that can decide the validity of a
certain statement using a given proof system
Note Depending on the type of proof system used,
whether S is false can be undecidable. If so, the
proof system is semi-decidable and the theorem
prover will not stop running on a false statement
X.
13Soundness and Completeness of Theorem Provers
- Suppose we have a theorem prover P
- Soundness If P proved that some statement S is
true, then S is really a true statement - Completeness If a statement S is true, that S
can be proven to be true by P
14Resolution Theorem Proving
- Resolution is a rule of inference sound and
complete - Developed in 1965 by J.A. Robinson
- This single rule of inference can be used to
construct a sound and complete theorem prover
when used with a complete search algorithm
provided that the proof system is also sound and
complete
15Resolution Theorem Proving Important definitions
- A literal is either an atomic sentence (or simply
atom) or the negation of it - Atoms p, q, r
- Negation of atoms p, q, s
- A clause is a disjunction of literals (or a set
of literals) - Example p v q p, q
- An empty clause is the empty set
- A WFF is in conjunctive normal form (CNF) if its
expressed as a conjunction of clauses - Example (p v q) (r v s)
- Any WFF in propositional logic can be converted
to a logically equivalent CNF using laws about
logical connectives (e.g. distributive law of
over v)
16Resolution Theorem Proving The resolution rule
of inference
- The resolution rule of inference
- Given p U A and p U B where p is an atom, A
and B are sets of literals - Derived A U B
- p U A _p U B
- A U B
- p is the atom that has been resolved
- A U B is the resolvent
- This rule can be implemented as a procedure
called resolution
17Resolution An Example
- Suppose A r, B s
- p U r p U s
- r, s
- The atom p has been resolved
- r, s is the resolvent
18Resolution Theorem Proving The Intuition
- The idea behind resolution theorem proving is
this - To prove that a statement s is true, we assume
that it is false we assume s is true - If we can derive a contradiction at the end the
empty clause, then we know s is true
19Resolution Theorem Proving Algorithm
20Resolution Theorem Proving Algorithm
- Given a set of WFF K, and a sentence s
- Task find out if s can be derived from K (Note
this is the same as asking if the statement K gt
s is true) - Convert all the sentences in K into clauses in
CNF - Convert s to s (negation of s) Do you smell a
proof by refutation here? ? - Convert s into a clause in CNF
- Combine all the clauses obtained in 1) and 2)
into a single set G (G s U K) - Iteratively apply the resolution procedure on a
pair of clauses in G and add the resolvents to G
until - There are no more new resolvents that can be
added and return FALSE K gt s is false - The empty clause is produced (a contradiction is
found) and return TRUE Yes, K implies s
21Resolution Theorem Proving Block World Example
- Given set K (of facts)
- BAT_OK (battery is ok)
- CNF BAT_OK
- MOVES (robot arm is not moving)
- CNF MOVES
- BAT_OK LIFTABLE ? MOVES (if the battery is ok
and the object is liftable, then the robot arm
moves) - What is the disjunction of literals?
- CNF BAT_OK, LIFTABLE, MOVES
- Prove LIFTABLE (the object is too heavy, thus
not liftable by the robot arm)
22Resolution Theorem Proving Block World Example
23Resolution Theorem Proving Block World Example
- Q Can we implement resolution theorem
- proving as a search procedure?
- A Yes, we started with a bunch of
- statements and ended in an empty set
24Treating Resolution Theorem Proving as a Search
Problem
- Initial state the set of clauses G K U s in
CNF - K the set of facts about a domain
- s negation of the conclusion s that we want to
prove given K - Goal State
- The empty clause contradiction
- Reminder deriving a contradiction in a proof by
refutation means that s has to be true since
otherwise we will have a contradiction - Operator the resolution procedure that produces
a resolvent R given two clauses C1, C2 from G - G (G - C1, C2) U R
25Treating Resolution Theorem Proving as a Search
Problem (Contd)
- Since theorem proving can be viewed as a search
problem, we need a search strategy! - One naïve approach is to use randomized search
- Randomly picked a pair of clauses X, Y from the
set G - If resolve(X,Y) can produce a resolvent R, take
away X, Y from G and add R to G. Otherwise,
repeat 1) until a resolvent can be produced - Repeat steps 1) to 2) until G
26Treating Resolution Theorem Proving as a Search
Problem (Contd)
- Since naïve approach doesnt work well, we need
- to ask two questions to make a feasible search
- algorithm
- Q1 Which pair of clauses should be resolved
first? - We need a search strategy
- Q2 What is the search tree? (Hint a tree
implies there are levels in the tree) - 0th level resolvents all the original clauses
(the set K) plus the clausal form of the negation
of the WFF to be proved - (i1)th level resolvents any resolvent of an ith
level resolvent, plus a jth level resolvent where
j lt i
27Treating Resolution Theorem Proving as a Search
Problem (Contd)
- Uninformed search
- Breadth first search
- Generates one level of resolvents before another
until the empty clause is found - Depth first search
- Generates a resolvent at level i, then a
resolvent at level i1, using resolvents from the
current and/or previous levels backtrack if
search is stuck. Stops when the empty clause is
found.
28Treating Resolution Theorem Proving as a Search
Problem (Contd)
- Informed search use heuristic to guide the
- selection of a pair of clauses for resolution
- Unit-preference strategy
- We prefer to first resolve clauses with a single
literal - Linear-input strategy
- Only allows those resolutions in which one of the
clauses being resolved is either - a member of the original set of clauses (set K)
- the negation of the target clause to be proved
(s)
29Example of Linear Input Strategy
S
K
resolvents
30Conclusion
- A proof system allows us to construct proofs in a
systematic way - A theorem prover can be used to decide if a
statement is true or not if the proof system is
decidable - Resolution is a rule of inference we use it to
derive new facts (just like Modus Ponens) - A resolution theorem prover uses resolution as
the inference procedure and it can be implemented
as a search algorithm - This implies that theorem proving can be viewed
as a search problem