0% found this document useful (0 votes)
15 views34 pages

Unit - III Knowledge Representation

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)
15 views34 pages

Unit - III Knowledge Representation

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/ 34

Artificial Intelligence (KCS-071)

4th year (Semester – VII)


Session – 2023- 24
Unit – III
Lecture – 1
Manoj Mishra
Asst. Prof.
CSE Dept.
UCER, Prayagraj
Knowledge Representation
• Knowledge Representation (KR) is an area of
artificial intelligence research aimed at
representing knowledge in symbols to facilitate
inferencing from those knowledge elements,
creating new elements of knowledge.
• The KR can be made to be independent of the
underlying knowledge model or knowledge base
system (KBS) such as a semantic network.

A.I., KCS-071, Manoj Mishra 2


Knowledge Representation
• The primary component of a knowledge-
based agent is its knowledge-base.
– A knowledge-base is a set of sentences.
– Each sentence is expressed in a language called
the knowledge representation language.
– Sentences represent some assertions about the
world.
– There must be mechanisms to derive new
sentences from old ones. This process is known as
inferencing or reasoning.

A.I., KCS-071, Manoj Mishra 3


Knowledge Representation
– Inference must obey the primary requirement that
the new sentences should follow logically from
the previous ones.
– Logic is the primary vehicle for representing and
reasoning about knowledge.
– The advantage of using formal logic as a language
of AI is that it is precise and definite.

A.I., KCS-071, Manoj Mishra 4


Knowledge Representation
• A logic consists of two parts – a language and a method
of reasoning.
• The logical language, in turn, has two aspects, syntax
and semantics.
• Thus to specify or define a particular logic, one needs
to specify three things.
– Syntax: Syntax specifies the symbols in the
language and how they can be combined to form
sentences. Hence, facts about the world are represented
as sentences in logic. It is the atomic symbols of the logical
language, and the rules for constructing well-formed, non-
atomic expressions (symbol structures) of the logic.

A.I., KCS-071, Manoj Mishra 5


Knowledge Representation
– Semantics: It is the meaning of the atomic
symbols of the logic, and the rules for
determining the meanings of non-atomic expressions
of the logic. It specifies what facts in the world a
sentence refers to. A fact is a claim about the world,
and may be true or false.
– Syntactic Inference Method: The rules for
determining a subset of
logical expressions, called theorems of the logic. It
refers to mechanical method for computing (deriving)
new (true) sentences from existing ones.

A.I., KCS-071, Manoj Mishra 6


Characteristics of Knowledge
Representation (KR)
• A good knowledge representation covers six
basic characteristics:
– Coverage – which means the KR covers a
breadth and depth of information.
Without a wide coverage, the KR cannot
determine anything or resolve ambiguities.
– Understandable by humans – KR is viewed as a
natural language,
so the logic should flow freely. It should have
simple primitives that combine in complex forms.

A.I., KCS-071, Manoj Mishra 7


Characteristics of Knowledge
Representation (KR)
– Consistency - By being consistent, the KR can
eliminate redundant or conflicting
knowledge.
– Efficient
– Easiness – for modifying and updating.
– Supports the intelligent activity - which uses the
knowledge base.

A.I., KCS-071, Manoj Mishra 8


Artificial Intelligence (KCS-071)
4th year (Semester – VII)
Session – 2023 - 24
Unit – III
Lecture – 2
Manoj Mishra
Asst. Prof.
CSE Dept.
UCER, Prayagraj
Propositional Logic
• Propositional logic is concerned with
propositions and their interrelationships.
• A proposition is a possible condition of the
world about which we want to say something.
• The condition need not be true in order for us
to talk about it.
• In fact, we might want to say that it is false or
that it is true if some other proposition is true.

A.I., KCS-071, Manoj Mishra 10


Propositional Logic
• In propositional logic, there are two types of
sentences:
– Simple sentences: Simple sentences express
“atomic” propositions about
the world.
– Compound sentences: Compound sentences
express logical
relationships between the simpler sentences of
which they are composed.

A.I., KCS-071, Manoj Mishra 11


Propositional Logic
• There are six types of compound sentences,
viz., negations(¬), conjunctions(˄),
disjunctions(˅), implications(→),
reductions(←) and equivalences(↔).
• Operator precedence: ¬
˄
˅
→←↔
The above is the hierarchy of precedence of operators.

A.I., KCS-071, Manoj Mishra 12


Propositional Logic
• An interpretation for propositional logic is a mapping
assigning a truth value to each of the simple sentences
of the language.
• The assignment shown below is an example of
interpretation ‘i’ on a particular logical language.
pi = true
qi = false
ri = true
• We say that the interpretation ‘i’ satisfies a sentence if
and only if it is true under that interpretation.

A.I., KCS-071, Manoj Mishra 13


Validity, Satisfiability, Unsatisfiability,
Contingent
• Valid: A sentence is valid if and only if it is
satisfied by every interpretation. The
following sentence is valid.
p ˅ ¬p
• Satisfiable: A sentence is satisfiable if and
only if it is satisfied by at least one
interpretation.
A sentence is falsifiable if and only
if there is at least one interpretation that makes it
false.
A.I., KCS-071, Manoj Mishra 14
Validity, Satisfiability, Unsatisfiability,
Contingent
• Unsatisfiable: A sentence is unsatisfiable if
and only if it is not satisfied by
any interpretation. The following sentence is
unsatisfiable.
p ˄ ¬p
• Contingent: A sentence is contingent if and
only if it is both satisfiable and
falsifiable, i.e., it is neither valid nor
unsatisfiable.

A.I., KCS-071, Manoj Mishra 15


Artificial Intelligence (KCS-071)
4th year (Semester – VII)
Session – 2023 - 24
Unit – III
Lecture – 3
Manoj Mishra
Asst. Prof.
CSE Dept.
UCER, Prayagraj
Predicate Logic
• A predicate is a verb phrase template that
describes property of objects, or a relationship
among objects represented by the variables.
• The propositional logic is not powerful enough
to represent all types of assertions that are
used in computer science and mathematics, or
to express certain types of relationship
between propositions such as equivalence.

A.I., KCS-071, Manoj Mishra 17


Predicate Logic
• To cope up with deficiencies of propositional logic, two
new features are introduced: predicates and
quantifiers.
– For ex., the sentence “The car Tom is driving is blue”, “The
sky is blue” and “The cover of this book is blue” come from
the template “is blue”. The phrase “is blue” is a predicate
and it describes the property of being blue.
– Predicates are often given a name. For ex., “B” can be used
to represent the predicate “is blue” among others. If we
adopt B as the name for the predicate “is blue”, sentences
that assert an object “is blue” can be represented as B(x)
where ‘x’ represents an arbitrary object. B(x) reads as “x is
blue”.

A.I., KCS-071, Manoj Mishra 18


Representing facts with predicate
logic
• Let us consider a specific example of representing
knowledge using predicate logic.
• Let us consider the following sentences.
1) Marcus was a man.
2) Marcus was a Pompeian.
3) All Pompeians were Romans.
4) Caesar was a ruler.
5) All Romans were either loyal to Caesar or hated him.
6) Everyone is loyal to someone.
7) People only try to assassinate rulers they are not loyal to.
8) Marcus tried to assassinate Caesar.
9) All men are people.

A.I., KCS-071, Manoj Mishra 19


Representing facts with predicate
logic
• These can be represented in predicate logic as follows:
1) man(Marcus)
2) Pompeian(Marcus)
3) ɏx : Pompeian(x) → Roman(x)
4) ruler(Caesar)
5) ɏx : Roman(x) → loyalto(x, Caesar) ˅ hate(x, Caesar)
6) ɏx : →y : loyalto(x, y)
7) ɏx : ɏy : person(x) ˄ ruler(y) ˄ tryassassinate(x, y) →
¬loyalto(x, y)
8) tryassassinate(Marcus, Caesar)
9) ɏx : man(x) → person(x)

A.I., KCS-071, Manoj Mishra 20


Representing facts with predicate
logic
• Now, suppose that we want to use these
statements to answer the question
“Was Marcus loyal to Caesar?”
• It seems that using 7 and 8, we should be able
to prove that “Marcus was not loyal to
Caesar”.
• Now let’s produce a formal proof, reasoning
backward from the desired goal.

A.I., KCS-071, Manoj Mishra 21


Representing facts with predicate
logic
¬loyalto(Marcus, Caesar)
↑ (7, substitution)
person(Marcus) ˄ ruler(Caesar) ˄ tryassassinate(Marcus, Caesar)
↑ (4)
person(Marcus) ˄ tryassassinate(Marcus, Caesar)
↑ (8)
person(Marcus)
↑ (9)
man(Marcus)
↑ (1)
Nil

Since the answer obtained is nil, so the given set of predicates


satisfy the desired goal.
Hence, Marcus was not loyal to Caesar.
A.I., KCS-071, Manoj Mishra
(proved) 22
Representing facts with predicate
logic
• From this simple example, we see that three important
issues must be addressed in the process of converting
English sentences into logical statements and then
using those statements to deduce new ones:
– Many English sentences are ambiguous (for ex., 5, 6 and 7
above). Choosing the correct interpretation may be
difficult.
– There is often a choice of how to represent knowledge.
Simple representations are desirable, but they may
exclude certain kinds of reasoning.
– Even in very simple situations, a set of sentences is unlikely
to contain all the information necessary to reason about
the topic at hand.

A.I., KCS-071, Manoj Mishra 23


Artificial Intelligence (KCS-071)
4th year (Semester – VII)
Session – 2023 - 24
Unit – III
Lecture – 4
Manoj Mishra
Asst. Prof.
CSE Dept.
UCER, Prayagraj
Representing facts with predicate
logic
• An additional problem arises in situations where
we do not know in advance which statements to
deduce.
• In the example just presented, the object was to
answer the question “Was Marcus loyal to
Caesar?”
• How would a program decide whether to prove
loyalto(Marcus, Caesar)
or ¬loyalto(Marcus, Caesar)

A.I, KCS-071, Manoj Mishra 25


Representing facts with predicate
logic
• There are several things it could do.
– It could abandon the strategy we have outlined of
reasoning backward from a proposed truth to the
axioms and instead try to reason forward and see
which answer it gets to. The problem with this
approach is that, in general, the branching factor
going forward from the axioms is so great that it
would probably not get to either answer in any
reasonable amount of time.

A.I, KCS-071, Manoj Mishra 26


Representing facts with predicate
logic
– A second thing it could do is use some sort of heuristic
rules for deciding which answer is more likely and
then try to prove that one first. If it fails to find a proof
after some reasonable amount of effort, it can try the
other answer.
– Another thing it could do is simply try to prove both
answers simultaneously and stop when one effort is
successful. Even here, however, if there is not enough
information available to answer the question with
certainty, the program may never halt.
– A fourth strategy is to try both to prove one another
and to disprove it, and to use information gained in
one of the processes to guide the other.

A.I, KCS-071, Manoj Mishra 27


Representing facts with predicate
logic
• Let us try another example
“Did Marcus hate Caesar?”
• Now, let us try to prove “Marcus hated Caesar”

hate(Marcus, Caesar)
↑(5, substitution)
Roman(Marcus) ˄ ¬loyalto(Marcus, Caesar)
↑(3, substitution)
Pompeian(Marcus) ˄ ¬loyalto(Marcus, Caesar)
↑(2)

A.I, KCS-071, Manoj Mishra 28


Representing facts with predicate
logic
¬loyalto(Marcus, Caesar)
↑ (7, substitution)
person(Marcus) ˄ ruler(Caesar) ˄ tryassassinate(Marcus, Caesar)
↑ (4)
person(Marcus) ˄ tryassassinate(Marcus, Caesar)
↑ (8)
person(Marcus)
↑ (9)
man(Marcus)
↑ (1)
Nil

Since the answer obtained is nil, so the given set of predicates


satisfy the desired goal.
Hence, Marcus hated Caesar. (proved)
A.I, KCS-071, Manoj Mishra 29
Computable functions and predicates
• Suppose we want to express simple facts, such
as greater-than and less-than relationships,
which is shown as below.
gt(1,0) lt(0,1)
gt(2,1) lt(1,2)
gt(3,2) lt(2,3)
• Such relationships representation are called as
computable predicates. These predicates
evaluate rules and return true or false.
A.I, KCS-071, Manoj Mishra 30
Computable functions and predicates
• Let us consider the following set of facts, again
involving Marcus:
1) Marcus was a man.
2) Marcus was a Pompeian.
3) Marcus was born in 40 A.D.
4) All men are mortal.
5) All Pompeians died when the volcano erupted in 79 A.D.
6) No mortal lives longer than 150 years.
7) It is now 1991.
8) Alive means not dead.
9) If someone dies, then he is dead at all later times.

A.I, KCS-071, Manoj Mishra 31


Computable functions and predicates
• These can be represented in predicate logic as follows:
1) man(Marcus)
2) Pompeian(Marcus)
3) born(Marcus, 40)
4) ɏx : man(x) → mortal(x)
5) erupted(volcano, 79) ˄ ɏx : [Pompeian(x) →
died(x, 79)]
6) ɏx : ɏt1 : ɏt2 : mortal(x) ˄ born(x, t1) ˄ gt(t2 – t1, 150)
→ dead(x, t2)
7) now = 1991
8) ɏx : ɏt : [alive(x, t) → ¬dead(x, t)] ˄ [¬dead(x, t) → alive(x, t)]
9) ɏx : ɏt1 : ɏt2 : died(x, t1) ˄ gt(t2, t1) → dead(x, t2)

A.I, KCS-071, Manoj Mishra 32


Computable functions and predicates
• Now let’s attempt to answer the question
“Is Marcus alive?”
• Now, let us try to prove “Marcus is not alive”.
¬alive(Marcus, now)
↑ (8, substitution)
dead(Marcus, now)
↑ (9, substitution)
died(Marcus, t1) ˄ gt(now, t1)
↑ (5, substitution)
Pompeian(Marcus) ˄ gt(now, 79)
↑ (2)
gt(now, 79)
` ↑ (7, substitute equals)
gt(1991, 79)
↑ (compute gt)
Nil
Since the answer obtained is nil, so the given set of predicates satisfy the desired
goal.
A.I, KCS-071, Manoj Mishra 33
Hence, Marcus is not alive. (proved)
Computable functions and predicates
• Another way of proving that “Marcus is not alive”.
¬alive(Marcus, now)
↑ (8, substitution)
dead(Marcus, now)
↑ (6, substitution)
mortal(Marcus) ˄ born(Marcus, t1) ˄ gt(now – t1, 150)
↑ (4, substitution)
man(Marcus) ˄ born(Marcus, t1) ˄ gt(now – t1, 150)
↑ (1)
born(Marcus, t1) ˄ gt(now – t1, 150)
↑ (3)
gt(now – 40, 150)
` ↑ (7, substitute equals)
gt(1991 – 40, 150)
↑ (compute minus)
gt(1951, 150)
↑ (compute gt)
Nil
Since the answer obtained is nil, so the given set of predicates satisfy the desired goal.
Hence, Marcus is not alive. (proved)

A.I, KCS-071, Manoj Mishra 34

You might also like