Module 4.1: Knowledge and Reasoning

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Module 4.

1: Knowledge and Reasoning


1

Module: 4.2
Knowledge and Reasoning
Motivation:
Motivation of this module is to provide the students with the knowledge of FOL and to find inference in FOL.

Syllabus:

Lecture Content Duration Self-Study


no (Hrs)
(Hr)
1 Inference in FOL, Forward chaining, backward Chaining 1 1

2 Knowledge Engineering in First-Order Logic, Unification, 1


Resolution

Learning Objective:
Learner should know about the inference in FOL, Forward Chaining and Backward
Chaining, Knowledge Engineering in First-Order Logic, Unification and Resolution.

Theoretical Background:

Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences.
Before understanding the FOL inference rule, let's understand some basic terminologies used in
FOL. Substitution is a fundamental operation performed on terms and formulas. It occurs in all
inference systems in first-order logic. The substitution is complex in the presence of quantifiers in
FOL. If we write F[a/x], so it refers to substitute a constant "a" in place of variable "x".

Key Definitions:

Equality:

First-Order logic does not only use predicate and terms for making atomic sentences but also uses
another way, which is equality in FOL. For this, we can use equality symbols which specify that the
two terms refer to the same object.
Course Content:

Lecture : 1

Inference in FOL

Forward chaining
Module 4.1: Knowledge and Reasoning
3

Backward chaining
Let’s check the take away from this lecture

Exercise
Q.1. Translate the following statement into FOL.
“For every a, if a is a philosopher, then a is a scholar”
a) ∀ a philosopher(a) scholar(a)
b) ∃ a philosopher(a) scholar(a)
c) (a) and (b)
d) neither (a) nor (b)

Learning from this lecture: Learners will be able to understand Inference in FOL, Forward chaining
and backward Chaining.

Lecture : 2

Knowledge Engineering in FOL


1. Identify the task (what to talk about)
2. Assemble the relevant knowledge
3. Decide on a vocabulary of predicates, functions, and constants
4. Encode general knowledge about the domain
5. Encode a description of the specific problem instance
6. Pose queries to the inference procedure and get answers
7. Debug the knowledge base

E.g Design Knowledge Engineering in FOL for Full adder

Unification
Q(x)
P(y) 🡪 FAIL
P(x)
P(y) 🡪 x/y
P(Marcus)
P(y) 🡪 Marcus/y
P(Marcus)
P(Julius) 🡪 FAIL
P(x,x)
P(y,y) 🡪 (y/x)
P(y,z) 🡪 (z/y , y/x)
Module 4.1: Knowledge and Reasoning
5

Algorithm Unify(L1,L2)
1. If L1 or L2 is a variable or constant, then:
a) If L1 and L2 are identical, then return NIL.
b) Else if L1 is a variable, then if L1 occurs in L2 then return FAIL, else return {(L2/L1)}.
c) Else if L2 is a variable, then if L2 occurs in L1 then return FAIL, else return {(L1/L2)}.
d) Else return FAIL.
2. If the initial predicate symbols in L1 and L2 are not identical, then return FAIL.
3. If L1 and L2 have a different number of arguments, then return FAIL
4. Set SUBST to NIL.
5. For i 🡨 1 to number of arguments in L1:
a) Call Unify with the ith argument of L1 and the ith argument of L2, putting result in S.
b) If S = FAIL then return FAIL.
c) If S is not equal to NIL then:
i. Apply S to the remainder of both L1 and L2.
ii. SUBST := APPEND(S, SUBST).
6. Return SUBST.
Resolution

Axioms in clause form:


1. man(Marcus)
2. Pompeian(Marcus)
3. ¬ Pompeian(x1) v Roman(x1)
4. Ruler(Caesar)
5. ¬ Roman(x2) v loyalto(x2, Caesar) v hate(x2, Caesar)
6. loyalto(x3, f1(x3))
7. ¬ man(x4) v ¬ ruler(y1) v ¬ tryassassinate(x4, y1) v loyalto (x4, y1)
8. tryassassinate(Marcus, Caesar)
An unsuccessful attempt at resolution

Resolution Refutation
Module 4.1: Knowledge and Reasoning
7

Let’s check the take away from this lecture

Exercise

Q.2 The process of finding the substitutions needed to make two predicate calculus expressions
match is called ______________________
a. Universal
b. Existential
c. Predicate
d. Unification

Learning from this lecture: Learners will be able to understand Knowledge Engineering in
First-Order Logic, Unification and Resolution.

Conclusion
This chapter was introduction to how to find inference in FOL with the help of F/W, B/W chaining,
Unification and Resolution.

Short Answer Questions:


Q.1 Tabulate the difference between forward chaining and backward chaining.
Q.2 Describe how to find inference in FOL.
Q.3 State “unification”
Q.4 Explain steps for resolution.

Long Answer Questions:


Q. 1. Prove by resolution that Marcus is not alive now
– Marcus was a man
– Marcus was a Pompeian
– Marcus was born in 40 A.D.
– All men are mortal
– All Pompeians died when volcano erupted in 79 A.D.
– No mortal lives longer than 150 years
– It is now 1991
– Alive means not dead
– If someone dies, then he is dead at all later times

Q.2. From “Horse are animals”, it follows that “The head of the Horse is the head of an animal”.
Demonstrate that this inference is valid by carrying out the following steps:
(i) Translate the premise and the conclusion into the language of the first order logic. Use three
predicates HeadOf(h,x), Horse(x) and Animal(x)
(ii) Negate the conclusion and convert the premise and negated conclusion into conjunctive normal
form.
(iii) Use resolution to show that the conclusion follows from the premise.

References:
Books:
Title Authors Publisher Edition Year Chapter
No
1 Artificial Stuart J. Russell and Peter McGraw 3rd
Intelligence a Norvig Hill Edition
Modern 2009
Approach
2 A First Course in Deepak Khemani McGraw 1st
Artificial Hill Edition
Intelligence Education 2013
(India)

Online Resources:
● https://nptel.ac.in/courses/106/102/106102220/
● https://www.javatpoint.com/history-of-artificial-intelligence
● http://people.eecs.berkeley.edu/~russell/slides/

You might also like