3.4 Resolution
3.4 Resolution
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 Principle:
l1 v … v lk, m1 v … v mn
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
Algorithm
function PL-RESOLUTION (KB, @) returns true or false
new → { }
loop do
for each Ci, Cj in clauses do
a → b = ~a v b
~ (~a) = a
a ^ b splits the entire clause into two separate clauses i.e. a and b
Problem Statement:
Solution:
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
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.
theorem proving
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)
4) Finally, using distributive law on the sentences, and form the CNF as:
CS8691
ARTIFICIAL INTELLIGENCE
It will be represented as P → S.
4. ¬S: It is not hot.
● 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)}
It means that the universal quantifier becomes an existential quantifier and vice-
versa.
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.
This rule is also called the binary resolution rule because it only resolves exactly
two literals.
Example:
To better understand all the above steps, we will take an example in which we will
apply resolution.
Example:
In the first step we will convert all the given statements into its first order logic.
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)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
g. ∀x ¬ alive(x) V ¬ killed(x)
h. likes(John, Peanuts).
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
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).
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
f. ∀g ¬killed(g) ] V alive(g)
g. ∀k ¬ alive(k) V ¬ killed(k)
h. likes(John, Peanuts).
In this step we will drop all universal quantifier since all the statements are
a. ¬ food(x) V likes(John, x)
b. food(Apple)
c. food(vegetables)
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
In this statement, we will apply negation to the conclusion statements, which will
be written as ¬likes(John, Peanuts)
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.
with ¬ food(Peanuts)
● In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get
● In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil,
Killed(Anil) .
● In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get
● In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get
resolved.