You are on page 1of 41

Knowledge Representation

Introduction
Some method must be used in order to convert
the reasoning into a form suitable for computer
manipulation.
The result is known as symbolic Logic or
Mathematical logic.
It is the system of rules that permit the drawing
of Inferences using a variety of techniques
called as Computational Logic.
Computational Logic
There are 2 kinds of the Computational
Logic
 Propositional Logic
 Predicate Logic
Propositional Logic
A propositional logic is nothing more than a statement
that is either True(T) or False (F).
In Propositional Logic we use the symbols such as
letters of the alphabets to represent various propositions,
premises, or conclusions. Eg.
 A = The mailman comes Monday through Saturday.
 B = Today is Sunday
 C = The Postman will not come today.
The above is simple but Life problems involve many
interrelated propositions. To form more complex
premises, premises can be combined using logical
connections. These are Designated as “AND, OR, NOT,
IMPLIES, EQUIVALENT”.
Propositional Logic
CONNECTIVE SYMBOL
AND ^, & , п
OR V, U, +
NOT ~
IMPLIES →
If and only if <=>
EQUIVALENT Ξ
1. NOT
A = It is Raining today
Not A = It is not Raining today

A NOT A
T F

F T
AND
The Resulting proposition is true only if both
the Original propositions are True.
 D = The Car is Black
 E = The car has Six cylinder Engine
 F = The Car is Black AND The car has Six
cylinder Engine
 F = D AND E (or F=DE)
D E F
F F F
F T F
T F F
T T T
3. OR
The new proposition is true if either one or both of
the original propositions are true.
 P = The moon is round.
 Q = The star is bright.
 R = The moon is round OR The star is bright.
 R = P OR Q
P Q R
F F F
F T T
T F T
T T T
4. IMPLIES
It means that if proposition A is true then
Proposition B is also true. The truth of A implies
the Truth of B or:
A→B
Eg.
 A = the Cars engine is defective
 B = I Cannot drive today.
 C = A IMPLIES B.
Another way to explain the IMPLIES is to use an
IF-THEN arrangement. In the above example we
can say that IF the cars engine is defective,
THEN I will not drive today.
IMPLIES
The implies function is a bit difficult to understand.
the first condition says that if A is false and B is False C
is true.
The second is that even the Cars Engine is not
defective, then I cannot drive today. Means you Cannot
drive for some other Reason.
The third says that if A is true
And C is false then A IMPLIES B
Is false. This is the only combination A B C
That gives the false result. It states F F T
that if the Cars Engine is defective,
then I can drive Today. F T T
T F F
T T T
If and only if (⇔)
 A ⇔B is bi-conditional logical connective
which is true when p and q are both false or
both are true.
The truth table is as follows:
A B A⇔B

True True True

True False False

False True False

False False True


Tautologies

A Tautology is a formula which is always


true for every value of its propositional
variables.

Prove [(A → B) Λ A] →B is a tautology


Tautology
A B A→B (A → B) Λ [(A → B) Λ A] →B
A

TRUE TRUE TRUE TRUE TRUE

TRUE FALSE FALSE FALSE TRUE

FALSE TRUE TRUE FALSE TRUE

FALSE FALSE TRUE FALSE TRUE


Contradictions

A Contradiction is a formula which is


always false for every value of its
propositional variables.

Prove (A V B) Λ [(¬A) Λ (¬B)] is a


contradiction
A B AVB ¬A ¬B (¬A) Λ (¬B) (A V B) Λ
[(¬A) Λ (¬B)]

TRUE TRUE TRUE FALSE FALSE FALSE FALSE

TRUE FALSE TRUE FALSE TRUE FALSE FALSE

FALSE TRUE TRUE TRUE FALSE FALSE FALSE

FALSE FALSE FALSE TRUE TRUE TRUE FALSE


Contingency

A Contingency is a formula which has both


some true and some false values for every
value of its propositional variables.

Prove (A V B) Λ (¬A) a contingency


A B AVB ¬A (A V B) Λ (¬A)

TRUE TRUE TRUE FALSE FALSE

TRUE FALSE TRUE FALSE FALSE

FALSE TRUE TRUE TRUE TRUE

FALSE FALSE FALSE TRUE FALSE


Propositional Equivalences

Two statements X and Y are logically


equivalent if any of the following two
conditions hold:

The truth tables of each statement have


the same truth values.
The bi-conditional statement X ⇔ Y is a
tautology.
Prove ¬ (A V B) and [(¬A) Λ (¬B)] are
equivalent
Testing by 1st method
(Matching truth table):
A B AVB ¬A ¬B (¬A) Λ (¬B) ¬ (A V B)

TRUE TRUE TRUE FALSE FALSE FALSE FALSE

TRUE FALSE TRUE FALSE TRUE FALSE FALSE

FALSE TRUE TRUE TRUE FALSE FALSE FALSE

FALSE FALSE FALSE TRUE TRUE TRUE TRUE


Testing by 2nd method (Bi-
conditionality):
A B (¬A) Λ (¬B) ¬ (A V [¬ (A V B)] ⇔[(¬A) Λ (¬B)]
B)

TRUE TRUE FALSE FALSE TRUE

TRUE FALSE FALSE FALSE TRUE

FALSE TRUE FALSE FALSE TRUE

FALSE FALSE TRUE TRUE TRUE


Disadvantages of Propositional
Logic
Although it is a knowledge representation
alternative, it is not very useful to AI.
It deals primarily with complete statements
and whether they are true or false
This ability to represent the world
knowledge is limited.
AI uses Predicate Knowledge Instead.
Predicate Logic
It uses all the Same concepts and rules as the
Propositional Logic.
It also gives added ability to represent knowledge in finer
detail.
It permits a statement to be broken into component
parts, namely an object, a characteristic of the object, or
some assertion about the object.
It also let you to use variables and functions in symbolic
logic statement.
The result is more powerful knowledge representation
scheme that is more applicable to practical problem
solving on a computer.
Parts of the Predicated Logic
Predicates and Arguments
Variables
Instantiations.
Quantifiers.
Reasoning.
Predicates and Arguments
In this logic the sentence is divided into two
parts
 The Argument (Objects)
 The Predicate (Assertions)
In common English language sentences, objects
and Individuals are nouns that are subject and
objects of the sentence.
In a sentence the Predicate would be the verb or
part of a verb.
The two are combined to create a proposition
PREDICATE ( Individual [Object ] 1, Individual [Object ] 2)
Predicates and Arguments
For example :
Proposition : The car is in the garage
Predicate Calculus Expression: IN ( car,
garage).
IN = Predicate (Assertion)
Car = Argument (object)
Garage = Argument (object)
For Example:.
Proposition : John Likes Mercedes
Predicate Calculus Expression: LIKES (
John, Mercedes)

For Example:
OPEN (door)
VARIABLES
In predicate logic, letters may be substituted for the
arguments. The symbols x or y could be used to
designate some object or individual.
For Example:.
Proposition : John Likes Mercedes
Predicate Calculus Expression:
LIKES ( John, Mercedes)
x = john
y = Mercedes
LIKES (x, y)
If variables are used then the stated proposition must be
true for any names substituted for the variables.
VARIABLES and INFERENCES
Using this system a knowledge Base can be
formed. The knowledge can be manipulated to
generate inferences. Here is a simple example:
John Likes Mercedes
Ramon Likes Mercedes
John = x, Mercedes = y, Ramon = z
LIKES (x, y) AND LIKES (z, y) IMPLIES NOT LIKES (x, z)
This expression says that if John Likes Mercedes
and Ramon Likes Mercedes then John Does not Like
Ramon.
INSTANTIATIONS
It is the term given to the process of
assigning the name of a specific individual
or object to a variable.
In the previous example, plugging in John,
Mercedes and Ramon for x, y and z
respectively in the logic expression is a
case of Instantiation.
QUANTIFIRES
It is a symbol that permits you to state the
range or scope of the variables in a logical
expression
Two basic quantifiers are used in logic:
 Means “for all” and is a universal
Quantifier.
 is an existential Quantifier which means
there Exists.
QUANTIFIERS
For Example:
All Kabulis are Afghan Citizens
Using the Quantifiers this would be expressed as:
(x) [Kabuli (x) Afghan Citizen (x) ]
The “” symbol states that the expression is universally true that is
“for all” values of x, if x is a Kabuli, then it is true that x is also an
Afghan citizen.
Another Example:
some Cars are Red;
this could be stated as :
(x) [ car (x) AND IS RED (x)]
This means that there is a particular car x that
satisfies the expression. There exists an object x that is
a car AND that object is RED.
REASONING WITH LOGIC
Up till now we have shown here is a system of
expressing facts and knowledge in symbolic
form.
We want this knowledge to make some
inferences.
How do we use this knowledge to answer
questions or draw some conclusions?
The simplest rule of inferences is Modus ponens
and the rule says that, “if proposition A and A
IMPLIES B are true, then the proposition B is
true. Expressed logically
[A AND (A B) ] B
EXAMPLE OF MODUS PONENS
[A AND (A B) ] B
A – It is Sunny
B – we will go to PICNIC
A B - If it is sunny we will go to
PICNIC.
We know through our brains but the
computer must be told about simple
inferences like Modus Ponens.
SEMANTIC NETWORKS
The oldest and easiest way of knowledge representation .
They are the graphical depictions of knowledge that show hierarchal
relationship between objects.
Made up of a number of circles and nodes which represent object
and descriptive information about those objects.
Objects can be any items
 Books
 Cars
 Desk
 Person
Nodes can also be concepts, events or actions. A concept might be
Ohm’s law; an event, a picnic or election. Etc.
SEMANTIC NETWORKS
The nodes in a semantic net can be
interconnected by links or arcs.
These arcs show the relationship between
objects and descriptive factors.
Some of the most common arcs are of the Is-a
or has-a type.
 Isa type is used to show the class relationship; that is,
that an object belongs to a larger class or category of
an object.
 Has-a links are used to identify characteristics or
attributes of the object nodes.
 Other arcs are used for definitional purposes.
BOY Is a

as Is a Is a HUMAN
H d KAY WOMAN
Goes to C hil
SCHOOL JOE H a
as Is
Ch Has Wife
ild MAN
a
Is
CAR Owns
SAM Is a Works for ACME
A VP
Is a

Sub of
MERCEDES
r
lo
Co

Made In AJAX

SILVER

GERMANY

Example of representing knowledge in a semantic Network


REPRESENTING UNCERTAINITY
All of the knowledge representation schemes we
studied assumes the various statements of facts
or premises are either true or false.
In the real world there is a lot of uncertainty.
There are many times in which we cannot state
with absolute certainty that a particular fact,
premise or conclusion is 100% true or false.
The following techniques are used to deal with
these uncertainties or ambiguities.
 Probability and Statistics.
 Certainty Factors.
PROBABILITY AND STATISTICS
With the use of statistics sufficient data
may be available to compute the
 mean (average),
 median
 and Standard Deviation.
These new figures derived from the
original data will help in the making of a
decision.
Standard probability can also be used.
PROBABILITY AND STATISTICS
Eg, in rolling die, the probability is one-
sixth that any of the six numbers 1 through
6 may come up.
This may also be expressed as a
fraction .16666 or a percentage 16.67%.
This percentage can then be used to
determine the actions to be taken if some
event occurs.
PROBABILITY AND STATISTICS
In many knowledge representation cases,
the probability for a certain condition or
action may be known or can be estimated.
For example, if the probability of a certain
event taking place is 70% then it may be
necessary to initiate some action.
Eg. If there are heavy clouds,
THEN rain fall will occur (probability
70%).
CERTAINTY FACTORS
In expert systems, certainty factors (CF) are used to help
deal with uncertain situations.
A CF is a simple number that indicates how confident we
are that a particular fact is true.
Based on our experience or available evidence, we are
able to choose a certainty factor that we believe to be
the level of truth.
A typical range of certainty factors might be -1 to +1 .
 -1 indicates certainty that the information is false
 +1 indicates certainty that the information is true.
 0 indicates that the certainty is unknown.
Eg. IF the patient has a runny nose, watery eyes and is
sneezing,
THEN he has hay fever. (Certainty .3).

You might also like