0% found this document useful (0 votes)
76 views17 pages

Knowledge and Reasoning

This document discusses knowledge-based agents and knowledge representation. It describes knowledge-based agents as having two main levels: 1. A Knowledge Base (KB) that contains domain-specific facts and information about the environment. 2. An Inference Engine that uses domain-independent algorithms like propositional logic and resolution to infer new knowledge from the existing KB and choose actions. It also discusses how knowledge-based agents use a TELL mechanism to add new knowledge to the KB and an ASK mechanism to query the KB and decide on actions. The knowledge level describes the initial knowledge of the agent.

Uploaded by

MOVIETADKA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views17 pages

Knowledge and Reasoning

This document discusses knowledge-based agents and knowledge representation. It describes knowledge-based agents as having two main levels: 1. A Knowledge Base (KB) that contains domain-specific facts and information about the environment. 2. An Inference Engine that uses domain-independent algorithms like propositional logic and resolution to infer new knowledge from the existing KB and choose actions. It also discusses how knowledge-based agents use a TELL mechanism to add new knowledge to the KB and an ASK mechanism to query the KB and decide on actions. The knowledge level describes the initial knowledge of the agent.

Uploaded by

MOVIETADKA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CHA

TER
3 Knowledge and Reasoning

Unitll S
Syllabus
A
Nhowledge Based Agent, Overview
of Propositional Logic, First Order Predicate Logic, Interence
Predicate Logic: Forward and in First Order
Backward Chaining, Resolution.

Introduction:
Understanding theoretical or
practical aspects of a subject is called as
experience acquired based on the knowledge. We can gain knowledge
facts, information, etc. about the subject. through
After gaining
knowledge about some
problems related to that subject based onsubject we can apply that knowledge to derive conclusions about various
some reasoning.
We have studied various types of
agents in chapter 1. In this
chapter
agent", with a very interesting game example.
we are
going to see what is "knowledge based
We are also going to study how do
they store knowledge, how do they infer next level of
set. In turn, we are
studying various knowledge representation and inference methods in knowledge from the existing
this chapter
3.1 A
Knowledge Based Agent
As shown Fig. 3.1.1, a
knowledge based agents can be described at
Inference Engine. different levels:
Knowledge Base (KB) and an
Interence engine
Domain-independent algorithms
Knowledge base
Domain-specific content
Fig. 3.1.1: Levels of
1. Knowledge level knowledge base
Knowledge level is a base level of an
agent, which consists of
In this level agent has domain-specific content.
facts/information about the surrounding
not consider the actual
implementation. environment in which they does
2.
Implementation level are working, it o

implementation level consists of domain


structures used in knowledge base independent algorithms. At this
and level, agents
resolution. (We will be learning about algorithms which use can recognize the data
logic and resolution them. For
Knowledge based agents are crucial to in this example, propositional log and
use in chapter)
knowledge based agents make use of the partially observable
in order to infer
hidden aspects of the existing knowledge environments. Before choosing any ction,
current state. along with the current inputsts from
from the
t environme
As w e nave epresentdtro
environment (real world). Every single representation in the set is called as a sentence and sentences ar
statement which
can say that sentence
sa is a
expresses with the help of formal representation language. We
the help of knowledge representation language.
set of words that express some truth about the real world with

Declarative approach of building an agent makes use of TELL and ASK mechanism.

know in order to perform some action)


O TELL the agent, about surrounding environment (what it needs to
TELL mechanism is similar to taking input for a system.
ASK mechanism is
Then the agent can ASK itself what action should be carried out
to get desired output.
makes use of the knowledge base to
similar to producing output for a system. However, ASK mechanism
decide what it should do.
with the help of
function, the answer is generated
TELL and ASK mechanism involve inference. When you run ASK
with TELL function previously.
knowledge base, based on the knowledge which was added
TELL{K) : Is a function that adds knowledge K to the knowiedge base.

ASK(K): Is a function that queries the agent about the truth of K.


facts/information it perceives
carries out following operations : First, it TELLs the knowledge base about
An agent
carried out based on the input
of Then, it ASKs the knowledge base what action should be
with the help sensors.

it has received. Lastly, it performs the selected action with the help of effectors

1.1 Architecture of a KB Agent


logical level and
knowledge level,
Knowledge based agents can be implemented at three levels namely,

plementation level.

1 Knowledge level

2. Logical level

3. Implementation level

Knowledge Level
what it
The knowledge level describes agent by saying
It is the most abstract level of agent implementation.
knows. That is what knowledge the agent has as the initial knowledge.
that knowledge are defined in his level. Initial knowedge of
Basic data structures and procedures to access

knowledge base is called as background knowledge.


what the agent
viewed as an agent for which one only need to specify
Agents at the knowledge level can be
its behavior, regardless of how it is to be implemented.
knows and what its goals are in order to specify
know that the Golden Gate Bridge connects San Francisco with the marin

For example A taxi driving agent might


county.
Logical Level
to represent
This level uses some formal language
At the the knowledge is encoded into sentences.
logical level, order or
and first
representations we have are propositional logic
the knowledge the agent has. The two types of

predicate logic.
discussed in detail in the turther sections.
Both these representation techniques are

San Francisco, Marin County)


Forexample: Links(Golden Gate Bridge,
Artificial Intelligence(MU-Sem. 7-1T) 3-10
Knowledge and Reasoning
Logical representations
a)
(b) Production rule representations

(c) Semantic networks

(d) Frame representations

(a)Logical representation
The logical representations are mostly concerned with truth of statements regarding the world. These statements are
most generally represented using statements like TRUE or FALSE.
Logic is successfully used to define ways to infer new sentences from the existing ones. There are certain logics that
are used for the representation of information, and range in terms of their expressiveness. There are logic that are
more expressive and are more useful in translation of sentences from natural languages into the logical ones. There
areseveral logics that are widely used

Propositional logic : These are restricted kinds that make use of propositions (sentences that are either true or
false but not both) which can be either true or false. Proposition logic is also known as propositional calculus,
sentential calculus or Boolean algebra.

All propositions are either true or false, For example:

(i) Leaves are green (i) Violets are blue.

Sentence Truth Value Proposition


Sky is blue true yes

Roses are red true yes

22-5 fals yes

2. First order predicate logic: These are much more expressive and make use
of variables, constants, predicates,
connectives explained already in previous section.
functions and quantifiers along with the
order predicate logic by using
order predicate logic is distinguished from first
3. Higher order predicate logic: Higher
semantics.
additional quantifiers and stronger
existence ofin between TRUE and FALSE or fuzziness in all logics
4Fuzzylogic: These indicate the
valued logic, modal logics and temporal logics.
5.
Otherlogic:These include multiple
() Productlon rule representation rules.
as IF-THEN
knowledge is to use production rules, it is also known
One of the widest used methods to represent

Syntax
IF condition THEN action
premise THEN conclusion
trie
proposition pl and proposition p2
are

THEN proposition p3 is true


ledga
Publc.
1u n8asOnNinn
Example
IF pressure is high, THEN volume is smali.
IF the road is slippery, THEN driving is dangerous.
Some of the benefits of IF-THEN rules that
are they are modular, each defining a relatively small and, at les.
principle, independent piece of knowledge. New rules may be added and old deleted
ones usually independent
other rules. ently of
Production rules are simple but
powerful forms of representing knowledge, they provide tlexibility for
combini.
procedural representations in a unified manner. The major advantage or production rules areDining
and declarative
they are modular, independent of other rules with the tha
that
provision for addition new rules and deleting older ones.
(c) Semantic networks
These represent knowledge in the form of graphical networks, since graphs are easy to be stored inside programs
a
they are concisely represented by nodes and edges.
A semantic network
basically comprises of nodes that are named and represent concepts, and
labelled inks representing relations between
concepts. Nodes represent both types and tokens.
For example, the semantic network in Fig. 3.4.1 expresses the knowledge to represent the following data:
o Tom is a cat.
Tom caught a fish.

Tom is grey in color.

Tom is owned by Sam.


Tom is a Mammal.

Fish is an Animal.
O Cats love Milk.
O All mammals are animals.

Mammal s a Animal
ls a
ls a

Milk Loves Cat


Fish
Is a Caught a
Color is Tom

Grey Owned by
Sam
Flg. 3.4.1
aual Graph: It is a recent scnee uEd Tor
semantic network, finite
oraph. The nodes represent either introduced by John Sowa, has a
connected, bipar e labelled
arcs.
concepts or conceptual
For relations. revious

example Ram, Laxman and It differs from the


p
be represented as
shown. Bharat are Brothers or cat can

co

l e d k a o n l e
Artificial Intelligence (MU-Sem. 7-1T) 3-12
Knowledge and Reasoning
Ram
Brothers Laxman Cat Colour Grey

Bharat

Fig.3.4.2
(d) Frame representation

This concept was introduced by Marvin Minsky in 1975.


They are mostly used when the task becomes quite compiex
and needs more structured representation. More
structured the system becomes more would be the requirement or
using frames which would prove beneficial. Generally frames are record like structures that consists of a collection or
slots or attributes and the corresponding slot values.
Slots can be of any size and type. The slots have names and values (subfields) called as facets. Facets can have names
or numbers too. A simple frame is shown in the
Fig. 3.4.2 for a person Ram,
(Ram)
(PROFESSION (VALUE Professor)
(AGE(VALUE 50)
(WIFE(VALUE sita))
o (CHILDREN(VALUE luv kush))
(ADDRESS (STREET(VALUE 4C gb road)))
o CITYVALUE banaras))

(STATE(VALUE mh))
(ZIP(VALUE400615)
3.4.1 Ontology

Ontology is study about what kind of things or entities exist in the universe. In Al, ontology is the specification of
conceptualizations, used to help programs and humans to share knowledge about a particular domain. In turn,
ontology is a set of concepts, like entity, relationships among entities, events that are expressed in a uniform way in
order to create a vocabulary for information exchange
An ontology should also enable a person to verify what a symbol means. That is, given a concept, they want to be able
to find the symbol, and, given the symbol, they want to be able to determine what it means. Typically, it specifies
what types of individuals will be modelled, specifies what properties will be used, and gives some axioms that restrict
the use of that vocabulary. Ontologies are usually written independently of a particular application and often involve a
community to agree on the meanings of symbols
For example : Consider a map showing hotels, railway station, buildings, schools, hospitals in a particular locality. In
this map the symbols used to indicate these entities are enough to describe them. Hence the community who knows
the meaning of these symbols can easily recognize it. Hence that becomes ontology of that map. In this ontology, it
may define a building as human-constructed artifacts. It may give some restriction on the size of buildings so that
shoeboxes cannot be buildings or that cities cannot be buildings. It may also state that a building cannot be at two

geographically dispersed locations at the same time.


Knowledg and Reasonin
3-13
Artificial Intelligence (MU-Sem.7-1T)
3.5 Propositional Logic(PL) artificial
intelligence
problems. You have lear
learnt smple
powerful for
some
Is a rormula that has
O S O n a l
Logic (PL) is simple but used. (Atomic
formula no
stric
formulas are
dLnematical logic in which uses atomic
called propositions. values, is ha
but it is based on
Sub-formulas). Atomic logic formulas are
as the study
of truth
categorized
logic is not to tnat of the truthyal
cose Of artificial intelligence propositional

the truth
value of one
statement
value o
between
(i.e. The relationship
relativity of truth values.
other statement)

3.5.1 Syntax
as follows
8asic syntax followed by the propositional logic can be given
C, etc.
Propositional symbols are denoted with capital letters like : A, B,
crisp nature (1.e. 0 (false) and 1 (truell
values have a
Propositional logic constants have a truth value generally truth
values vary in the range
of 0 and 1.
But for fuzzy logic truth can
is denoted as (..).
atomic sentence. It
Propositional logic make use of wrapping parenthesis while writing

atomic sentence or it can be negation of atomic sentence. (A, -A)


Literal is an

IfA is a sentence, then -A is a sentence.


and it is denoted by connectives, if A and B are
Propositional logic of relationships between propositions
makes use

can be seen in the Table


3.5.1.
propositions. Connectives used in proposition logic

Table 3.5.1: Connectives used in Propositional logic


Connective Name of the Connective Relationship between Nameof the Relationship between
symbol symbol Propositional symbols Propositional symbols

And AB Conjunction

V
Or AvB Disjunction

Not -A Negation

Implies AB Implication / conditional

is equivalent/ if and only


AB Biconditional
if

To define logical connectives truth tables are used. Iruth table 3.5.2 shows five logical connectives.

Table 3.5.2

A AABAVBAAA
False false false False true true true
False true false True true true false
True false false false false false
True true true True false true true

T d
UDiitati0n*
K n o u k e
Artificial Intelligence (MU-Sem. 7-1T) 3-14 Knowledge and Reasoning
Take an example, where A A B, i.e. Find the value of AA B where A is true and B is false. Third row of the Table 3.5.2
shows this condition, now see third row of the third column where, A a B shows result as false. Similarly other logical
connectives can be mapped in the truth table.

3.5.2 Semantics

World is set of facts which we want to represent to form propositional logic. In order to represent these tacts

propositional symbols can be used where each propositional symbol's interpretation can be mapped to the real world
feature.

Semantics of a sentence is meaning of a sentence. Semantics determine the interpretation of a sentence.


Forexample: You can define semantics of each propositional symbol in following manner

1. A means "It is hot"

2. B means "It is humid", etc.


Sentence is considered true when its interpretation in the real world is true. Every sentence results from a finite
number of usages of the rules. For example, if A and B are sentences then (AA B), (A v B), (8A) and (A > B) are
sentences. The knowledge base is a set of sentences as we have seen in previous section.
Thus we can say that real world is a model of the knowledge base when the knowledge base is true for that world. In

other words a model can be thought of as a truth assignment to the symbols.


If truth values of all symbols in a sentence are given then it can be evaluated for determiing its truth value fi.e. we

can say if it is true or false).

3.5.3 What is Propositional Logic ?


AA B and Ba A should have same meaning but in natural language words and sentences may have different

meanings. Say for an example,

1. Radha started feeling feverish and Radha went to the doctor.

2. Radha went to the doctor and Radha started feeling feverish.

Here, sentence 1 and sentence 2 have different meanings.


In artificial intelligence propositional logic is a relationship between the truth value of one statement to that of the

truth value of other statement.

3.5.4 PL Sentence Example


Take example of a weather problem.
be defined as follows
Semantics of each propositional symbol can

which means "It is hot".


Symbol A is a sentence

Symbol B is a sentence which means "It is humid".

Symbol C is a sentence which means "it is raining".

We can also choose symbols which are easy to understand, like

o HT for "It is hot".

HM for "It is humid".


RN for "It is raining.
it is hot".
f you have HM> HT then that means "if it is humid, then

Techasastedge
PUbIIeations
Artificial Intelligence (MU-Sem. 3-15
Knowledge and Reason
7-1)
nave (HTa and
HM)-> RN then it means "Ifitis hot and humid, then it is raining so
on
First we have to create the possible models for a knowledge base. To do this we need to
assignments of true or false value for Sentence A, Band C. Then verify the truth table
ble for
consider all the posgh
the
total 8 validity.
possibilities as shown below: There can
Sentence HT Sentence HM Sentence RN Validity
False False False Valid

False False True Valid

False True False Not Valid


False True True Not Valid

True False False Valid

True False True Valid


True True False Not Valid
True True True Valid
Now, if the
knowledge base is [HM, HM> HT, (HT AHM)>
is hot and
humid, then RN](i.e. ["it is humid", "If it is humid, then it
it is raining"] ), then "True -True True" is the is hot","
only possible valid model.
Teutology and Contradiction
Tautology means valid sentence. It is a sentence which is true for all the
not A"): "It is hot or It is not hot" interpretations. For example: (A V-A) 'A
Contradiction means an inconsistent sentence. It is
AA-A ("A and
a sentence which is false for all
not A"): the
"It is hot and it is not hot." interpretations. For example
x entails Y, is shown X
as I= Y. It means that
whenever sentence
if, X= Priya X is True, sentence
is Pooja's Mother's Sister and Y Priya =
is
Y will be True. For
Example
Pooja's Aunty. Then X I= Y (X
3.5.5 Inference Rules entails Y).

New sentences are formed with the


logical inference. For
acrossthis example many times it
implies that if
example : If A B and B C
=
then A
that "A =C". knowledge base has "A = B"
=
C. You must have co
and "B C" then
inshort inference rule says that new
=
we
can
sentence can be
knowledge base. create by logically following the set of
sentences
Table 3.5.3 Inference Rules
inference Rules
Premise (KB)
Modus Ponens Conclusion
X, XY
Y
Substitution XZ and Y»Z
X= Y
Chain rule
XY, YZ
AND introduction X-Z
Y
Transposition XAY
X-Y
Entailment is represented as : KE
=Q and Derivation is renreco XY
There are two types of inference rules KB 1-Q.

Techlnd

uDIUCa"
Artificial Intelligence (MU-Sem. 7-IT)
3-18 Knowledge and Reasoning
3.5.8 Advantages of Propositional Logic
Propositional logic is simple knowledge representation
a
language.
t is sufficient and efficient technique for
solving some artificial intelligence based
problems.
Propositional logic forms the foundation for higher logics like First Order
Logic (FOL), etc.
Propositional logic is NP complete and reasoning is decidable.
The process of inference can be illustrated by PL
3.5.9 Disadvantages of Propositional Logic
Propositional logic is cannot express complex artificial intelligence
problems.
Propositional logic can be impractical for even small worlds, think about WUMPUS hunter
problem.
Even if we try to make use of
propositional logic to express complex artificial intelligence problems, it can be very
wordy and lengthy.
PL is a weak knowledge representation language because :
With PL it is hard to
identify if the used entity is "individual". For example : If there are entities like Priya,
Mumbai, 123, etc.
PL cannot directly represent properties of individual entities or relations between individual entities. For
example, Pooja is tall.
PL cannot express
specialization, generalizations, or patterns, etc. For example : All rectangles have 4 sides.
3.6 First Order Predicate Logic
MU-May 14
a. Write a short note on predicate logic.
(May14,5 Marks)
Because of the inadequacy of PL discussed above there was a need for more expressive type of logic. Thus First-Order
Logic (FOL) was developed. FOL is more expressive than PL, it can represent information using relations, variables and
quantifiers, e.g, which was not possible with propositional logic.

" Gorilla is Black" can be represented as


O
Gorilla(x) Black{x)
"It isSundaytoday" can be represented as

today(Sunday)
First Order Logic(FOL}is also called as First Order Predicate Logic (FOPL). Since FOPL is much more expressive as a
knowledge representation language than PL it is more commonly used in artificial intelligence.

3.6.1 Syntactic Elements, Semantic and Syntax


FOL symbol can be a constant term, a variable term or a function.

Assuming that "X" is a domain of values, we can define a term with following rules:

1. Constant term : It is a term with fixed value which belongs to the domain.

2. Variableterm: It is a term which can be assigned values in the domain.

. Function : Say " is a function of "n" arguments. If we assume that t , t t , are terms then ft,t , t) is also

called as a term.

eckededgd
PuDEations
3-19

Artificial Intelligence (MU-Sem. 7-11) three


protocols. c o n n e c t i v e s
used in PL and F
above so
the imoirar
the logic, double
pplying
All the terms aregenerated by logic a s a
base
implication
and ation.
propositional >
makes use
of negation,
hich
all the
in which all the
First order predicate logic A
conjunction,
v
disjunction,

ground
term. A
sentence

variables
common. Hence, it also. Supports called as a
variables it is
have any
term does not
erm: If a "wel1-formed formula"
are quantified is
called as a
object.
is mapped with
an
o Every ground term objects.
a relation. the terms'
is mapped to between
Every condition (predicate) te's relation
holds
is evaluate.
considered as true if the predice If the
predecessor d to
A Bround atom is and
successor.

logic rule has two parts


predecessor
represents
if-then types ofsentences.
O Rules in FOL: In predicate symbol. Rule
will be true. It uses the implication as
be represented
RUE successor

I will buy it." Will


is of blue colour,
Example The sentence "If the bag
colour (bag, blue) buy(bag)

Ouantifiers the number of


the name suggests they quantify
connectives FOPL makes use of quantifiers. As
Apart from these
the relation or obeying the rule.
variables taking part in

1. Universal Quantifier'V'
all the variables in the predicate
Pronounced as "for al" and it is applicable to

"xA" means A is true for every replacement of x.


Black" can be represented as
Example: "Every Gorilla is
"vx(Gorilla(x) >Black(x)})

2. Existential Quantifier '3'

Pronounced as "there exists"

A is true for at least one replacement of x.


3x A" means

white dog" can be represented as,


Example: "There is a

3x(Dog(X) white(X))

Note
Typicaliy. is the main connective with y

Example: "Everyone at MU is smart is represented ass

vx At(x, MIU) > smart(x)

Typically, is the main connective with 3


2
Example: Someone killed the cat and is guilty.

xkilled(x, cat) guilty()


quality: term = term2 is true under a given interpretation if and
only if term, and temo reter to the same Du
- Example: Richard has at least two brothers

x, ay Brother(x, Richard) Brother(y, Richard) - (x =v


Artificial intelg e MO-Sem. 7-ITD
3.7 arison betw
Comparison between 3-20

Propositional logic (PL)


Propositlonal Logic and First Order Knowledge and Reasoning
Logic
NO.
Predicate logic (FOL)
PL cannot
represent small worlds
like vacuum
cleaner world.
FOL can
very well
represent small worlds'
PL is a weak knowledge representation problemns.
language FOL is a
strong way of
Propositional representing language.
Language uses
which the complete propositions in FOL
sentence is denoted by uses
predicated which involve constants, variables,
symbol. a
| functions, relations.
PL cannot directly represent
individual entities or properties of FOL can
relations directly represent
individual entities. E.g. Meera is short. berweenrelations between individual properties of individual entities or
entities using individual
using functions. E.g. predicates
5 PL cannot
express Short(Meera)
generalizations, Specialization, | FOL can express
or
patterns, etc. specialization, generalizations, or
patterns, etc.
E.g. All rectangles have 4 sides. Using relations. E.g.
no_of_sides(rectangle, 4)
PL is a foundation level logic.
FOL is
higher level logic.
a
7. PL is not
sufficiently expressive to represent FOL can represent complex statements.
complex statements.
PL assumes the world contains
facts FOL assumes the world contains
objects, relations, functions like
natural language.
9 In PL
Meaning of the facts is context- In FOL Mieaning of the sentences is context
dependent like
independent unlike natural language. natural language.
10. PL is declarative in nature. FOL is derivative in nature.

3.8 Inference in FOL


3.8.1 Forward Chaining
For from start to goal. When based
any type of inference there should be a path on the available data a decision is
aken, then the process is called as the forward chaining. Forward chaining or data-driven inference works from an
nitial state, and by looking at the premises of the rules (F-part), perform the actions (THEN-Ppart), possibly updating
he knowledge base or working memory. This continues until no more rules can be applied or some cyce limit is met.
Orexample, "If it is raining then, we will take umbrella". Here, "it is raining" is the data and "we will take umbrella" is
it decided to take umbrella. This process is
known that it's raining that's why
was
ECIsion. This means it was already
forward chaining.

Data

Fig. 3.8.1: Forward Chalning

edleeiedye
Pubiteattans
3-21

Artificial Intelligence (MU-Sem. 7-


technique.
inference

data-driven

as a
"Forward chaining" is called

Example
Given
Rule: human(A) -> mortal(A)
Data: human(Mandela)

To prove: mortal(Mandela)

Mandela
Forward Chaining Solution
get A
=

we can
Rule. So,
Side of the
matches Left Hand
Human tMandela)
mortal(Mandela) in a forward direction ti .

. from
get: operation
s t a t e m e n t we can
based on the rule as it performs
systems",
by the "design expert
Forward chaining is used
start to the end).

solved using both forward.


Example example can be
us understand
how the s a m e
Consider following example. Let
Given facts are as foliows:

the enemy of America.


crime for an American to sell weapons to
1. It is a

2. Country Nono is an enemy of America.

3. Nono has some missiles.

sold to Nono by Colonel West.


4. All the missiles were

5. Missile is a weapon.

6. Colonel West is American.

We have to prove that West is a criminal.

Let's see how to represent these facts by FOL

1. it is a crime for an American to sell weapons to the enemy nations.

American(x) A Weapon(y) A sell % y, 2) A enemylz, America) => Criminal (x


2. Country Nono is an enemy of America.

Enemy (Nono, America)


3. Nono has some missiles.

Owns (Nono, x)

Missile(x)
4. All the missiles were sold to Nono by Colonel
West.
Missile(x)A owns(Nono, x)=> Sell(\West, x,
Nono)
5. Missile is a weapon.

Missile(x)=> weapontx)
6. Colonel West is American.

American (West)

To
Knowledge and Reasoning
ArtificialIntelligence (MU-Sem.7-1T) 3-22
forward chaining
Proof by ution
us to
nroof will start from the given facts. And as we can derive other facts from those, it will lead
The pr the sou
Olase refer to Fig. 3.8.2 As we observe from the given facts we can reach to the predicate Criminal (West)
Pleas
American (West) Missile (x)|Owns (Nono,)|| Enemy
(Nono,America)

Sell
Weapon()|(West, x, Nono)

Criminal (West)
Fig. 3.8.2: Proof by forward chaining

3.8.2 Backward Chaining


MU-Dec. 12, May 14
(Dec. 12, 10 Marks)
a. Describe backward chaining algorithm with an example
(May 14, 10 Marks)
a. Explain backward chaining giving suitable example.

backward chaining. Backward chaining or


If based on the decision the initial data is fetched, then it is called as
there. If
inference works towards a final state, and by looking at
the working memory to see if goal already
goal-driven of the
not look at the actions (THEN-parts) of rules that will establish goal, and set up sub-goals for achieving premises

rules (IF-part). This continues until some rule can


be applied, apply to achieve goal state.
umbrella. Then based on this decision it can be guessed that it is raining.
For example, If while going out one has taken
which the data is generated that "it's raining". This process is backward
Here, "taking umbrella" is a decision based on

as a decision-driven or goal-driven inference technique.


"Backward chaining" is called
chaining.
Data

Fig. 3.8.3: Backward Chaining


Given
Rule: human(A) -> mortal(A)
Data: human(Mandela)

Toprove: mortal (Mandela)


Backward Chaining Solution
mortal (Mandela) wil be matched with mnortal (A) which gives human (A) Le. human (Mandela) which is also a given

fact. Hence proved.


makes use of right hand side matching. backward chaining is used by the "diagnostic expert systems", because it
It
PETOrms operations in a backward direction (i.e. from end to start).

TecaKnewiedg
i atrans
3-23 wledge and Reasoni
Artificial Intelligence (MU-Sem. 7-1T)
Example can be solved
using Dackward chainino
used in forward
chaining ng.
ds understand how the same example

Proof by backward Chaining


with given tacts, it will lead us to s
will start from the fact to be proved. And
as we can map it theslution
e
proot tacts t n a t
given
m e a n s "West is
Crimina
Please refer to Fig. 3.8.4. As we observe, all leaf nodes of the proof are

Ciminal (west)

American (west)| Weapon(x) Sell(west,x, z)Enemy(Nono, Anerica)

True
True

Missile (x)Missile (x) Owns (Nono, x)

True True
True

Fig. 3.8.4: Proof by backward chaining


3.8.3 Differentiate between Forward Chaining and backward Chaining
Attribute Backward Chaining Forward Chaining
Aiso known as Goal-driven Data-driven
Starts from Possible conclusion New data

Processing Efficient Somewhat wasteful


Aims for Necessary data Any Conclusion(s)
Approach Conservative/Cautious Opportunistic
Practical if Number of possible final answers is reasonable or a set|Combinatorial explosion creates an infinte
of known alternatives is available. of number possible right
answers.

Appropriate for Diagnostic, prescription and debugging application


Planning, monitoring, control and
interpretation application
Reasoning Top-down reasoning
Bottom-up reasoning
Type of Search Depth-first search
Breadth-first search
Who determine Consequents determine search
Search
Antecedents determine search

Flow Consequent to antecedent


Antecedent to consequent
Ex. 3.8.1 Using predicate logic find
the course of
Anish's liking for the
() Anish only likes easy courses. tollowing:
(i) Computer courses are hard.
(ii) Ail electronics courses are easy
(iv) DSP is an electronics
course

enfirafie
Tec
exhaustive and precise. This vocabulary
is called as ontology of the thin8s exist in the Uhtology iis
domain
what kind of
e
s been
defined. That is,
defined, it means, the existence of the domain is
decided. defines axioms
for
knowledge engineer all he
th
this step the : In
n g of general knowledge about the domain
enables expert
to c r o s s
check the vocabulary and and the cabulary co
contents
of each term. This
vocabulary terms by define meaning
this point by
redoing step
3.

it can be fixed at
or gaps,
" n e Tinds any misinterpretations

is encoded using
the defined ontology. Thissto
step v
instance
5. ncode the problem: In this step, the specific
problem
atomic s e n t e n c e s
about problem inct
properly. Encoding m e a n s writing tances
be very easy if the tology is defined program.
data for a computer
w n are already part of ontology. It can
be analogues to input
are done,
all input for the
system is set and now is atime
ime to
all the above steps inferred from the prouia.
6. Query the Knowledgebase: Once interested tacts
in order to get some
8 e n e r a t e some output from the system. So,
procedure will operate on the
axioms and
facts derive
The inference
Knowledge, we can query the knowledgebase. specific programs.
write application
interences. This lessens the task of a programmer to
the new
or check the
toughness of the knowledgebase In
which one can prove
7. knowledgebase: This is the step in or it stops in
between
Debug the appropriate answers to all
the queries asked
the sense, if the inference procedure is able to give If one o b s e r v e s the reasoning chain
identified by debugging
process.
Decause of the incomplete axioms; will be easily of a missing or a wea
it is an indication
could not be answered then,
stopping in between or some of the queries and system can be claimed to
the required steps
axIoms. Then the corrective m e a s u r e s can
be taken by repeating

have a complete and precise knowledgebase.

3.10 Unification and Lifting


3.10.1 Unification
identical. The unification
substitutions that make different logical expressions look
The processes of finding legal
if they unify, and, if they do
unification is given two atoms, to find
algorithm is a recursive algorithm; the problem of

return an MGU (Most General Unifier) of them.

Procedure Unify(,t
Inputs
g i atoms Output
exists otherwise
t, and t, if it
or
most general wnifier of

Local
statements
E: a set of equality
S: substitution

E-ft,=t
S=i
while ( 1 }
seiect and
remove x =y from E

if (yis not identical to a) then


if (x is a variable) then

replace x with y everywhere in E and S

SsVfUS

else if (yis a variable) then


ochnnslesg
UDtictre
Knowledge and Reaso
3-27 SOninO
Artificial Intelligence (MU-Sem.7-
Soln.
(i) VXy: person (x) a policy (y) Abuys (x, y) smart
buys (M, V
x , Vy: person (x) a policy (y) A expensive (y)~
(
(in) vx: person (x) A - insured (x)

x)
y:3x Apolicy (y) -agent (x)> sells (x, y,
shaves (X, Y)
(IVx y: barber (x) a person (y) A -shaves (y,
y)

Ex. 3.10.2 Represent following statements in FOPL.

1. Anyone who kills an animal is loved by no one.


pit in the neighbouring squares
2. A square is breezy if there is a

Soln.
() Vx vy: kills (x, animal)-- loves (y, x)
breez (X* 1, Y)
breez (x- 1, y) a

( VxVy: pit (x, y) breez (x, y-1) Abreez (x, y+1) A


statements
Ex. 3.10.3 Write first orderlogic statements for folowing of p.
then it is also divisible by square
f aperfect square is divisible by a prime p
i) Every perfect square is divisible by some prime.
(ii) Alice does not like chemistry and history.
(iv) Saturday and warm, then sam is in the park.
If it is

(v) Anything anyone eats and is not killed by is food.


Soln.
(i) Vx: square(x) a prime (y) a divides (p, x) >2: square_of(z, p) a divides(z, x)]
(i) vx3y: squaretx) a divides (p, x)
(i) likestAlice, History) A likes (Alice, Chemistry)
(iv) day(Saturday) a weather(warm) in_park(Sam)
(v)x: y: person(x) A eats(x, y) a ~killed (x) > food(y)

3.11 Resolution
Resolution is a valid inference rule. Resolution produces a new clause which is implied
by two clauses contal
complementary literals. This resolution rule was discovered by Alan Robinson in the mid 1960's.

We have seen that a literal is an atomic symbol or a negation of the atomic symbol (i.e. A, -A).
Resolution is the only interference rule you need, in order to build a sound
entence

will be "true") and


(soundness means that every sE
produced by procedure a
complete (completeness oduced
means every "true" sentence can be prou
by a procedure) theorem proof maker.
Take an example where we are given that:
A clause X containing the literal :Z
Aclause Ycontaining the literal:-z
Based on resolution and the intormation 8iven above
we can
(X-12)) U (Y- -Z)) conclude:
Take a generalized version of the above problem :

T e c h l a s i

Publical
Artificial Intelligence (MU-Sem. 7-IT) 3-28 Knowledge and Reasoning

Given:
A clause X containing the literal Z

A clause Y containing the literal :-Y


A most general unifier G of Z and -Y
We can conclude that: (X-{Z}) U(Y-{-Y}) | G

3.11.1 The Resolution Procedure

Let knowledge base be a set of true sentences which do not have any contradictions, and Z be a sentence that we
want to prove.

The ldea is based on the proof by negation. So, we should assume -Z and then try to find a contradiction (You must
have followed such methods while solving eeometry proofs). Then based on the Intuition that, if all the knowledge
base sentences are true, and assuming-Z creates a contradiction then Z must be inferred from knowledge base. Then
we need to convert knowledge base U {-Z) to clause form.
if there is a contradiction in knowledge base, that means Z is proved. Terminate the process after that.
Otherwise select two clauses and add their resolvents to the current knowledge base. If we do not find any resolvable
clauses then the procedure fails and then we terminate. Else, we have to start finding if there is a contradiction in
knowledge base, and so on.

3.11.2 Conversion from FOL Clausal Normal Form (CNF)

MU- May 16
a. Explain the steps involved in converting the propositionallogiostatementinto CNF with a suitable example
(May 16, 10 Marks)

1. Elimination ofimplication i.e. Eliminate all ' ' : Replace P Qwith -P va


2. Distribute negations: Replace-P with P, -(PV O) with -PA-Qand so on.
3. Eliminate existential quantifiers by replacing with Skolem constants or Skolem functions
e.g. Vx3 Y(P,(X,Y) v (P,(X,Y) =VX (P,(X, f(X) v (P,(X, f{X))
Rename variables to avoid duplicate quantifiers.
Drop all universal quantifiers
6. Place expression into Cconjunctive Normal Form.
7. Convert to clauses i.e. separates all conjunctions as separate clause.
8. Rename variables to avoid duplicate clauses
Ex. 3.11.1: Convert following propositional logic statement into CNF
MU Dec. 15, 4 Marks
A(BC)
Soin.
FOL A (B C)
Normalizing the given statement.

) A(B CACB)
(i) (A (B> C)) (A >(C B))
Converting to CNF.
Applying Rule,
Tech Ksnewledge
PuDItati ns

You might also like