Topic For The Class:: Knowledge and Reasoning
Topic For The Class:: Knowledge and Reasoning
Module-V
KNOWLEDGE and REASONING
Chapter 9: Inference in First-Order Logic
Dr. K. Srinivasa Rao
Associate Professor
Department of CSE
GITAM Institute of Technology (GIT)
Visakhapatnam – 530045
Email: [email protected]
Mobile: 98486 73655
Department of CSE, GIT ECS302: AI 1
9.1 Propositional vs. First-Order Inference
Inference Rules for Quantifiers:
Suppose we have: ‘All greedy kings are evil’.
∀ x King(x) Ʌ Greedy(x) Evil(x)
This rule says that we can infer any sentence obtained by substituting a ground term (a term without variables) for
the variable.
Let SUBST (θ, α) denote the result of applying the substitution θ to the sentence α.
Ex: The three sentences given earlier (in slide 2) are obtained with the substitutions:
{ x / John }, { x / Richard }, { x / Father(John) }
Existential Instantiation:
For any sentence α, variable v and constant symbol k that does not appear elsewhere in KB,
We apply UI to the first sentence using all possible ground term substitutions from the vocabulary of the KB,
in this case, { x / John } and { x / Richard }.
We obtain:
King(John) Ʌ Greedy(John) Evil(John)
King(Richard) Ʌ Greedy(Richard) Evil(Richard)
Unification:
It is a process of finding substitutions that make different logical expressions look identical.
It takes two sentences and returns a unifier for them, if one exists.
In the last one, the problem arises because of the usage of the same variable x in both the sentences.
If we standardize apart one of the two sentences (that is, renaming its variables to avoid clashes),
We say that the first unifier is more general than the second,
because it places fewer restrictions on the values of the variables.
For every unifiable pair of expressions, there is a single Most General Unifier (MGU).
In this case, it is { y / John, x / z }.
Example Problem:
‘The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of
America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American.’
Sentences in FOL:
1. It is a crime for an American to sell weapons to hostile nations.
American(x) Ʌ Weapon(y) Ʌ Sells(x, y, z) Ʌ Hostile(z) Criminal(x)
7. West is an American.
American(West)
Forward chaining considers atomic sentences and tries to satisfy the premises of rules.
This leads to inference of new sentences and thereby proof of a goal.
Explanation:
Starting from the known facts, it triggers all the rules whose premises are satisfied, adding their conclusions to
the known facts.
The process repeats until the query is answered or new facts are added.
FOL-FC-ASK is:
Sound, because every inference is just an application of Generalized Modus Ponens, which is sound.
Complete for definite clause KBs; i.e., it answers every query whose answers are entailed by any KB of definite
clauses.
Algorithm:
Explanation:
Compose(θ1, θ2) is the substitution whose effect is identical to the effect of applying each substitution in turn.
That is,
SUBST(Compose(θ1, θ2) , p) = SUBST(θ2, SUBST(θ1, p))
In the algorithm, the current variable bindings, which are stored in θ, are composed with the bindings resulting
from unifying the goal with the clause head, giving a new set of current bindings for the recursive call.
becomes in CNF,
Every sentence of first-order logic can be converted into an inferentailly equivalent CNF sentence.
Procedure:
Ex: Everyone who loves all animals is loved by someone.
Steps:
1. Eliminate Implications
∀x [∀y ¬Animal(y) V Loves(x, y)] [Ǝy Loves(y, x)]
∀x [¬∀y ¬Animal(y) V Loves(x, y)] V [Ǝy Loves(y, x)]
2. Move ¬ inwards
We have
3. Standardize variables:
Sentences like (∀x P(x)) V (Ǝx Q(x)) can be written as (∀x P(x)) V (Ǝy Q(y))
Thus we have,
4. Skolemize:
Skolemization is the process of removing existential quantifiers by elimination.
Ǝx P(x) can be written as P(A) where A is a new constant.
So, our sentence becomes:
which has the wrong meaning entirely: it says that –
‘everyone either fails to love a particular animal A or is loved by some particular entity B’.
∀x
( F and G are Skolem Functions)
General Rule: The arguments of the Skolem function are all the universally quantified variables in whose scope
the existential quantifier appears.
5. Drop Universal quantifiers:
At this point, all remaining variables must be universally quantified. We can drop the universal quantifiers.
6. Distribute Ʌ over V:
We have
Ex: Consider
1.
2. Owns(Nono, M1 )
3. Missile(M1)
4.
5.
6.
7. American(West)
8. Enemy(Nono, America)
9. ¬Criminal(West) (Goal is negated [refutation], converted to a clause and added)
Proof:
¬Criminal(West) 1
x / West
Proof Continued:
¬Sells(West, M1, z) V ¬Hostile(z) 4
x / M1 , z / Nono
¬Owns(Nono, M1 ) V ¬Hostile(Nono) 2
Nil
¬Hostile(Nono) 6
x / Nono
8 ¬Enemy(Nono, America)
Contradiction
Hence, ‘West is Criminal’ is proved.
Department of CSE, GIT ECS302: AI 35
Continued...
Chicken is food.
2. Food(Apples)
3. Food(Chicken)
2. Food(Apples)
3. Food(Chicken)
5. Eats(Bill, Peanuts)
6. Alive(Bill)
Problem 2:
Given the following information for a database:
1. If x is on top of y, y supports x.
2. If x is above y and they are touching each other, x is on top of y.
3. A cup is above a book.
4. A cup is touching a book.
Translate these statements into clausal form. Show that ‘Supports(Book, Cup)’ is true using resolution.
Problem 3:
Represent the following facts in first-order logic and convert them into clause form.
Use resolution to find that ‘Ravi is the spy’.
5. One of Raman, Ravi, Raghu and Ramesh is the spy.
6. Raman is not the spy.
7. Spies wear light coloured dresses and do not attract attention of others.
8. Raghu was wearing a dark coloured suit.
9. Ramesh was the centre of attention on that evening.
****
Department of CSE, GIT ECS302: AI 41