SlideShare a Scribd company logo
ARTIFICIAL
INTELLIGENCE
(Unit III)
VI Sem B.E. Computer Sc. &
Engg
Department of Computer Science & Engineering
Priyadarshini Bhagwati College of Engineering,
Nagpur
(Even 2021)
Kapil N Hande
Head of the Department
Contents
 Knowledge representation: Knowledge
representation Issues: First order logic,
Predicate Logic,
 Structured Knowledge Representation:
Backward Chaining , Backward Chaining
Backward Chaining , Backward Chaining
 Resolution
 Semantic Nets
 Frames, and Scripts
 Ontology
K N Hande 2
Representations and Mappings
 In order to solve complex problems in AI, we
need both large amounts of knowledge and
some mechanism for manipulating that
knowledge.
 Representing the knowledge is called as facts
 Representing the knowledge is called as facts
 We are dealing with two different kinds of
entities
 Facts: truths in some relevant world. These are
the things we want to represent
K N Hande 3
Representations and Mappings
 Representation of facts in some chosen
formalism. Things we will actually be able to
manipulate.
 These entities are structured at two levels:
 The knowledge level, at which facts are
 The knowledge level, at which facts are
described.
 The symbol level, at which representation of
objects are defined in terms of symbols that can
be manipulated by programs.
K N Hande 4
Figure: Mapping between Facts and Representation
Representations and Mappings
 One representation of the facts is so common
that is natural language(English) sentences.
 English representation of the facts in order to
facilitate getting information in and out of the
system.
 Lets look at the simple example using
 Lets look at the simple example using
mathematical logic as representational
formalism.
 Consider the sentence
Spot is a dog
K N Hande 6
Representations and Mappings
This fact can be represented in logic as
dog(Spot)
K N Hande 7
Representations and Mappings
 Available mapping functions are many to many
relations.
 For example two sentences “All dogs have
tails” and “Every dog has a tail” could both
tails” and “Every dog has a tail” could both
represent same fact namely that every dog has
atleast one tail.
K N Hande 8
Knowledge Representation techniques in Artificial Intelligence
Representations and Mappings
 If no good mapping can be defined for the
problem, then no matter how good the
program to solve the problem is, it will not be
able to produce answers that corresponds to
able to produce answers that corresponds to
real answers of the problem.
 We need to find the concrete implementation
of the abstract concepts.
K N Hande 10
Approaches to Knowledge Representation
A good knowledge representation system must possess the
following properties.
1. Representational Accuracy:
KR system should have the ability to represent all kind of
required knowledge.
2. Inferential Adequacy:
KR system should have ability to manipulate the
representational structures to produce new knowledge
representational structures to produce new knowledge
corresponding to existing structure.
3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism
into the most productive directions by storing appropriate
guides.
4. Acquisitional efficiency- The ability to acquire the new
knowledge easily using automatic methods.
K N Hande 11
Simple Relational Knowledge
 It is the simplest way of storing facts which uses
the relational method, and each fact about a
set of the object is set out systematically in
columns.
 This approach of knowledge representation is
 This approach of knowledge representation is
famous in database systems where the
relationship between different entities is
represented.
 This approach has little opportunity for
inference.
K N Hande 12
Knowledge Representation techniques in Artificial Intelligence
Inheritable Knowledge
 Structure must have inference mechanism
 One of the most useful form of inference is
property inference, in which elements of
specific classes inherit attributes and values
from more general classes in which they are
from more general classes in which they are
included.
 Objects must be organized into classes, and
classes must be arranged in generalization
hierarchy
K N Hande 14
Inheritable Knowledge
 Following figure shows some additional
baseball knowledge inserted into a structure.
 Lines represent attributes
 Boxed nodes represent objects and values of
attributes of object.
attributes of object.
 These values can also be viewed as objects with
values and attributes and so on.
 The arrows on the line points from an object to
its value
K N Hande 15
Inheritable Knowledge
 The structure shown in the figure is a slot-and-
filler structure, also called as semantic network
or collection of frames.
Each individual frame represent the collection
 Each individual frame represent the collection
of attributes and values associated with a
particular node.
K N Hande 16
Knowledge Representation techniques in Artificial Intelligence
Knowledge Representation techniques in Artificial Intelligence
Knowledge Representation techniques in Artificial Intelligence
Inheritable Knowledge
 A semantic network is a graphic notation for
representing knowledge in patterns of interconnected
nodes. Semantic networks became popular
in artificial intelligence and natural language
processing only because it represents knowledge or
supports reasoning.
 Frames are an artificial intelligence data structure
 Frames are an artificial intelligence data structure
used to divide knowledge into substructures by
representing stereotyped situations. ... Frames are
the primary data structure used in artificial
intelligence frame language; they are stored as
ontologies of sets.
K N Hande 20
Inheritable Knowledge
 The attribute isa, is being used to show class
inclusion and attribute instance is being used to
show class membership.
These two specific attributes provides basis for
 These two specific attributes provides basis for
property inheritance as an inference technique.
K N Hande 21
Inheritable Knowledge
K N Hande 22
Inheritable Knowledge
K N Hande 23
Inferential Knowledge
 Inferential knowledge approach represents
knowledge in the form of formal logics.
 This approach can be used to derive more facts.
 It guaranteed correctness.
 Sometimes all the power of traditional logic is
needed to describe the inferences that are
Sometimes all the power of traditional logic is
needed to describe the inferences that are
needed.
 Following figure shows examples of the use of
first order predicate logic to represent
additional knowledge about baseball
K N Hande 24
Inferential Knowledge
K N Hande 25
Inferential Knowledge
 We need a inference procedure that can exploit
this knowledge.
 The required inference procedure is the one that
implements the standard rules of inference.
implements the standard rules of inference.
 One of the most commonly use procedure is the
resolution, which exploits the proof by
contradiction.
K N Hande 26
Procedural Knowledge
 Operational or procedural knowledge describes
what to do when.
 Procedural knowledge can be represented in
the programs by coding.
the programs by coding.
 Procedural knowledge can be represented by
production rules.
K N Hande 27
Procedural Knowledge
K N Hande 28
Issues in
Knowledge
Knowledge
Representation
Issues in Knowledge Representation
1. Important Attributes:
 There are two general attributes that are very
general significance: isa and instance.
 They support property inheritance
 They support property inheritance
 They represent class membership and class
inclusion
K N Hande 30
2. Relationships among Attributes
 The attributes that we used to describe objects are
themselves entities that we represent.
 Properties of the attributes are:
 Inverses
 Inverses
 Existence in an isa hierarchy
 Techniques for reasoning about values
 Single-valued attributes
K N Hande 31
Inverses
 As soon as we describe the entities in the world
and its relationship as attributes, we look for
binary relationship with others.
 Attributes are those relationships
 In semantic nets it was shown as directed arrow
originating at the object that was being
originating at the object that was being
described and terminating at the object
representing the value of specified attribute.
 There are two ways to show the other way of
relationships
K N Hande 32
Inverses
 The first is to represent both relationships in a
single representation that ignores focus. For ex:
K N Hande 33
The second approach is to use attributes that
focus on single entity but to use them in pairs, one
the inverse of the other.
Inverses
K N Hande 34
An isa hierarchy of attributes
 Just as we have classes of objects and specialized subsets of
those classes, there are attributes and specializations of the
attributes.
 For example attribute height is specialization of the more
general attribute physical-size, which in turn specialization of
general attribute physical-size, which in turn specialization of
physical-attribute.
 These generalization-specialization relationships are
important as they support inheritance
K N Hande 35
Techniques for reasoning about values
 Sometimes the values of the attributes are
specified explicitly when a knowledge base is
created.
But the reasoning system must reason about
 But the reasoning system must reason about
values it has not been given explicitly.
K N Hande 36
Techniques for reasoning about values
K N Hande 37
Single-valued attributes
 A specific but very useful kind of attribute is one
that is guaranteed to take unique value.
 If there is already the value present for one of the
attributes and a different value is asserted, then
one of the two things has happened.
 Either a change has occurred in the world or there
is an contradiction in the knowledge base that
needs to be resolved.
K N Hande 38
3. Choosing the Granularity of the
Representation
 “At what level of detail should the world be
represented?”
 “What should be our primitives?”
 In computer science, granularity refers to a
ratio of computation to communication – and
ratio of computation to communication – and
also, in the classical sense, to the breaking
down of larger holistic tasks into smaller, more
finely delegated tasks.
K N Hande 39
Choosing the Granularity of the Representation
 Primitive is the simplest type of programming
language item. It may also refer to the smallest
processing unit accessible by a programmer.
 In computer programming, a primitive
 In computer programming, a primitive
(pronounced PRIH-muh-teev ) is a basic interface
or segment of code that can be used to build more
sophisticated program elements or interfaces.
K N Hande 40
Choosing the Granularity of the Representation
 Lets take the following example.
 Suppose we are interested in following fact
John spotted Sue
 We could represent this as
K N Hande 41
So here we can easily answer the question
Who spotted Sue?
But suppose we wanted to know
Did John see Sue?
The answer is “Yes” but given only one fact we cant give the
answer.
Choosing the Granularity of the Representation
 We could add other facts:
spotted(x,y) 


 saw (x,y)
 We need to represent the fact that spotting is
special type of seeing explicitly in the
representation of the fact. We might write it
representation of the fact. We might write it
like:
saw(agent(John),
object(Sue),
timespan(briefly)
K N Hande 42
Choosing the Granularity of the Representation
 Here we have used more primitive concepts as
seeing and time span.
 The advantages of using small set of primitives is
that rules that are used to define inferences from
that knowledge need to be written in terms of
inferences.
 Simple high level facts may require a lot of storage
when broken down into primitives.
K N Hande 43
Choosing the Granularity of the Representation
 A second but related problem is that if knowledge
is initially presented to the system in a relatively
high level form, then substantial work must be
done to reduce the knowledge in primitive form.
done to reduce the knowledge in primitive form.
 A third problem with the use of low-level
primitives is that in many domains it is not all clear
what the primitives should be.
K N Hande 44
Choosing the Granularity of the Representation
 There may not be enough information present
in each use of high level constructs to be enable
them to be converted into there primitive
components.
 The classical example of this is provided by
 The classical example of this is provided by
Kinship terminology.
 Consider one obvious set of primitives:
mother, father, son, daughter, brother and
sister.
K N Hande 45
Choosing the Granularity of the Representation
 But now we are told that Mary is Sue’s cousin
 An attempt to describe the cousin relationship
in terms of the primitives could produce any of
the following interpretations:
K N Hande 46
Choosing the Granularity of the Representation
 The way to solve this problem is to change our
primitives.
 We could use the set:
parent, child, sibling, male and female
 Then the fact that Mary is Sue’s cousin can be
represented as
represented as
K N Hande 47
4. Representing the Sets of Objects
 It is important to represent the sets of objects
for several reasons.
 There are several properties that are true of
sets that are not true of individual members of
set.
set.
 As an example consider the assertions being
made in the two sentences, “There are more
sheep than people in Australia” and “English
speakers can be found all over the World”
K N Hande 48
Representing the Sets of Objects
 We can attach assertions here to people,
sheep's and English speakers.
 If a property is true of all elements of a set,
then it is more efficient to associate it with set
rather than explicitly with every element of the
rather than explicitly with every element of the
set.
 Example is Slot-and-filler structure where we
have used nodes to represent the sets and
inheritance to propagate set level assertions
down to individuals.
K N Hande 49
Representing the Sets of Objects
 There are three ways in which sets may be
represented
 The simplest is by name
 For example node named baseball player in
semantic net
semantic net
 There are two ways to state the definition of set
and its element.
 The first is to list the members. Such a
specification is called extensional definition
K N Hande 50
Representing the Sets of Objects
 The second is to provide the rule that, when a
particular object is evaluated, returns true or false
depending on whether the object is in set or not.
 Such a rule is called intentional definition.
 Such a rule is called intentional definition.
 For example, an extensional description of the set
of our Sun’s planet on which people live is {Earth}
K N Hande 51
Representing the Sets of Objects
 An intentional description is
 One way in which extensional and intentional
representation differs is that they do not
K N Hande 52
representation differs is that they do not
necessarily correspond one-to-one with each
other
5. Finding the Right Structure as needed
 Locating the appropriate knowledge structures
that have been stored in memory
 For example suppose we have a script
(description of class of events in terms of
contexts, participants and sub events) that
contexts, participants and sub events) that
describes the typical sequence of events in a
restaurant.
K N Hande 53
Finding the Right Structure as needed
 The answer to the question Did John ate last
night? Is “yes”
 In order to be able to reason about many things
a system must have many scripts about
a system must have many scripts about
everything.
K N Hande 54
Finding the Right Structure as needed
K N Hande 55
Selecting an Initial structure
 Selecting candidate knowledge structures to
match a particular problem solving situation is
hard problem.
 There are three approaches to do it
 Index the structures directly by the significant
 Index the structures directly by the significant
English words that can be used to describe
them.
 Let each verb have associated with it structure
that describes its meaning
K N Hande 56
Selecting an Initial structure
 This approach may not be adequate as many words
may have several distinct meaning.
 For ex the word “fly” has different meaning in each
of the following sentences
K N Hande 57
Selecting an Initial structure
 Consider each major concept as a pointer to all
structures in which it might be involved.
 For ex the concept Steak might point to two
scripts, one for restaurant and one for super
market.
market.
 The concept Bill may point to restaurant and a
shopping script.
 Take the intersection of those sets to get the
structures, preferably precisely one, that
involves all the content words
K N Hande 58
Selecting an Initial structure
 Locate one major clue in the problem
description and use it to select an initial
structure.
As other clues appear, use them to refine the
 As other clues appear, use them to refine the
initial selection or to make the completely new
one if necessary.
K N Hande 59
Revising the choice when necessary
 The process of instantiating a structure in
particular situation often does not proceed
smoothly.
 There are variety of things that can be done
 Select the fragments of the current structure
 Select the fragments of the current structure
that do correspond to the situation and match
them against candidate alternatives.
 Make an excuse for current structures failure
and continue to use it.
K N Hande 60
Revising the choice when necessary
K N Hande 61
Predicate
Logic /
First Order
First Order
Logic (FOL)
Introduction
 Representing simple facts in Logic
 Representing Instance and Isa
relationships
relationships
 Computable functions and predicates
 Resolution
K N Hande 63
Introduction
 Logic, as per the definition of the Oxford
dictionary, is the reasoning conducted or
assessed according to strict principles and
validity“
 Logic can be defined as the proof or validation
behind any reason provided
behind any reason provided
 It was important to include logic in Artificial
Intelligence because we want
our agent (system) to think and act humanly,
and for doing so, it should be capable of taking
any decision based on the current situation.
K N Hande 64
First Order Logic (FOL)
 First-order logic(FOL) is another way of knowledge
representation in artificial intelligence. It is an
extension to propositional logic.
 FOL is sufficiently expressive to represent the
natural language statements in a concise way.
First-order logic is also known as Predicate logic or
 First-order logic is also known as Predicate logic or
First-order predicate logic. First-order logic is a
powerful language that develops information
about the objects in a more easy way and can also
express the relationship between those objects.
K N Hande 65
First Order Logic (FOL)
 First-order logic (like natural language) does not only
assume that the world contains facts like propositional
logic but also assumes the following things in the world:
 Objects: A, B, people, numbers, colors, wars, theories,
squares, pits, wumpus, ......
 Relations: It can be unary relation such as: red, round, is
adjacent, or n-any relation such as: the sister of, brother of,
adjacent, or n-any relation such as: the sister of, brother of,
has color, comes between
 Function: Father of, best friend, third inning of, end of, ......
 As a natural language, first-order logic also has two main
parts:
 Syntax
 Semantics
K N Hande 66
Syntax of First-Order logic
 The syntax of FOL determines which collection
of symbols is a logical expression in first-order
logic. The basic syntactic elements of first-order
logic are symbols. We write statements in
logic are symbols. We write statements in
short-hand notation in FOL.
K N Hande 67
Basic Elements of First-order logic
Constant 1, 2, A, John, Mumbai, cat,....
Variables x, y, z, a, b,....
Predicates Brother, Father, ,....
Function sqrt, LeftLegOf, ....
K N Hande 68
Function sqrt, LeftLegOf, ....
Connectives ∧
∧
∧
∧, ∨
∨
∨
∨, ¬, ⇒
⇒
⇒
⇒, ⇔
⇔
⇔
⇔
Equality ==
Quantifier ∀
∀
∀
∀, ∃
∃
∃
∃
Predicate Logic
 A predicate is an expression of one or more
variables determined on some specific domain.
 A predicate with variables can be made a
proposition by either authorizing a value to the
variable or by quantifying the variable.
variable or by quantifying the variable.
 The variable of predicates is quantified by
quantifiers. There are two types of quantifier in
predicate logic - Existential Quantifier and
Universal Quantifier.
K N Hande 69
Predicate Logic Symbols
K N Hande 70
Propositional Logic
 Propositional logic is a simple form of logic
which is also known as Boolean logic.
 A proposition has TRUTH values (0 and 1) which
means it can have one of the two values i.e.
True or False.
True or False.
 Propositional logic is used in artificial
intelligence for planning, problem-solving,
intelligent control and most importantly for
decision-making.
K N Hande 71
Propositional Logic
 A proposition is basically a declarative sentence
that has a truth value.
 The purpose of using propositional logic is to
analyze a statement, individually or
analyze a statement, individually or
compositely.
K N Hande 72
Propositional Logic
For example :
The following statements :
 If x is real, then x2  0
 What is your name?
 (a+b)2 = 100
 (a+b)2 = 100
 This statement is false.
 This statement is true.
Are not propositions because they do not have a
truth value. They are ambiguous.
K N Hande 73
Propositional Logic
But the following statements :
 (a+b)2 = a2 + 2ab + b2
 If x is real, then x2 = 0
 If x is real, then x2  0
 If x is real, then x2  0
 The sun rises in the east.
 The sun rises in the west.
Are all propositions because they have a specific
truth value, true or false.
K N Hande 74
Basic facts about Propositional Logic
 Propositional logic is also called Boolean logic as it works
on 0 and 1.
 In propositional logic, we use symbolic variables to
represent the logic, and we can use any symbol for a
representing a proposition, such A, B, C, P, Q, R, etc.
 Propositions can be either true or false, but it cannot be
both.
both.
 Propositional logic consists of an object, relations or
function, and logical connectives.
 These connectives are also called logical operators.
 The propositions and connectives are the basic elements
of the propositional logic.
K N Hande 75
Basic facts about Propositional Logic
 Connectives can be said as a logical operator which
connects two sentences.
 A proposition formula which is always true is
called tautology, and it is also called a valid sentence.
 A proposition formula which is always false is
called Contradiction.
called Contradiction.
 Statements which are questions, commands, or
opinions are not propositions such as Where is
Rohini, How are you, What is your name, are not
propositions.
K N Hande 76
Differences
Sr No Propositional Logic Predicate Logic
1
Propositional logic is the logic that deals with
a collection of declarative statements which
have a truth value, true or false.
Predicate logic is an expression consisting
of variables with a specified domain. It
consists of objects, relations and functions
between the objects.
2
It is the basic and most widely used logic.
Also known as Boolean logic.
It is an extension of propositional logic
covering predicates and quantification.
K N Hande 77
3
A proposition has a specific truth value,
either true or false.
A predicate’s truth value depends on the
variables’ value.
4
Scope analysis is not done in propositional
logic.
Predicate logic helps analyze the scope of
the subject over the predicate. There are
three quantifiers : Universal Quantifier (∀)
depicts for all, Existential Quantifier (∃)
depicting there exists some and
Uniqueness Quantifier (∃!) depicting
exactly one.
Differences
Sr No Propositional Logic Predicate Logic
5
Propositions are combined with Logical
Operators or Logical Connectives like
Negation(¬), Disjunction(∧),
Conjunction(∨), Exclusive OR(⊕),
Implication(⇒), Bi-Conditional or
⇔
Predicate Logic adds by
introducing quantifiers to the
existing proposition.
K N Hande 78
∧
∨ ⊕
Implication(⇒), Bi-Conditional or
Double Implication(⇔).
6 It is a more generalized representation.
It is a more specialized
representation.
7 It cannot deal with sets of entities.
It can deal with set of entities
with the help of quantifiers.
Representing Simple Facts in Logic
 First-order logic statements can be divided into two
parts:
 Subject: Subject is the main part of the statement.
 Predicate: A predicate can be defined as a relation,
which binds two atoms together in a statement.
 Consider the statement: x is an integer., it
 Consider the statement: x is an integer., it
consists of two parts, the first part x is the
subject of the statement and second part is an
integer, is known as a predicate.
K N Hande 79
Representing Simple Facts in Logic
K N Hande 80
A quantifier is a language element which generates quantification, and
quantification specifies the quantity of specimen in the universe of discourse.
These are the symbols that permit to determine or identify the range and scope of
the variable in the logical expression. There are two types of quantifier:
Universal Quantifier, (for all, everyone, everything)
Existential quantifier, (for some, at least one).
Representing Simple Facts in Logic
 Properties of Quantifiers:
 In universal quantifier, ∀
∀
∀
∀x∀
∀
∀
∀y is similar to ∀
∀
∀
∀y∀
∀
∀
∀x.
 In Existential quantifier, ∃
∃
∃
∃x∃
∃
∃
∃y is similar to ∃
∃
∃
∃y∃
∃
∃
∃x.
∃
∃
∃
∃ ∀
∀
∀
∀ ∀
∀
∀
∀ ∃
∃
∃
∃
∃
∃
∃
∃ ∃
∃
∃
∃ ∃
∃
∃
∃ ∃
∃
∃
∃
 ∃
∃
∃
∃x∀
∀
∀
∀y is not similar to ∀
∀
∀
∀y∃
∃
∃
∃x.
K N Hande 81
Some Examples of FOL using quantifier
1. All birds fly.
In this question the predicate is fly(bird).
And since there are all birds who fly so it will
be represented as follows.
∀
∀
∀
∀x bird(x) →fly(x).
2. Every man respects his parent.
∀
∀
∀
∀
2. Every man respects his parent.
In this question, the predicate is respect(x,
y), where x=man, and y= parent.
Since there is every man so will use ∀
∀
∀
∀, and it
will be represented as follows:
∀
∀
∀
∀x man(x) → respects (x, parent).
K N Hande 82
Some Examples of FOL using quantifier
3. Some boys play cricket.
In this question, the predicate is play(x, y),
where x= boys, and y= game. Since there are
some boys so we will use ∃
∃
∃
∃, and it will be
represented as:
∃
∃
∃
∃x boys(x) → play(x, cricket).
∃
∃
∃
∃
∃
∃
∃
∃x boys(x) → play(x, cricket).
K N Hande 83
Some Examples of FOL using quantifier
4. Not all students like both Mathematics and
Science.
In this question, the predicate is like(x, y),
where x= student, and y= subject.
Since there are not all students, so we will
use ∀
∀
∀
∀ with negation, so following is the
use ∀
∀
∀
∀ with negation, so following is the
representation for this:
¬∀
∀
∀
∀ (x) [ student(x) → like(x, Mathemacs) ∧
∧
∧
∧ like(x,
Science)].
K N Hande 84
Some Examples of FOL using quantifier
5. Only one student failed in Mathematics.
In this question, the predicate is failed(x, y),
where x= student, and y= subject.
Since there is only one student who failed in
Mathematics, so we will use following
representation for this:
∃
∃
∃
∃
representation for this:
∃
∃
∃
∃(x) [ student(x) → failed (x,
Mathematics) ∧∀
∧∀
∧∀
∧∀ (y) [¬(x==y) ∧
∧
∧
∧ student(y) →
¬failed (x, Mathematics)].
K N Hande 85
Representing Simple Facts in Logic
 We can represent real world facts as logical
propositions written as well formed formulas
(wff) in propositional logic.
K N Hande 86
Representing Simple Facts in Logic
Suppose we want to represent the fact
Socrates is a Man
We could write
SOCRATESMAN
But if we also want to represent
But if we also want to represent
Plato is a Man
We would have to write something such as
PLATOMAN
K N Hande 87
Representing Simple Facts in Logic
It would be much better to represent these facts
as:
MAN(SOCRATES)
MAN(PLATO)
Since now the structure of representation reflects
Since now the structure of representation reflects
the structure of the knowledge itself.
Suppose we want to represent the fact
All men are mortal.
K N Hande 88
Representing Simple Facts in Logic
We could represent this as
MORTALMAN
 But that fails to capture the relationship
between any individual being a man and that
individual being a mortal.
individual being a mortal.
 In predicate logic we can represent real world
facts as statements written as wff’s
K N Hande 89
Representing Simple Facts in Logic
 Lets now see the use of predicate logic as a way
of representing knowledge by looking at
specific example.
 Consider the following set of sentences:
K N Hande 90
Representing Simple Facts in Logic
K N Hande 91
Representing Simple Facts in Logic
These sentences can be represented as wff in
Predicate logic as follows:
1. Marcus was a man
man(Marcus)
It fails to capture the notion of a past tense.
2. Marcus was a Pompeian
2. Marcus was a Pompeian
Pompeian(Marcus)
3. All Pompeian's were Romans
K N Hande 92
Representing Simple Facts in Logic
4. Caesar was a ruler
ruler(Caesar)
5. All Romans were either loyal to Caesar or hated
him
K N Hande 93
Representing Simple Facts in Logic
6. Everyone is loyal to someone
7. People only try to assassinate rulers they are not
K N Hande 94
7. People only try to assassinate rulers they are not
loyal to
Representing Simple Facts in Logic
7. People only try to assassinate rulers they are
not loyal to
8. Marcus try to assassinate Caesar.
K N Hande 95
8. Marcus try to assassinate Caesar.
Representing Simple Facts in Logic
 Now suppose we want to use these statements
to answer the question.
“Was Marcus loyal to Caesar?”
 Using statement 7 and 8 we should be able to
prove that Marcus was not loyal to Caesar.
prove that Marcus was not loyal to Caesar.
 Now let us try to produce a formal proof
reasoning backward from the desired goal.
K N Hande 96
Knowledge Representation techniques in Artificial Intelligence
Representing Simple Facts in Logic
We need to add another representation of the
fact in our system.
9. All men are people.
K N Hande 98
Representing instance and isa relationships
 Class membership and Class inclusion
 Class membership is represented with unary
predicates.
 Asserting that P(x) is true is equivalent to asserting
 Asserting that P(x) is true is equivalent to asserting
that x is an instance or element of P.
 Predicate instance is binary one whose first
argument is an object and whose second argument
is a class to which object belongs.
K N Hande 99
Knowledge Representation techniques in Artificial Intelligence
Computable
Functions and
Functions and
Predicates
Computable Functions and Predicates
 All the simple facts were represented as a
combination of individual predicates.
 This is fine if the no of facts is not very large
 But suppose we want to express simple facts
such as below
such as below
K N Hande 102
Computable Functions and Predicates
 We cant write here representation of each of the
fact individually.
 So here we need computable predicates.
 We will simply invoke a procedure to find out the
 We will simply invoke a procedure to find out the
value of the predicate, that will evaluate it and
return either true or false.
 We need computable functions as well as
computable predicates.
K N Hande 103
Computable Functions and Predicates
 Computable functions are the formalized analogue of
the intuitive notion of algorithms, in the sense that a
function is computable if there exists an algorithm that
can do the job of the function, i.e. given an input of
the function domain it can return the corresponding
output.
 Ex: If we want to evaluate the truth value of
 Ex: If we want to evaluate the truth value of
gt(2+3,1)
 Here we need computable function for + first,
and then we can find the gt as computable
predicate
K N Hande 104
Computable Functions and Predicates
 Lets take an example to see how these
functions and predicates are useful.
 Consider the following set of facts.
1. Marcus was a man
man(Marcus)
man(Marcus)
2. Marcus was a Pompeian
Pompeian(Marcus)
3. Marcus was born in 40 A.D.
born(Marcus,40)
K N Hande 105
Computable Functions and Predicates
4. All men are mortal
K N Hande 106
6. No mortal lives longer than 150 years
Computable Functions and Predicates
7. It is now 1991
now = 1991
Now suppose we want to answer the question,
“Is Marcus Alive?”
To answer this question we need some additional
To answer this question we need some additional
knowledge.
8. Alive means not dead
K N Hande 107
Computable Functions and Predicates
 This is an example of the fact that rarely do two
expressions have truly identical meanings in all
circumstances.
9. If someone dies, then he is dead at all later
times.
times.
K N Hande 108
Knowledge Representation techniques in Artificial Intelligence
Computable Functions and Predicates
Now lets attempt to answer the question,
“Is Marcus alive?” by proving
K N Hande 110
 Two such proofs are shown below.
 The term nil at the end of each proof indicates that
the list of conditions remaining to be proved is
empty and so the proof has succeeded.
Knowledge Representation techniques in Artificial Intelligence
Knowledge Representation techniques in Artificial Intelligence
Resolution
Resolution
Resolution
 Resolution operates on the statements that have
been converted to a very convenient standard
form.
 Resolution produces proofs by refutation.
 Refutation is simply disproving an opposing
argument
 It is the action of proving a statement or theory to
be wrong or false.
K N Hande 114
Resolution
 Resolution attempts to show that negation of
the statement produces the contradiction with
the known statements.
That is it is unstaisfiable.
 That is it is unstaisfiable.
K N Hande 115
Conversion to Clause Form
 Suppose we know that all Romans who know
Marcus either hate Caesar or thinks that
anyone who hates anyone is crazy.
 We could wff as
K N Hande 116
To use this formula in a proof requires complex matching
process.
Conversion to Clause Form
 The formula would be easier to work with if
 It were flattered, that is there was less
embedding of components
 The quantifiers were separated from the rest
of the formula so that they did not need to be
of the formula so that they did not need to be
considered.
 Conjunctive Normal Form has both of these
properties.
K N Hande 117
Conversion to Clause Form
 Conjunctive normal form (CNF) is an approach to
Boolean logic that expresses formulas as conjunctions
of clauses with an AND or OR. Each clause connected
by a conjunction, or AND, must be either a literal or
contain a disjunction, or OR operator. CNF is useful for
automated theorem proving.
automated theorem proving.
 Remember that we also called “or” “disjunction” and
“and” “conjunction”.
 A clause that contains only ∨
∨
∨
∨ is called a disjunctive
clause and only ∧
∧
∧
∧ is called a conjunctive clause
K N Hande 118
Conversion to Clause Form
• If we put a bunch of disjunctive clauses
together with ∧, it is called conjunctive normal
form.
– For example:
– (p∨
∨
∨
∨r)∧
∧
∧
∧(¬q∨
∨
∨
∨¬r)∧
∧
∧
∧q is in conjunctive normal form.
– (p∨
∨
∨
∨r)∧
∧
∧
∧(¬q∨
∨
∨
∨¬r)∧
∧
∧
∧q is in conjunctive normal form.
K N Hande 119
Algorithm: Convert To Clause Form
K N Hande 120
Algorithm: Convert To Clause Form
K N Hande 121
Algorithm: Convert To Clause Form
K N Hande 122
Algorithm: Convert To Clause Form
K N Hande 123
Algorithm: Convert To Clause Form
K N Hande 124
Algorithm: Convert To Clause Form
K N Hande 125

More Related Content

PPT
Knowldge reprsentations
Tribhuvan University
 
PDF
Computational Intelligence Module iii.pdf
MaidhiliMohan1
 
PDF
UNIT 2.pdf
Pabitha Chidambaram
 
PPTX
Knowledge representation Problem in AI.pptx
SandeepGupta229023
 
PPTX
module-2 ppt knowledge representation computer application
Rockstar152013
 
PPTX
09- Syed Rehan-ai-ppt2.pptx
NandhiniV68
 
PDF
Application for Logical Expression Processing
csandit
 
PPTX
Artificial Intelligence_ Knowledge Representation
ThenmozhiK5
 
Knowldge reprsentations
Tribhuvan University
 
Computational Intelligence Module iii.pdf
MaidhiliMohan1
 
Knowledge representation Problem in AI.pptx
SandeepGupta229023
 
module-2 ppt knowledge representation computer application
Rockstar152013
 
09- Syed Rehan-ai-ppt2.pptx
NandhiniV68
 
Application for Logical Expression Processing
csandit
 
Artificial Intelligence_ Knowledge Representation
ThenmozhiK5
 

Similar to Knowledge Representation techniques in Artificial Intelligence (20)

PPTX
_Artificial_Intelligence_Knowledge_Representation (1).pptx
SulthanMeghana2
 
PDF
Lesson 19
Avijit Kumar
 
PDF
AI Lesson 19
Assistant Professor
 
PDF
Sementic nets
Mudassar Salfi
 
PPTX
Teaching LMMs for Image Quality Scoring and Interpreting
sknps0451
 
PDF
Uncertainty classification of expert systems a rough set approach
Er. rahul abhishek
 
PDF
Semantic_net_and_Frames_in_knowledgeR.pdf
vijeta3feb
 
PPTX
artificial intelligence that covers frames
picnew83
 
PPTX
AI_Unit-3 complete Notes.pptx from RAJIV GANDHI UNIVERSITY
bhargaviwoorkingtool
 
PDF
Metrics for Evaluating Quality of Embeddings for Ontological Concepts
Saeedeh Shekarpour
 
PDF
002_design convivial_method_process
jong K
 
PPTX
AI - ML - DL
Rıdvan SIRMA
 
PDF
Database Management Systems Tutorial
Sachin MK
 
PDF
17032658 database-management-systems-tutorial-090917034406-phpapp02
Samina Sam Sam
 
PDF
6. kr paper journal nov 11, 2017 (edit a)
IAESIJEECS
 
PPT
4KN Editted 2012.ppt
HenokGetachew15
 
PDF
Mapping Human Knowledge with Open Badges
Open Badges
 
PDF
A relation is just a relationship between sets of information. T.pdf
annapurnnatextailes
 
PPTX
OBJECTRECOGNITION1.pptxjjjkkkkjjjjkkkkkkk
shesnasuneer
 
PPTX
OBJECTRECOGNITION1.pptxjjjkkkkjjjjkkkkkkk
shesnasuneer
 
_Artificial_Intelligence_Knowledge_Representation (1).pptx
SulthanMeghana2
 
Lesson 19
Avijit Kumar
 
AI Lesson 19
Assistant Professor
 
Sementic nets
Mudassar Salfi
 
Teaching LMMs for Image Quality Scoring and Interpreting
sknps0451
 
Uncertainty classification of expert systems a rough set approach
Er. rahul abhishek
 
Semantic_net_and_Frames_in_knowledgeR.pdf
vijeta3feb
 
artificial intelligence that covers frames
picnew83
 
AI_Unit-3 complete Notes.pptx from RAJIV GANDHI UNIVERSITY
bhargaviwoorkingtool
 
Metrics for Evaluating Quality of Embeddings for Ontological Concepts
Saeedeh Shekarpour
 
002_design convivial_method_process
jong K
 
AI - ML - DL
Rıdvan SIRMA
 
Database Management Systems Tutorial
Sachin MK
 
17032658 database-management-systems-tutorial-090917034406-phpapp02
Samina Sam Sam
 
6. kr paper journal nov 11, 2017 (edit a)
IAESIJEECS
 
4KN Editted 2012.ppt
HenokGetachew15
 
Mapping Human Knowledge with Open Badges
Open Badges
 
A relation is just a relationship between sets of information. T.pdf
annapurnnatextailes
 
OBJECTRECOGNITION1.pptxjjjkkkkjjjjkkkkkkk
shesnasuneer
 
OBJECTRECOGNITION1.pptxjjjkkkkjjjjkkkkkkk
shesnasuneer
 
Ad

More from kapilhande1 (8)

PDF
Number Theory and Its Applications in Cryptography
kapilhande1
 
PDF
Signal conversion techniques and compression
kapilhande1
 
PDF
Introduction to Data Communication concepts
kapilhande1
 
PDF
Searching Techniques in Artificial Intelligence
kapilhande1
 
PDF
Introduction To Artificial Intelligence and applications
kapilhande1
 
PDF
Ethics In Information Technology Intellectual Property
kapilhande1
 
PDF
Ethics in Information Technology - Privacy
kapilhande1
 
PDF
Ethics in Information Technology - An Overview
kapilhande1
 
Number Theory and Its Applications in Cryptography
kapilhande1
 
Signal conversion techniques and compression
kapilhande1
 
Introduction to Data Communication concepts
kapilhande1
 
Searching Techniques in Artificial Intelligence
kapilhande1
 
Introduction To Artificial Intelligence and applications
kapilhande1
 
Ethics In Information Technology Intellectual Property
kapilhande1
 
Ethics in Information Technology - Privacy
kapilhande1
 
Ethics in Information Technology - An Overview
kapilhande1
 
Ad

Recently uploaded (20)

PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
CDH. pptx
AneetaSharma15
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 

Knowledge Representation techniques in Artificial Intelligence

  • 1. ARTIFICIAL INTELLIGENCE (Unit III) VI Sem B.E. Computer Sc. & Engg Department of Computer Science & Engineering Priyadarshini Bhagwati College of Engineering, Nagpur (Even 2021) Kapil N Hande Head of the Department
  • 2. Contents Knowledge representation: Knowledge representation Issues: First order logic, Predicate Logic, Structured Knowledge Representation: Backward Chaining , Backward Chaining Backward Chaining , Backward Chaining Resolution Semantic Nets Frames, and Scripts Ontology K N Hande 2
  • 3. Representations and Mappings In order to solve complex problems in AI, we need both large amounts of knowledge and some mechanism for manipulating that knowledge. Representing the knowledge is called as facts Representing the knowledge is called as facts We are dealing with two different kinds of entities Facts: truths in some relevant world. These are the things we want to represent K N Hande 3
  • 4. Representations and Mappings Representation of facts in some chosen formalism. Things we will actually be able to manipulate. These entities are structured at two levels: The knowledge level, at which facts are The knowledge level, at which facts are described. The symbol level, at which representation of objects are defined in terms of symbols that can be manipulated by programs. K N Hande 4
  • 5. Figure: Mapping between Facts and Representation
  • 6. Representations and Mappings One representation of the facts is so common that is natural language(English) sentences. English representation of the facts in order to facilitate getting information in and out of the system. Lets look at the simple example using Lets look at the simple example using mathematical logic as representational formalism. Consider the sentence Spot is a dog K N Hande 6
  • 7. Representations and Mappings This fact can be represented in logic as dog(Spot) K N Hande 7
  • 8. Representations and Mappings Available mapping functions are many to many relations. For example two sentences “All dogs have tails” and “Every dog has a tail” could both tails” and “Every dog has a tail” could both represent same fact namely that every dog has atleast one tail. K N Hande 8
  • 10. Representations and Mappings If no good mapping can be defined for the problem, then no matter how good the program to solve the problem is, it will not be able to produce answers that corresponds to able to produce answers that corresponds to real answers of the problem. We need to find the concrete implementation of the abstract concepts. K N Hande 10
  • 11. Approaches to Knowledge Representation A good knowledge representation system must possess the following properties. 1. Representational Accuracy: KR system should have the ability to represent all kind of required knowledge. 2. Inferential Adequacy: KR system should have ability to manipulate the representational structures to produce new knowledge representational structures to produce new knowledge corresponding to existing structure. 3. Inferential Efficiency: The ability to direct the inferential knowledge mechanism into the most productive directions by storing appropriate guides. 4. Acquisitional efficiency- The ability to acquire the new knowledge easily using automatic methods. K N Hande 11
  • 12. Simple Relational Knowledge It is the simplest way of storing facts which uses the relational method, and each fact about a set of the object is set out systematically in columns. This approach of knowledge representation is This approach of knowledge representation is famous in database systems where the relationship between different entities is represented. This approach has little opportunity for inference. K N Hande 12
  • 14. Inheritable Knowledge Structure must have inference mechanism One of the most useful form of inference is property inference, in which elements of specific classes inherit attributes and values from more general classes in which they are from more general classes in which they are included. Objects must be organized into classes, and classes must be arranged in generalization hierarchy K N Hande 14
  • 15. Inheritable Knowledge Following figure shows some additional baseball knowledge inserted into a structure. Lines represent attributes Boxed nodes represent objects and values of attributes of object. attributes of object. These values can also be viewed as objects with values and attributes and so on. The arrows on the line points from an object to its value K N Hande 15
  • 16. Inheritable Knowledge The structure shown in the figure is a slot-and- filler structure, also called as semantic network or collection of frames. Each individual frame represent the collection Each individual frame represent the collection of attributes and values associated with a particular node. K N Hande 16
  • 20. Inheritable Knowledge A semantic network is a graphic notation for representing knowledge in patterns of interconnected nodes. Semantic networks became popular in artificial intelligence and natural language processing only because it represents knowledge or supports reasoning. Frames are an artificial intelligence data structure Frames are an artificial intelligence data structure used to divide knowledge into substructures by representing stereotyped situations. ... Frames are the primary data structure used in artificial intelligence frame language; they are stored as ontologies of sets. K N Hande 20
  • 21. Inheritable Knowledge The attribute isa, is being used to show class inclusion and attribute instance is being used to show class membership. These two specific attributes provides basis for These two specific attributes provides basis for property inheritance as an inference technique. K N Hande 21
  • 24. Inferential Knowledge Inferential knowledge approach represents knowledge in the form of formal logics. This approach can be used to derive more facts. It guaranteed correctness. Sometimes all the power of traditional logic is needed to describe the inferences that are Sometimes all the power of traditional logic is needed to describe the inferences that are needed. Following figure shows examples of the use of first order predicate logic to represent additional knowledge about baseball K N Hande 24
  • 26. Inferential Knowledge We need a inference procedure that can exploit this knowledge. The required inference procedure is the one that implements the standard rules of inference. implements the standard rules of inference. One of the most commonly use procedure is the resolution, which exploits the proof by contradiction. K N Hande 26
  • 27. Procedural Knowledge Operational or procedural knowledge describes what to do when. Procedural knowledge can be represented in the programs by coding. the programs by coding. Procedural knowledge can be represented by production rules. K N Hande 27
  • 30. Issues in Knowledge Representation 1. Important Attributes: There are two general attributes that are very general significance: isa and instance. They support property inheritance They support property inheritance They represent class membership and class inclusion K N Hande 30
  • 31. 2. Relationships among Attributes The attributes that we used to describe objects are themselves entities that we represent. Properties of the attributes are: Inverses Inverses Existence in an isa hierarchy Techniques for reasoning about values Single-valued attributes K N Hande 31
  • 32. Inverses As soon as we describe the entities in the world and its relationship as attributes, we look for binary relationship with others. Attributes are those relationships In semantic nets it was shown as directed arrow originating at the object that was being originating at the object that was being described and terminating at the object representing the value of specified attribute. There are two ways to show the other way of relationships K N Hande 32
  • 33. Inverses The first is to represent both relationships in a single representation that ignores focus. For ex: K N Hande 33 The second approach is to use attributes that focus on single entity but to use them in pairs, one the inverse of the other.
  • 35. An isa hierarchy of attributes Just as we have classes of objects and specialized subsets of those classes, there are attributes and specializations of the attributes. For example attribute height is specialization of the more general attribute physical-size, which in turn specialization of general attribute physical-size, which in turn specialization of physical-attribute. These generalization-specialization relationships are important as they support inheritance K N Hande 35
  • 36. Techniques for reasoning about values Sometimes the values of the attributes are specified explicitly when a knowledge base is created. But the reasoning system must reason about But the reasoning system must reason about values it has not been given explicitly. K N Hande 36
  • 37. Techniques for reasoning about values K N Hande 37
  • 38. Single-valued attributes A specific but very useful kind of attribute is one that is guaranteed to take unique value. If there is already the value present for one of the attributes and a different value is asserted, then one of the two things has happened. Either a change has occurred in the world or there is an contradiction in the knowledge base that needs to be resolved. K N Hande 38
  • 39. 3. Choosing the Granularity of the Representation “At what level of detail should the world be represented?” “What should be our primitives?” In computer science, granularity refers to a ratio of computation to communication – and ratio of computation to communication – and also, in the classical sense, to the breaking down of larger holistic tasks into smaller, more finely delegated tasks. K N Hande 39
  • 40. Choosing the Granularity of the Representation Primitive is the simplest type of programming language item. It may also refer to the smallest processing unit accessible by a programmer. In computer programming, a primitive In computer programming, a primitive (pronounced PRIH-muh-teev ) is a basic interface or segment of code that can be used to build more sophisticated program elements or interfaces. K N Hande 40
  • 41. Choosing the Granularity of the Representation Lets take the following example. Suppose we are interested in following fact John spotted Sue We could represent this as K N Hande 41 So here we can easily answer the question Who spotted Sue? But suppose we wanted to know Did John see Sue? The answer is “Yes” but given only one fact we cant give the answer.
  • 42. Choosing the Granularity of the Representation We could add other facts: spotted(x,y) saw (x,y) We need to represent the fact that spotting is special type of seeing explicitly in the representation of the fact. We might write it representation of the fact. We might write it like: saw(agent(John), object(Sue), timespan(briefly) K N Hande 42
  • 43. Choosing the Granularity of the Representation Here we have used more primitive concepts as seeing and time span. The advantages of using small set of primitives is that rules that are used to define inferences from that knowledge need to be written in terms of inferences. Simple high level facts may require a lot of storage when broken down into primitives. K N Hande 43
  • 44. Choosing the Granularity of the Representation A second but related problem is that if knowledge is initially presented to the system in a relatively high level form, then substantial work must be done to reduce the knowledge in primitive form. done to reduce the knowledge in primitive form. A third problem with the use of low-level primitives is that in many domains it is not all clear what the primitives should be. K N Hande 44
  • 45. Choosing the Granularity of the Representation There may not be enough information present in each use of high level constructs to be enable them to be converted into there primitive components. The classical example of this is provided by The classical example of this is provided by Kinship terminology. Consider one obvious set of primitives: mother, father, son, daughter, brother and sister. K N Hande 45
  • 46. Choosing the Granularity of the Representation But now we are told that Mary is Sue’s cousin An attempt to describe the cousin relationship in terms of the primitives could produce any of the following interpretations: K N Hande 46
  • 47. Choosing the Granularity of the Representation The way to solve this problem is to change our primitives. We could use the set: parent, child, sibling, male and female Then the fact that Mary is Sue’s cousin can be represented as represented as K N Hande 47
  • 48. 4. Representing the Sets of Objects It is important to represent the sets of objects for several reasons. There are several properties that are true of sets that are not true of individual members of set. set. As an example consider the assertions being made in the two sentences, “There are more sheep than people in Australia” and “English speakers can be found all over the World” K N Hande 48
  • 49. Representing the Sets of Objects We can attach assertions here to people, sheep's and English speakers. If a property is true of all elements of a set, then it is more efficient to associate it with set rather than explicitly with every element of the rather than explicitly with every element of the set. Example is Slot-and-filler structure where we have used nodes to represent the sets and inheritance to propagate set level assertions down to individuals. K N Hande 49
  • 50. Representing the Sets of Objects There are three ways in which sets may be represented The simplest is by name For example node named baseball player in semantic net semantic net There are two ways to state the definition of set and its element. The first is to list the members. Such a specification is called extensional definition K N Hande 50
  • 51. Representing the Sets of Objects The second is to provide the rule that, when a particular object is evaluated, returns true or false depending on whether the object is in set or not. Such a rule is called intentional definition. Such a rule is called intentional definition. For example, an extensional description of the set of our Sun’s planet on which people live is {Earth} K N Hande 51
  • 52. Representing the Sets of Objects An intentional description is One way in which extensional and intentional representation differs is that they do not K N Hande 52 representation differs is that they do not necessarily correspond one-to-one with each other
  • 53. 5. Finding the Right Structure as needed Locating the appropriate knowledge structures that have been stored in memory For example suppose we have a script (description of class of events in terms of contexts, participants and sub events) that contexts, participants and sub events) that describes the typical sequence of events in a restaurant. K N Hande 53
  • 54. Finding the Right Structure as needed The answer to the question Did John ate last night? Is “yes” In order to be able to reason about many things a system must have many scripts about a system must have many scripts about everything. K N Hande 54
  • 55. Finding the Right Structure as needed K N Hande 55
  • 56. Selecting an Initial structure Selecting candidate knowledge structures to match a particular problem solving situation is hard problem. There are three approaches to do it Index the structures directly by the significant Index the structures directly by the significant English words that can be used to describe them. Let each verb have associated with it structure that describes its meaning K N Hande 56
  • 57. Selecting an Initial structure This approach may not be adequate as many words may have several distinct meaning. For ex the word “fly” has different meaning in each of the following sentences K N Hande 57
  • 58. Selecting an Initial structure Consider each major concept as a pointer to all structures in which it might be involved. For ex the concept Steak might point to two scripts, one for restaurant and one for super market. market. The concept Bill may point to restaurant and a shopping script. Take the intersection of those sets to get the structures, preferably precisely one, that involves all the content words K N Hande 58
  • 59. Selecting an Initial structure Locate one major clue in the problem description and use it to select an initial structure. As other clues appear, use them to refine the As other clues appear, use them to refine the initial selection or to make the completely new one if necessary. K N Hande 59
  • 60. Revising the choice when necessary The process of instantiating a structure in particular situation often does not proceed smoothly. There are variety of things that can be done Select the fragments of the current structure Select the fragments of the current structure that do correspond to the situation and match them against candidate alternatives. Make an excuse for current structures failure and continue to use it. K N Hande 60
  • 61. Revising the choice when necessary K N Hande 61
  • 63. Introduction Representing simple facts in Logic Representing Instance and Isa relationships relationships Computable functions and predicates Resolution K N Hande 63
  • 64. Introduction Logic, as per the definition of the Oxford dictionary, is the reasoning conducted or assessed according to strict principles and validity“ Logic can be defined as the proof or validation behind any reason provided behind any reason provided It was important to include logic in Artificial Intelligence because we want our agent (system) to think and act humanly, and for doing so, it should be capable of taking any decision based on the current situation. K N Hande 64
  • 65. First Order Logic (FOL) First-order logic(FOL) is another way of knowledge representation in artificial intelligence. It is an extension to propositional logic. FOL is sufficiently expressive to represent the natural language statements in a concise way. First-order logic is also known as Predicate logic or First-order logic is also known as Predicate logic or First-order predicate logic. First-order logic is a powerful language that develops information about the objects in a more easy way and can also express the relationship between those objects. K N Hande 65
  • 66. First Order Logic (FOL) First-order logic (like natural language) does not only assume that the world contains facts like propositional logic but also assumes the following things in the world: Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ...... Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation such as: the sister of, brother of, adjacent, or n-any relation such as: the sister of, brother of, has color, comes between Function: Father of, best friend, third inning of, end of, ...... As a natural language, first-order logic also has two main parts: Syntax Semantics K N Hande 66
  • 67. Syntax of First-Order logic The syntax of FOL determines which collection of symbols is a logical expression in first-order logic. The basic syntactic elements of first-order logic are symbols. We write statements in logic are symbols. We write statements in short-hand notation in FOL. K N Hande 67
  • 68. Basic Elements of First-order logic Constant 1, 2, A, John, Mumbai, cat,.... Variables x, y, z, a, b,.... Predicates Brother, Father, ,.... Function sqrt, LeftLegOf, .... K N Hande 68 Function sqrt, LeftLegOf, .... Connectives ∧ ∧ ∧ ∧, ∨ ∨ ∨ ∨, ¬, ⇒ ⇒ ⇒ ⇒, ⇔ ⇔ ⇔ ⇔ Equality == Quantifier ∀ ∀ ∀ ∀, ∃ ∃ ∃ ∃
  • 69. Predicate Logic A predicate is an expression of one or more variables determined on some specific domain. A predicate with variables can be made a proposition by either authorizing a value to the variable or by quantifying the variable. variable or by quantifying the variable. The variable of predicates is quantified by quantifiers. There are two types of quantifier in predicate logic - Existential Quantifier and Universal Quantifier. K N Hande 69
  • 71. Propositional Logic Propositional logic is a simple form of logic which is also known as Boolean logic. A proposition has TRUTH values (0 and 1) which means it can have one of the two values i.e. True or False. True or False. Propositional logic is used in artificial intelligence for planning, problem-solving, intelligent control and most importantly for decision-making. K N Hande 71
  • 72. Propositional Logic A proposition is basically a declarative sentence that has a truth value. The purpose of using propositional logic is to analyze a statement, individually or analyze a statement, individually or compositely. K N Hande 72
  • 73. Propositional Logic For example : The following statements : If x is real, then x2 0 What is your name? (a+b)2 = 100 (a+b)2 = 100 This statement is false. This statement is true. Are not propositions because they do not have a truth value. They are ambiguous. K N Hande 73
  • 74. Propositional Logic But the following statements : (a+b)2 = a2 + 2ab + b2 If x is real, then x2 = 0 If x is real, then x2 0 If x is real, then x2 0 The sun rises in the east. The sun rises in the west. Are all propositions because they have a specific truth value, true or false. K N Hande 74
  • 75. Basic facts about Propositional Logic Propositional logic is also called Boolean logic as it works on 0 and 1. In propositional logic, we use symbolic variables to represent the logic, and we can use any symbol for a representing a proposition, such A, B, C, P, Q, R, etc. Propositions can be either true or false, but it cannot be both. both. Propositional logic consists of an object, relations or function, and logical connectives. These connectives are also called logical operators. The propositions and connectives are the basic elements of the propositional logic. K N Hande 75
  • 76. Basic facts about Propositional Logic Connectives can be said as a logical operator which connects two sentences. A proposition formula which is always true is called tautology, and it is also called a valid sentence. A proposition formula which is always false is called Contradiction. called Contradiction. Statements which are questions, commands, or opinions are not propositions such as Where is Rohini, How are you, What is your name, are not propositions. K N Hande 76
  • 77. Differences Sr No Propositional Logic Predicate Logic 1 Propositional logic is the logic that deals with a collection of declarative statements which have a truth value, true or false. Predicate logic is an expression consisting of variables with a specified domain. It consists of objects, relations and functions between the objects. 2 It is the basic and most widely used logic. Also known as Boolean logic. It is an extension of propositional logic covering predicates and quantification. K N Hande 77 3 A proposition has a specific truth value, either true or false. A predicate’s truth value depends on the variables’ value. 4 Scope analysis is not done in propositional logic. Predicate logic helps analyze the scope of the subject over the predicate. There are three quantifiers : Universal Quantifier (∀) depicts for all, Existential Quantifier (∃) depicting there exists some and Uniqueness Quantifier (∃!) depicting exactly one.
  • 78. Differences Sr No Propositional Logic Predicate Logic 5 Propositions are combined with Logical Operators or Logical Connectives like Negation(¬), Disjunction(∧), Conjunction(∨), Exclusive OR(⊕), Implication(⇒), Bi-Conditional or ⇔ Predicate Logic adds by introducing quantifiers to the existing proposition. K N Hande 78 ∧ ∨ ⊕ Implication(⇒), Bi-Conditional or Double Implication(⇔). 6 It is a more generalized representation. It is a more specialized representation. 7 It cannot deal with sets of entities. It can deal with set of entities with the help of quantifiers.
  • 79. Representing Simple Facts in Logic First-order logic statements can be divided into two parts: Subject: Subject is the main part of the statement. Predicate: A predicate can be defined as a relation, which binds two atoms together in a statement. Consider the statement: x is an integer., it Consider the statement: x is an integer., it consists of two parts, the first part x is the subject of the statement and second part is an integer, is known as a predicate. K N Hande 79
  • 80. Representing Simple Facts in Logic K N Hande 80 A quantifier is a language element which generates quantification, and quantification specifies the quantity of specimen in the universe of discourse. These are the symbols that permit to determine or identify the range and scope of the variable in the logical expression. There are two types of quantifier: Universal Quantifier, (for all, everyone, everything) Existential quantifier, (for some, at least one).
  • 81. Representing Simple Facts in Logic Properties of Quantifiers: In universal quantifier, ∀ ∀ ∀ ∀x∀ ∀ ∀ ∀y is similar to ∀ ∀ ∀ ∀y∀ ∀ ∀ ∀x. In Existential quantifier, ∃ ∃ ∃ ∃x∃ ∃ ∃ ∃y is similar to ∃ ∃ ∃ ∃y∃ ∃ ∃ ∃x. ∃ ∃ ∃ ∃ ∀ ∀ ∀ ∀ ∀ ∀ ∀ ∀ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃x∀ ∀ ∀ ∀y is not similar to ∀ ∀ ∀ ∀y∃ ∃ ∃ ∃x. K N Hande 81
  • 82. Some Examples of FOL using quantifier 1. All birds fly. In this question the predicate is fly(bird). And since there are all birds who fly so it will be represented as follows. ∀ ∀ ∀ ∀x bird(x) →fly(x). 2. Every man respects his parent. ∀ ∀ ∀ ∀ 2. Every man respects his parent. In this question, the predicate is respect(x, y), where x=man, and y= parent. Since there is every man so will use ∀ ∀ ∀ ∀, and it will be represented as follows: ∀ ∀ ∀ ∀x man(x) → respects (x, parent). K N Hande 82
  • 83. Some Examples of FOL using quantifier 3. Some boys play cricket. In this question, the predicate is play(x, y), where x= boys, and y= game. Since there are some boys so we will use ∃ ∃ ∃ ∃, and it will be represented as: ∃ ∃ ∃ ∃x boys(x) → play(x, cricket). ∃ ∃ ∃ ∃ ∃ ∃ ∃ ∃x boys(x) → play(x, cricket). K N Hande 83
  • 84. Some Examples of FOL using quantifier 4. Not all students like both Mathematics and Science. In this question, the predicate is like(x, y), where x= student, and y= subject. Since there are not all students, so we will use ∀ ∀ ∀ ∀ with negation, so following is the use ∀ ∀ ∀ ∀ with negation, so following is the representation for this: ¬∀ ∀ ∀ ∀ (x) [ student(x) → like(x, Mathemacs) ∧ ∧ ∧ ∧ like(x, Science)]. K N Hande 84
  • 85. Some Examples of FOL using quantifier 5. Only one student failed in Mathematics. In this question, the predicate is failed(x, y), where x= student, and y= subject. Since there is only one student who failed in Mathematics, so we will use following representation for this: ∃ ∃ ∃ ∃ representation for this: ∃ ∃ ∃ ∃(x) [ student(x) → failed (x, Mathematics) ∧∀ ∧∀ ∧∀ ∧∀ (y) [¬(x==y) ∧ ∧ ∧ ∧ student(y) → ¬failed (x, Mathematics)]. K N Hande 85
  • 86. Representing Simple Facts in Logic We can represent real world facts as logical propositions written as well formed formulas (wff) in propositional logic. K N Hande 86
  • 87. Representing Simple Facts in Logic Suppose we want to represent the fact Socrates is a Man We could write SOCRATESMAN But if we also want to represent But if we also want to represent Plato is a Man We would have to write something such as PLATOMAN K N Hande 87
  • 88. Representing Simple Facts in Logic It would be much better to represent these facts as: MAN(SOCRATES) MAN(PLATO) Since now the structure of representation reflects Since now the structure of representation reflects the structure of the knowledge itself. Suppose we want to represent the fact All men are mortal. K N Hande 88
  • 89. Representing Simple Facts in Logic We could represent this as MORTALMAN But that fails to capture the relationship between any individual being a man and that individual being a mortal. individual being a mortal. In predicate logic we can represent real world facts as statements written as wff’s K N Hande 89
  • 90. Representing Simple Facts in Logic Lets now see the use of predicate logic as a way of representing knowledge by looking at specific example. Consider the following set of sentences: K N Hande 90
  • 91. Representing Simple Facts in Logic K N Hande 91
  • 92. Representing Simple Facts in Logic These sentences can be represented as wff in Predicate logic as follows: 1. Marcus was a man man(Marcus) It fails to capture the notion of a past tense. 2. Marcus was a Pompeian 2. Marcus was a Pompeian Pompeian(Marcus) 3. All Pompeian's were Romans K N Hande 92
  • 93. Representing Simple Facts in Logic 4. Caesar was a ruler ruler(Caesar) 5. All Romans were either loyal to Caesar or hated him K N Hande 93
  • 94. Representing Simple Facts in Logic 6. Everyone is loyal to someone 7. People only try to assassinate rulers they are not K N Hande 94 7. People only try to assassinate rulers they are not loyal to
  • 95. Representing Simple Facts in Logic 7. People only try to assassinate rulers they are not loyal to 8. Marcus try to assassinate Caesar. K N Hande 95 8. Marcus try to assassinate Caesar.
  • 96. Representing Simple Facts in Logic Now suppose we want to use these statements to answer the question. “Was Marcus loyal to Caesar?” Using statement 7 and 8 we should be able to prove that Marcus was not loyal to Caesar. prove that Marcus was not loyal to Caesar. Now let us try to produce a formal proof reasoning backward from the desired goal. K N Hande 96
  • 98. Representing Simple Facts in Logic We need to add another representation of the fact in our system. 9. All men are people. K N Hande 98
  • 99. Representing instance and isa relationships Class membership and Class inclusion Class membership is represented with unary predicates. Asserting that P(x) is true is equivalent to asserting Asserting that P(x) is true is equivalent to asserting that x is an instance or element of P. Predicate instance is binary one whose first argument is an object and whose second argument is a class to which object belongs. K N Hande 99
  • 102. Computable Functions and Predicates All the simple facts were represented as a combination of individual predicates. This is fine if the no of facts is not very large But suppose we want to express simple facts such as below such as below K N Hande 102
  • 103. Computable Functions and Predicates We cant write here representation of each of the fact individually. So here we need computable predicates. We will simply invoke a procedure to find out the We will simply invoke a procedure to find out the value of the predicate, that will evaluate it and return either true or false. We need computable functions as well as computable predicates. K N Hande 103
  • 104. Computable Functions and Predicates Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do the job of the function, i.e. given an input of the function domain it can return the corresponding output. Ex: If we want to evaluate the truth value of Ex: If we want to evaluate the truth value of gt(2+3,1) Here we need computable function for + first, and then we can find the gt as computable predicate K N Hande 104
  • 105. Computable Functions and Predicates Lets take an example to see how these functions and predicates are useful. Consider the following set of facts. 1. Marcus was a man man(Marcus) man(Marcus) 2. Marcus was a Pompeian Pompeian(Marcus) 3. Marcus was born in 40 A.D. born(Marcus,40) K N Hande 105
  • 106. Computable Functions and Predicates 4. All men are mortal K N Hande 106 6. No mortal lives longer than 150 years
  • 107. Computable Functions and Predicates 7. It is now 1991 now = 1991 Now suppose we want to answer the question, “Is Marcus Alive?” To answer this question we need some additional To answer this question we need some additional knowledge. 8. Alive means not dead K N Hande 107
  • 108. Computable Functions and Predicates This is an example of the fact that rarely do two expressions have truly identical meanings in all circumstances. 9. If someone dies, then he is dead at all later times. times. K N Hande 108
  • 110. Computable Functions and Predicates Now lets attempt to answer the question, “Is Marcus alive?” by proving K N Hande 110 Two such proofs are shown below. The term nil at the end of each proof indicates that the list of conditions remaining to be proved is empty and so the proof has succeeded.
  • 114. Resolution Resolution operates on the statements that have been converted to a very convenient standard form. Resolution produces proofs by refutation. Refutation is simply disproving an opposing argument It is the action of proving a statement or theory to be wrong or false. K N Hande 114
  • 115. Resolution Resolution attempts to show that negation of the statement produces the contradiction with the known statements. That is it is unstaisfiable. That is it is unstaisfiable. K N Hande 115
  • 116. Conversion to Clause Form Suppose we know that all Romans who know Marcus either hate Caesar or thinks that anyone who hates anyone is crazy. We could wff as K N Hande 116 To use this formula in a proof requires complex matching process.
  • 117. Conversion to Clause Form The formula would be easier to work with if It were flattered, that is there was less embedding of components The quantifiers were separated from the rest of the formula so that they did not need to be of the formula so that they did not need to be considered. Conjunctive Normal Form has both of these properties. K N Hande 117
  • 118. Conversion to Clause Form Conjunctive normal form (CNF) is an approach to Boolean logic that expresses formulas as conjunctions of clauses with an AND or OR. Each clause connected by a conjunction, or AND, must be either a literal or contain a disjunction, or OR operator. CNF is useful for automated theorem proving. automated theorem proving. Remember that we also called “or” “disjunction” and “and” “conjunction”. A clause that contains only ∨ ∨ ∨ ∨ is called a disjunctive clause and only ∧ ∧ ∧ ∧ is called a conjunctive clause K N Hande 118
  • 119. Conversion to Clause Form • If we put a bunch of disjunctive clauses together with ∧, it is called conjunctive normal form. – For example: – (p∨ ∨ ∨ ∨r)∧ ∧ ∧ ∧(¬q∨ ∨ ∨ ∨¬r)∧ ∧ ∧ ∧q is in conjunctive normal form. – (p∨ ∨ ∨ ∨r)∧ ∧ ∧ ∧(¬q∨ ∨ ∨ ∨¬r)∧ ∧ ∧ ∧q is in conjunctive normal form. K N Hande 119
  • 120. Algorithm: Convert To Clause Form K N Hande 120
  • 121. Algorithm: Convert To Clause Form K N Hande 121
  • 122. Algorithm: Convert To Clause Form K N Hande 122
  • 123. Algorithm: Convert To Clause Form K N Hande 123
  • 124. Algorithm: Convert To Clause Form K N Hande 124
  • 125. Algorithm: Convert To Clause Form K N Hande 125