You are on page 1of 39

Knowledge Representation-

Resolution in predicate logic


Logical Representation Scheme
2 Step process:
I. Facts are represented as logical propositions and
II. Additional information is deduced from
these facts using backward chaining or
resolution
1. Converting facts to logical
propositions
• The first step is to convert facts in English sentence to logical
propositions(statements) called well-formed formulas (wffs).
• The wffs include the following symbols:
– Implies: →
– And: /\
– Or: \/
– Not: ~
– For all: ∀
– The exists: ∃
2. Deduce addition information using Resolution
— Resolution - Resolve something
— The process to prove a statement.
— Resolution produces proofs by refutation. It proves facts and
answers queries by refutation. This involves assuming the
fact/query is untrue and reaching a contradiction which
indicates that the opposite must be true.
— In other words, to prove a statement (i.e., to show that it
is valid), resolution attempts to show that the negation
of the statement produces a contradiction with the
known statements (i.e., that it is unsatisfiable).
— The wffs must firstly be converted to clause form before using
resolution.
— Resolution is a proof technique that works this way
1.select two clauses that contain conflicting terms.
2. Combine those two clauses and cancel out the
conflicting terms.
— The resolution procedure is a simple iterative process: at
each step, two clauses, called the parent clauses, are
compared (resolved), resulting in a new clause that has
inferred from them.
— The new clause represents ways that the two parent clauses
interact with each other.
— Resolution operates by taking two clauses that each contain
the same literal (ex: Winter). The literal must occur in the
positive form in one clause and in negative form in the other.
— The resolvent is obtained by combining all of the literals of
the two parent clauses except the ones that cancel.
— If the clause that produced is the empty clause, then a
contradiction has found.
— Ex: Suppose that there are two clauses in the system:
winterV summer
¬ winterV cold
— The two clauses Winter and ¬ winter will produce the
empty clause.
Algorithm: Resolution
— 1. Convert the wffs to clause form.
— 2. Add the fact (or query) P to be proved to the set of clauses:
i. Negate P.
ii. Convert negated P to clause form.
iii. Add the result of ii to the set of clauses.
— 3. Repeat
i. Select two clauses.
ii. Resolve the clauses using unification.
iii. If the resolvent clause is the empty clause, then a contradiction
has been reached.
If not add the resolvent to the set of clauses until (a contradiction is
found OR no progress can be made)
Steps in Resolution :
— 1. Converts facts into FOL
— 2. Converts FOL into CNF ( Conjuctive Normal Form )
— 3. Negate the statement to be proved , and add the result to the
knowledge base.
— 4. Draw Resolution graph
* if empty clause (NIL) is produced , stop and report that original
theorem is true
Algorithm: Converting wffs to Clause Form

1. Remove all implies, i.e. → by applying the following:


a → b is equivalent to ~a \/ b.

2. Use the following rules to reduce the scope of each negation


operator to a single term:
~(~a) = a
~(a /\ b) = ~a \/ ~b
~(a \/ b) = ~a /\ ~b
~∀x: p(x) = ∃x: ~p(x)
~∃x: p(x) = ∀x: ~p(x)
3. Each quantifier must be linked to a unique variable. For
example, consider ∀x: p(x) \/ ∀x: q(x). In this both
quantifiers are using the same variable and one must changed
to another variable: ∀x: p(x) \/ ∀y: q(y).

4. Apply the associative property of disjunctions:


a \/ (b \/ c) = (a \/ b) \/ c
and remove brackets giving a \/ b \/ c.
Resolution refutation proofs involves the following
steps:

— 1. Put the premises or axioms into clause form.


— 2. Add the negation of what is to be proved, in clause form,
to the set of axioms.
— 3. Resolve these clauses together, producing new clauses that
logically follow from them.
— 4. Produce a contradiction by generating the empty clause.
— 5. The substitutions used to produce the empty clause are
those under which the opposite of the negated goal is true.
Algorithm: Propositional Resolution
— 1. Convert all the propositions of F(set of axioms) to clause form.
— 2. Negate P and convert the result to clause form. Add it to the set of
clauses obtained in step 1.
— 3. Repeat until either a contradiction is found or no progress can be
made:
— a) Select two clauses. Call these the parent clauses.
— b) Resolve them together. The resulting clause, called the resolvent, will
be the disjunction of all of the literals of both of the parent clauses with
the following exception: If there are any pairs of literals L and ¬ L such
that one of the parent clauses contains L and the other contains ¬L, then select
one such pair and eliminate both L and ¬ L from the resolvent.
— c) If the resolvent is the empty clause, then a contradiction has been
found. If it is not, then add it to the set of classes available to the
procedure.
FACTS in Propositional logic
a → b is equivalent to ~a \/ b.
Prove R?
Resolution in Predicate Logic
— The resolution algorithm for predicate logic as follows,
assuming a set of given statements F and a statement to be
proved P:
— Algorithm:
— 1. Convert all the statements of F to clause form.
— 2. Negate P and convert the result to clause form. Add it to
the set of clauses obtained in 1.
— 3. Repeat until a contradiction found, no progress can
make, or a predetermined amount of effort has expanded.
— (a) Select two clauses. Call these the parent clauses.
— (b) Resolve them together. The resolvent will the disjunction
of all the literals of both parent clauses with appropriate
substitutions performed and with the following exception:
— If there is one pair of literals T1 and ¬T2 such that one of the parent
clauses contains T2 and the other contains T1 and if T1 and T2 are
unifiable, then neither T1 nor T2 should appear in the resolvent. We
call T1 and T2 Complementary literals. Use the substitution
produced by the unification to create the resolvent. If there is more
than one pair of complementary literals, only one pair should omit
from the resolvent.
— (c). If the resolvent is an empty clause, then a contradiction
has found. Moreover, If it is not, then add it to the set of
classes available to the procedure
Example 1:
Consider the given facts:
— 1. All dogs are animal.
— 2. Fido is a dog.
— 3. All animals will die.

— Prove ‘fido will die’ using resolution


Step 1 Convert stmt to FOL
— 1. All dogs are animal.
∀x: dog(x) → animal(x)
— 2. Fido is a dog.
Dog(Fido)
— 3. All animals will die.
∀y: animal(y) → die(y)
Step 2:Convert FOL to CNF
a → b is equivalent to ~a \/ b.
— 1. All dogs are animal.
∀x: dog(x) → animal(x)
¬ dog(x) \/ animal(x)
— 2. Fido is a dog.
dog(Fido)
— 3. All animals will die.
∀y: animal(y) → die(y)
¬ animal (y) \/ die (y)
Step 3: Negate the stmt to be proved
— Fido will die == die(Fido)
Negation: ¬ die(Fido)
STEP 4. DRAW RESOULTION GRAPH
(iii)
~die (fido) ~animal (y) V die (y)

ORing
fido/y

~animal (fido)
~dog(x) V animal (x) (i)

fido/x

~dog(fido) dog(fido) (ii)

Hence Proved
Example 2:
Consider the following facts:
1. John likes all kinds of food.
2. Apples are food.
3. Anything anyone eats and is not killed by is food.
4. Bill eats peanuts and is still alive.
5. Sue eats everything Bill eats.
a) Convert these facts to wffs in predicate logic.
b) Using resolution, prove that “John likes peanuts”.
Step 1:
Step 2:
a → b is equivalent to ~a \/ b.
— 1. ~ food(x) V likes(John,x)
— 2. food(apple)
— 3. ~ eats(x,y) V ~ alive (x) V food(y) #~killedby ==alive(x)
— 4.eats(ajay, peanut ) Ù alive(ajay)
— ~ food(x) V ~eats (ajay,x) V eats(Sue,x)
Step 3: Negate the stmt to be
proved
— John likes peanuts == likes(John,peanuts) (predicate stmt)
— Neagation: ~likes(John, peanuts)
Step 2:
a → b is equivalent to ~a \/ b.
— 1. ~ food(x) V likes(John,x)
— 2. food(apple)
— 3. ~ eats(x,y) V ~ alive (x) V food(y) # ~killedby ==alive(x)
— 4.eats(ajay, peanut ) Ù alive(ajay)
— ~ food(x) V ~eats (ajay,x) V eats(Sue,x)
STEP 4. DRAW RESOULTION GRAPH
(i)
~likes (john, peanut) ~food(x) V likes (John, x)

ORing
x, peanut

~food (peanut) ~eats(x, y) V ~alive (x) V ~food (y)


(iii)

y, peanut

~eats(x, peanut) V ~alive (x) eats(ajay, peanut) Ù alive(ajay) (iv)

x, ajay Rule: V~ = Ù

Hence Proved
Example 3: Lucky Student
— 1. Anyone passing his AI exam and winning the lottery is
happy.
— 2. Anyone who studies or is lucky can pass all his exams.
— 3. John did not study but he is lucky.
— 4. Anyone who is lucky wins the lottery.

— Prove that John is happy!


Example 5: Exciting life
— 1. All people that are not poor and are smart are
happy.
— 2. Those people that read are not stupid.
— 3. John can read and is wealthy.
— 4. Happy people have exiting lives.

Can anyone be found with an exciting life?

You might also like