0% found this document useful (0 votes)
2 views

3.4 Resolution

The document discusses the concept of Resolution in Artificial Intelligence, detailing its origins in Mathematical Logic and its application as a complete inference algorithm. It outlines the Resolution Principle, the algorithm for resolution, and the steps to convert statements into Conjunctive Normal Form (CNF). Additionally, it provides examples of resolution in both propositional and first-order predicate logic, demonstrating how to prove conclusions through resolution and the significance of this method in AI and automated reasoning.

Uploaded by

Neela K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

3.4 Resolution

The document discusses the concept of Resolution in Artificial Intelligence, detailing its origins in Mathematical Logic and its application as a complete inference algorithm. It outlines the Resolution Principle, the algorithm for resolution, and the steps to convert statements into Conjunctive Normal Form (CNF). Additionally, it provides examples of resolution in both propositional and first-order predicate logic, demonstrating how to prove conclusions through resolution and the significance of this method in AI and automated reasoning.

Uploaded by

Neela K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

III VI

20CSPC601

ARTIFICIAL INTELLIGENCE

UNIT No. 3

3.5 Resolution

Version: 1.XX
CS8691
ARTIFICIAL INTELLIGENCE

RESOLUTION

Resolution is in itself a very wide topic and is nowadays very widely used in
Computer Science and Artificial Intelligence. Resolution has its roots in
Mathematical Logic. One of the main reasons why I selected Resolution as my
topic for presentation is that I wanted to have in-depth knowledge about
Resolution and wanted to clear my fundamentals about mathematical logic. It
was a very knowledgeable experience to gather information about Resolution and
cover such a vast topic in a 15 minute presentation.

Resolution was invented in 1965 by a Mathematician called Alan Robinson.

Definition: Resolution yields a complete inference algorithm when coupled

with any complete search algorithm.

Resolution makes use of the inference rules. Resolution performs deductive


inference. Resolution uses proof by contradiction.

One can perform Resolution from a Knowledge Base. A Knowledge Base is a


collection of facts or one can even call it a database with all facts.

Resolution Principle:

l1 v … v lk, m1 v … v mn

l1v...v li-1 v li+1 v...v lk v m1v...v mj-1v mj-1v...v mn

li and mj are complementary literals.

Resolution takes two clauses and produces a new clause containing all the literals
of the two original clauses except the two complementary literals.
CS8691
ARTIFICIAL INTELLIGENCE

Resolution Algorithm

Resolution basically works by using the principle of proof by contradiction. To


find the conclusion we should negate the conclusion. Then the resolution rule is
applied to the resulting clauses. Each clause that contains complementary literals
is resolved to produce a new clause, which can be added to the set of facts
(if it is not already present). This process continues until one of the two things
happen:
● There are no new clauses that can be added
● An application of the resolution rule derives the empty clause

An empty clause shows that the negation of the conclusion is a complete


contradiction, hence the negation of the conclusion is invalid or false or the
assertion is completely valid or true.

Algorithm
function PL-RESOLUTION (KB, @) returns true or false

inputs: KB, the knowledge base, group of sentences/facts in

propositional logic @, the query, a sentence in propositional logic


clauses → the set of clauses in the CNF representation of KB ^ @

new → { }
loop do
for each Ci, Cj in clauses do

resolvents → PL-RESOLVE (Ci, Cj)

if resolvents contains the empty clause the


return true new → new union resolvents
CS8691
ARTIFICIAL INTELLIGENCE

if new is a subset of clauses then return


false clauses → clauses union true

Steps for Resolution

● Convert the given statements in Predicate/Propositional Logic


● Convert these statements into Conjunctive Normal Form
● Negate the Conclusion (Proof by Contradiction)
● Resolve using a Resolution Tree (Unification)

Steps to Convert to CNF (Conjunctive Normal Form)


Every sentence in Propositional Logic is logically equivalent to a conjunction of
disjunctions of literals. A sentence expressed as a conjunction of disjunctions of
literals is said to be in Conjunctive normal Form or CNF.
1. Eliminate implication “→”

a → b = ~a v b

~ (a ^ b) = ~ a v ~ b................................... DeMorgan’s Law

~ (a v b) = ~ a ^ ~ b.................................... DeMorgan’s Law

~ (~a) = a

2. Eliminate Existential Quantifier “∃”

To eliminate an independent Existential Quantifier, replace the variable by


a Skolem constant. This process is called Skolemization.
Example: y: President (y)

Here ‘y’ is an independent quantifier so we can replace ‘y’ by any


name (say – George Bush).
So, ∃y: President (y) becomes President (George Bush).
CS8691
ARTIFICIAL INTELLIGENCE

To eliminate a dependent Existential Quantifier we replace its


variable by the Skolem Function that accepts the value of ‘x’ and returns
the corresponding value of ‘y.’
Example: "x : $y : father_of (x, y)

Here ‘y’ is dependent on ‘x’, so we replace ‘y’ by S(x).

So, "x : ∃y : father_of (x, y) becomes "x : $y : father_of (x, S(x)).

3. Eliminate Universal Quantifier ‘"’

To eliminate the Universal Quantifier, drop the prefix in PRENEX


NORMAL FORM i.e. just drop " and the sentence then becomes in
PRENEX NORMAL FORM.

4. Eliminate AND ‘^’

a ^ b splits the entire clause into two separate clauses i.e. a and b

(a v b) ^ c splits the entire clause into two separate clauses a v b and c (a ^ b) v


c splits the clause into two clauses i.e. a v c and b v c
To eliminate ‘^’ break the clause into two, if you cannot break the
clause, distribute the OR ‘v’ and then break the clause.
EXAMPLE

Problem Statement:

1. Ravi likes all kinds of food.


2. Apples and chicken are food
3. Anything anyone eats and is not killed is food
4. Ajay eats peanuts and is still alive
5. Rita eats everything that Ajay eats
CS8691
ARTIFICIAL INTELLIGENCE

Prove by resolution that Ravi likes peanuts using resolution.

Solution:

Step 1: Converting the given statements into Predicate/Propositional Logic

A. "x : food(x) ® likes (Ravi, x)


B. food (Apple) ^ food (chicken)
C. "a : "b: eats (a, b) ^ killed (a) ® food (b)
D. eats (Ajay, Peanuts) ^ alive (Ajay)
E. "c : eats (Ajay, c) ® eats (Rita, c)
F. "d : alive(d) ® ~killed (d)
G. "e: ~killed(e) ® alive(e)
H. Conclusion: likes (Ravi, Peanuts)

Step 2: Convert into CNF

1. ~food(x) v likes (Ravi, x)


2. Food (apple)
3. Food (chicken)
4. ~ eats (a, b) v killed (a) v food (b)
5. Eats (Ajay, Peanuts)
6. Alive (Ajay)
7. ~eats (Ajay, c) V eats (Rita, c)
8. ~alive (d) v ~ killed (d)
9. Killed (e) v alive (e)

Conclusion: likes (Ravi, Peanuts)

Step 3: Negate the conclusion


CS8691
ARTIFICIAL INTELLIGENCE

~ likes (Ravi, Peanuts)

Step 4: Resolve using a resolution tree

Hence we see that the negation of the conclusion has been proved as a
complete contradiction with the given set of facts.
Hence the negation is completely invalid or false or the assertion is
completely valid or true.
Hence Proved

Explanation of Resolution Tree (Unification)


CS8691
ARTIFICIAL INTELLIGENCE

In the first step of the resolution tree, ~ likes (Ravi, Peanuts) and likes (Ravi, x)
get resolved (cancelled). So we are only left with ~food (peanuts). In this ‘x’ is
replaced by peanuts i.e. ‘x’ is bound to peanuts.

In the second step of the resolution tree, ~food(peanuts) and food (b) get resolved,
so we are left with ~eats (a, peanuts) v killed(a). In this ‘b’ is bound to peanuts thus
we replace every instance of ‘b’ by Peanuts in that particular clause. Thus now we
are left with ~eats (a, peanuts) v killed (a).

In the third step of the resolution tree, ~eats (a, peanuts) and eats (Ajay, peanuts)
gets resolved. In this ‘a’ is bound to Ajay. So we replace every instance of ‘a’ by
Ajay. Thus now we are left with killed (Ajay).

In the forth step of the resolution tree, killed (Ajay) and ~killed (d) get resolved.
In this ‘d’ is bound to Ajay, thus ever instance of ‘d’ is replaced by Ajay. Now we
are left with

~alive(Ajay).

In the fifth step of the resolution tree, ~Alive(Ajay) and Alive(Ajay) get resolved
and we are only left with a null set.

Uses of Resolution in Today’s World

Helps in the development of computer programs to automate reasoning and

theorem proving

● Used widely in AI.


● Helps in Forward and Backward Reasoning
● Resolution is a proof by contradiction which is even used in Math problems.
Resolution in FOL
CS8691
ARTIFICIAL INTELLIGENCE

Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also


known as a unit clause.

Conjunctive Normal Form: A sentence represented as a conjunction of clauses is


said to be conjunctive normal form or CNF.

The process followed to convert the propositional logic into resolution method
contains the below steps:

● Convert the given axiom into clausal form, i.e., disjunction form.
● Apply and proof the given goal using the negation rule.
● Use those literals which are needed to prove.
● Solve the clauses together and achieve the goal.
But, before solving problems using Resolution method, let’s understand two
normal forms
Conjunctive Normal Form (CNF)
In propositional logic, the resolution method is applied only to those clauses which
are disjunctioned by literals. There are following steps used to convert into CNF:
1) Eliminate bi-conditional implication by replacing A ⇔ B with (A → B) Ʌ (B

→A)

2) Eliminate implication by replacing A → B with ¬A V B.


3) In CNF, negation(¬) appears only in literals, therefore we move it inwards as:

● ¬ ( ¬A) ≡ A (double-negation elimination

● ¬ (A Ʌ B) ≡ ( ¬A V ¬B) (De Morgan)

● ¬(A V B) ≡ ( ¬A Ʌ ¬B) (De Morgan)

4) Finally, using distributive law on the sentences, and form the CNF as:
CS8691
ARTIFICIAL INTELLIGENCE

(A1 V B1) Ʌ (A2 V B2) Ʌ …. Ʌ (An V Bn).


Note: CNF can also be described as AND of ORS
Disjunctive Normal Form (DNF)
This is a reverse approach of CNF. The process is similar to CNF with the
following difference:
(A1 Ʌ B1) V (A2 Ʌ B2) V…V (An Ʌ Bn). In DNF, it is OR of ANDS, a sum of
products, or a cluster concept, whereas, in CNF, it is ANDs of Ors.
Example OF Propositional Resolution
Consider the following Knowledge Base:

1. The humidity is high or the sky is cloudy.


2. If the sky is cloudy, then it will rain.
3. If the humidity is high, then it is hot.
4. It is not hot.
Goal: It will rain.
Use propositional logic and apply a resolution method to prove that the goal is
derivable from the given knowledge base.
Solution: Let’s construct propositions of the given sentences one by one:

1. Let, P: Humidity is high.


Q: Sky is cloudy.
It will be represented as P V Q.
2. Q: Sky is cloudy. …from(1)
Let, R: It will rain.
It will be represented as bQ → R.
3. P: Humidity is high. …from(1)
Let, S: It is hot.
CS8691
ARTIFICIAL INTELLIGENCE

It will be represented as P → S.
4. ¬S: It is not hot.

Applying resolution method:


In (2), Q → R will be converted as (¬Q V R)

In (3), P → S will be converted as (¬P V S)


Negation of Goal (¬R): It will not rain.
Finally, apply the rule as shown below:

After applying Proof by Refutation (Contradiction) on the goal, the problem is


solved, and it has terminated with a Null clause ( Ø ). Hence, the goal is achieved.
Thus, It is not raining.
Note: We can have many examples of Proposition logic which can be proved with
the help of Propositional resolution method.
CS8691
ARTIFICIAL INTELLIGENCE

Resolution Method in FOPl/ Predicate Logic


Resolution method in FOPL is an uplifted version of propositional resolution
method.
In FOPL, the process to apply the resolution method is as follows:

● Convert the given axiom into CNF, i.e., a conjunction of clauses. Each
clause should be a dis-junction of literals.
● Apply negation on the goal given.
● Use literals which are required and prove it.
● Unlike propositional logic, FOPL literals are complementary if one unifies
with the negation of another literal.
For example: {Bird(F(x)) V Loves(G(x), x)} and {¬Loves(a, b) V ¬Kills(a, b)}
Eliminate the complementary literals Loves(G(x),x) and Loves(a,b)) with θ
={a/G(x), v/x} to give the following output clause:
{Bird(F(x)) V ¬Kills(G(x),x)}
The rule applied on the following example is called Binary Resolution as it has
solved exactly two literals. But, binary resolution is not complete. An alternative
approach is to extend the factoring i.e., to remove redundant literals to the first
order case. Thus, the combination of binary resolution and factoring is complete.
Conjunctive Normal Form
There are following steps used to convert into CNF:
● Eliminate the implications as:
∀x: A(x) → B(x) with {¬ x: ¬A( ∀x) V B(x)}

● Move negation (¬) inwards as:


¬∀x: A becomes ∃x: ¬A and,
¬∃x: A becomes ∀x: ¬A
CS8691
ARTIFICIAL INTELLIGENCE

It means that the universal quantifier becomes an existential quantifier and vice-
versa.

● Standardize variables: If two sentences use the same variable, it is required


to change the name of one variable. This step is taken so as to remove the
confusion when the quantifiers will be dropped.
For example: { ∀x: A(x) V ∀x: B(x)}

● Skolemize: It is the process of removing existential quantifiers through


elimination.
● Drop universal quantifiers: If we are on this step, it means all remaining
variables must be universally quantified. Drop the quantifier.
● Distribute V over Ʌ: Here, the nested conjunction and disjunction are
flattened.
Example of FOPL resolution
Consider the following knowledge base:

1. Gita likes all kinds of food.


2. Mango and chapati are food.
3. Gita eats almonds and is still alive.
4. Anything eaten by anyone and is still alive is food.
Goal: Gita likes almonds.
Solution: Convert the given sentences into FOPL as:
Let, x be the light sleeper.

1. ∀x: food(x) → likes(Gita,x)


2. food(Mango),food(chapati)
CS8691
ARTIFICIAL INTELLIGENCE

3. ∀x∀y: eats(x,y) Ʌ ¬ killed(x → food(y)

4. eats(Gita, almonds) Ʌ alive(Gita)


5. ∀x: ¬killed(x) → alive(x)
6. ∀x: alive(x) → ¬killed(x)
Goal: likes(Gita, almond)
Negated goal: ¬likes(Gita, almond)
Now, rewrite in CNF form:

1. ¬food(x) V likes(Gita, x)
2. food(Mango),food(chapati)
3. ¬eats(x,y) V killed(x) V food(y)
4. eats(Gita, almonds), alive(Gita)
5. killed(x) V alive(x)
6. ¬alive(x) V ¬killed(x)
Finally, construct the resolution graph:
CS8691
ARTIFICIAL INTELLIGENCE

Hence, we have achieved the given goal with the help of Proof by Contradiction.
Thus, it is proved that Gita likes almond.
The resolution inference rule:

The resolution rule for first-order logic is simply a lifted version of the
propositional rule. Resolution can resolve two clauses if they contain
complementary literals, which are assumed to be standardized apart so that they
share no variables.

Where li and mj are complementary literals.


CS8691
ARTIFICIAL INTELLIGENCE

This rule is also called the binary resolution rule because it only resolves exactly
two literals.

Example:

We can resolve two clauses which are given below:

[Animal (g(x) V Loves (f(x), x)]


and
[¬ Loves(a, b) V ¬Kills(a, b)]
Where two complementary literals are: Loves (f(x), x) and ¬ Loves
(a, b)
These literals can be unified with unifier θ= [a/f(x), and b/x] , and it will generate a
resolvent clause:
[Animal (g(x) V ¬ Kills(f(x), x)].

Steps for Resolution:

1. Conversion of facts into first-order logic.

2. Convert FOL statements into CNF

3. Negate the statement which needs to prove (proof by contradiction)

4. Draw resolution graph (unification).

To better understand all the above steps, we will take an example in which we will
apply resolution.

Example:

a. John likes all kind of food.


CS8691
ARTIFICIAL INTELLIGENCE

b. Apple and vegetable are food

c. Anything anyone eats and not killed is food.

d. Anil eats peanuts and still alive

e. Harry eats everything that Anil eats.


Prove by resolution that:
f. John likes peanuts.

Step-1: Conversion of Facts into FOL

In the first step we will convert all the given statements into its first order logic.

Step-2: Conversion of FOL into CNF

In First order logic resolution, it is required to convert the FOL into CNF as CNF
form makes easier for resolution proofs.
● Eliminate all implication (→) and rewrite

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)

c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)


CS8691
ARTIFICIAL INTELLIGENCE

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀x ¬ eats(Anil, x) V eats(Harry, x)

f. ∀x¬ [¬ killed(x) ] V alive(x)

g. ∀x ¬ alive(x) V ¬ killed(x)

h. likes(John, Peanuts).

● Move negation (¬)inwards and rewrite

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)

c. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y)

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀x ¬ eats(Anil, x) V eats(Harry, x)

f. ∀x ¬killed(x) ] V alive(x)

g. ∀x ¬ alive(x) V ¬ killed(x)

h. likes(John, Peanuts).

● Rename variables or standardize variables

a. ∀x ¬ food(x) V likes(John, x)

b. food(Apple) Λ food(vegetables)

c. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)

d. eats (Anil, Peanuts) Λ alive(Anil)

e. ∀w¬ eats(Anil, w) V eats(Harry, w)


CS8691
ARTIFICIAL INTELLIGENCE

f. ∀g ¬killed(g) ] V alive(g)

g. ∀k ¬ alive(k) V ¬ killed(k)

h. likes(John, Peanuts).

● Eliminate existential instantiation quantifier by elimination.

In this step, we will eliminate existential quantifier ∃, and

this process is known as Skolemization. But in this example

problem since there is no existential quantifier so all the

statements will remain same in this step.

● Drop Universal quantifiers.

In this step we will drop all universal quantifier since all the statements are

not implicitly quantified so we don't need it.

a. ¬ food(x) V likes(John, x)

b. food(Apple)

c. food(vegetables)

d. ¬ eats(y, z) V killed(y) V food(z)

e. eats (Anil, Peanuts)

f. alive(Anil)

g. ¬ eats(Anil, w) V eats(Harry, w)

h. killed(g) V alive(g)

i. ¬ alive(k) V ¬ killed(k)
j. likes(John, Peanuts).
CS8691
ARTIFICIAL INTELLIGENCE

Note: Statements "food(Apple) Λ food(vegetables)" and "eats (Anil, Peanuts) Λ


alive(Anil)" can be written in two separate statements.

● Distribute conjunction ∧ over disjunction ¬.

This step will not make any change in this problem.

Step-3: Negate the statement to be proved

In this statement, we will apply negation to the conclusion statements, which will
be written as ¬likes(John, Peanuts)

Step-4: Draw Resolution graph:

Now in this step, we will solve the problem by resolution tree using substitution.
For the above problem, it will be given as follows:
CS8691
ARTIFICIAL INTELLIGENCE

Hence the negation of the conclusion has been proved as a complete contradiction
with the given set of statements.

Explanation of Resolution graph:

● In the first step of resolution graph, ¬likes(John, Peanuts) , and likes(John,

x) get resolved(canceled) by substitution of {Peanuts/x}, and we are left

with ¬ food(Peanuts)

● In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get

resolved (canceled) by substitution of { Peanuts/z}, and we are left with ¬

eats(y, Peanuts) V killed(y) .

● In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil,

Peanuts) get resolved by substitution {Anil/y}, and we are left with

Killed(Anil) .

● In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get

resolve by substitution {Anil/k}, and we are left with ¬ alive(Anil) .

● In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get

resolved.

You might also like