Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 28

Techniques of Knowledge

Representation
Techniques of Knowledge Representation
1. Logical Representation
2. Semantic Representation
3. Frames Representation
4. Production Rules
Logical Representation
Premise: If it is raining, the ground is
Logic? wet. Observation: It is raining.
Conclusion: Therefore, the ground is wet.

Logic is the study of valid reasoning


Logical Representation
Logical representation is a language with some definite rules which deal
with propositions and has no ambiguity in representation
Example: Statement: "Flying planes can be dangerous."
The two meanings are:
"It can be dangerous for a person to fly planes" -- perhaps because they might have an accident, crash the plane, etc.
"Planes that are flying in the air can be dangerous" -- perhaps because they might come crashing down on you, run
into other planes, etc.

*proposition - a statement or assertion that expresses a judgement or opinion.


(Example - "the proposition that high taxation is undesirable“)
Logical Representation
There are two types of Logical Representation:

Propositional logic Predicate logic


1. Propositional Logic
A declarative statement either TRUE or FALSE, but not both.

Propositions Not Propositions


2+2=4 - TRUE 1 + 1 > x - UNKNOWN
2 + 2 > 6 – FALSE What a great book! - UNKNOWN
John likes patient care - TRUE Is your car red? - UNKNOWN
Sam has a PhD - False Where is the Eiffel Tower? - UNKNOWN
1. Propositional Logic

• Concerned with the TRUTH and FALSE.

Arnold is a RA and Arnold is a Magician FALSE

TRUE FALSE
Propositional Variables
• “2 + 2 = 4” = P TRUE
• John likes patient care = Q TRUE
• “1 + 1 > 3” = R FALSE

Symbols

Variables that are used to represent propositions are called Propositional variables
Propositional Variables

Sentence: “Adam is good in playing football and this time he is representing his
college at National Level”

P = Adam is good in playing football


Q = This time he is representing his college at National Level

P^Q
P and Q
Propositional Logic : Connectives
• Also called as : Logical Operators [Logical operators are generally used
for combining two or more relational statements. They return Boolean
values.]

• The Connectives:
• Conjunction (^, &): AND
• Disjunction (V , |): OR
• Negation (¬, ~): NOT
• Implication (->, ⇒): IF….THEN
• Biconditional (↔ , ⇔) IF AND ONLY IF
Propositional Sentence : A statement obtained by using connectives

P^Q
Connectives : 1) Negation
• Let P be a proposition, ¬P is called negation of P which simply states
that “If P is true then ¬P is false. If P is false then ¬P is true.”
• Example:
• P = “Arjun's dog has a black tail”

• ¬P = ?
P ¬P
True False
False True
¬P = “Arjun's dog does not
have a black tail”
Connectives : 2) Conjunction
• Let P and Q be two propositions, Conjunction of P and Q is denoted
by P ^ Q
• When both P and Q are true then only the compound proposition*
P^Q are true.
Example: “12 is divisible by 3 and 3 is a prime P Q P^Q
number” T T T
T F F
P = 12 is divisible by 3 = ?
Q = 3 is a prime number = ? F T F
F F F
P^Q=?
*A compound proposition is a proposition that involves the assembly of multiple statements
Connectives : 3) Disjunction
• Let P and Q be two propositions, Disjunction of P or Q is denoted by P
VQ

Example: “10 - 6 = 1 or 5 is a odd number” P Q PVQ


T T T
P = (10 -6 =1) = ? T F T
Q = 5 is a odd number = ?
F T T
PVQ=? F F F
*A compound proposition is a proposition that involves the assembly of multiple statements
Connectives : 4) Implication
• Let P and Q be propositions. The proposition “if P then Q” denoted by
P->Q is called implication or conditional statement.

P Q P->Q
T T T
P is called hypothesis (or premise) and Q is T F F
called conclusion (or consequence) F T T
F F T
Connectives : 4) Implication
• Example 1:
• “If you try hard for your exam, then you will succeed”

P Q

P = you tried hard for your exam


Q = You succeed
P Q P->Q
T T T
Case 1: “You tried hard for your exam” and “You succeed” [P=True, Q=True] T F F
P -> Q = TRUE
Case 2: “You tried hard for your exam” but “You failed” [P=True, Q=False] F T T
P -> Q = FALSE
F F T
Connectives : 4) Implication
• Example 1:
• “If you try hard for your exam, then you will succeed”

P Q

P = you tried hard for your exam


Q = You succeed
P Q P->Q
Case 3: “You haven’t tried hard for your exam” and “You succeed” [P=False, Q=True] T T T
P -> Q = TRUE, Why?
Because you can make the compound proposition false only when you satisfy the first T F F
condition itself i.e P. If that itself is not satisfied then we cannot make compound
proposition False. F T T
Case 4: “You haven’t tried hard for your exam” and “You failed” [P=False, Q=False] F F T
P -> Q = TRUE [Reason same as above]
Connectives : 4) Implication
• Example 2:
• “If you have connection with seniors, then you will get promoted”

P Q
T T P->Q = T
T F P->Q = F
F T P->Q = T
P Q P->Q
F F P->Q = T
T T T
T F F
F T T
F F T
Connectives : 4) Implication
• Example 3:
• “If you get 100% marks in the final exam, then you will be awarded a Trophy”

P Q
T T P->Q = T
T F P->Q = F
F T P->Q = T
P Q P->Q F P->Q = T
F
T T T
T F F
F T T
F F T
Connectives : 4) Implication

• Applying What We've Learned: Problem-Solving Session


1. If 2+2 = 3, then cats can fly
2. If 2+2 = 4, then cats can fly
3. If hippopotamus can fly, then 1+1 =3
4. If 1+1 = 2, then 2+2 =5
5. If Bangalore is the capital of Karnataka, then Delhi is the capital of India

1) T, 2) F, 3) T, 4) F, 5) T.
Connectives : 4) Implication

• Different ways to represent Implication / conditional statement:


• “if P then Q”
• “P implies Q”
• “Q when P” [cats can fly when 2+2 = 4]
• “Q whenever P” [cats can fly whenever 2+2 = 4]
• “Q follows from P” [Dolphins have lungs follows from the fact that all
mammals have lungs]
New bot in town!
Connectives : 4) Implication – Converse, Contrapositive and
Inverse
• From the implication P -> Q we can form new conditional
statements:
1. Converse = Q -> P [Opposite of implication P -> Q]
2. Contrapositive = ¬Q -> ¬P
3. Inverse = ¬P -> ¬Q

Example: If it rains today, then I will stay at home

1. Converse = If I will stay at home then it rains today


2. Contrapositive = If I will not stay at home then it does not rain today
3. Inverse = If it does not rain today, then I will not stay at home
Connectives : 4) Implication – Converse, Contrapositive and
Inverse
CONTRAPOSITIVE INVERSE

P Q P->Q ¬P ¬Q ¬Q -> ¬P ¬ P -> ¬ Q


T T T F F T T
T F F F T F T
F T T T F T F
F F T
T T T T
P -> Q [IMPLICATION]

P Q Q->P FACTS:
T T T 1. Implication and Contrapositive both are
T F T Q -> P equivalent
[CONVERSE] 2. Converse and Inverse both are equivalent
F T F
3. Neither Converse nor Inverse is equivalent to
F F T Implication
Connectives : 4) Implication – Converse,
Contrapositive and Inverse
• Applying What We've Learned: Problem-Solving Session – State the
converse, contrapositive and inverse of the following statement:
1. If you receive ‘A’ grade in Artificial Intelligence then, you will be
awarded a scholarship
2. If exercise is good for health then, I will go the park
Solutions: Solutions:
1. Converse: if you are awarded a scholarship then 1. Converse: If I will go to the park, then exercise is
you have received ‘A’ grade in Artificial good for health.
Intelligence 2. Contrapositive: If I will not go to the park then
2. Contrapositive: if you will not be awarded a exercise is not good for health.
scholarship then you didn’t receive A grade in AI 3. Inverse: If exercise is not good for health then I'm
3. Inverse: if you didn’t receive A grade in AI then not going to the park.
you will not be awarded a scholarship
Connectives : 5) Biconditional
• Let P and Q be two propositions, the biconditional statement of the
form P ↔ Q is the proposition, “P if and only if Q”
• P ↔ Q is true whenever the truth values of P and Q are same.

Example: P Q P↔Q
Let P = “You get promoted” T T T
Q = “You have connections” T F F
F T F
P ↔ Q = “You get promoted if and only if you F F T
have connections”
Connectives : 5) Biconditional
• Applying What We've Learned: Problem-Solving Session – Write each
of the proposition in the form “P if and only if Q”:
1. It rains if it is a weekend day, and it is a weekend day if it rains
2. The trains run late on exactly those days when I book the ticket
3. For you to get an “A” in this course, it is necessary and sufficient
that you attend AI classes regularly.

Solutions:
1. It rains if and only if it is a weekend day
2. The trains run late if and only if I book the ticket
3. You can get an “A” in this course if and only if you attend AI classes regulary
Precedence of Logical Operators

Operator Precedence
() - Paranthesis 1
¬ 2
^ 3
V 4
-> 5
↔ 6
Computing Truth Tables
P V Q -> ¬R

P Q R ¬R PVQ PVQ -> ¬R


T T T F T F
T T F T T T
T F T F T F
T F F T T T
F T T F T F
F T F T T T
F F T F F T
F F F T F T

Step 1: Declare Variables and its Step 2: Step 3: Precedence Step 4: Finally compute
various states Precedence Rule 1 Rule 3 the entire statement

You might also like