Unit 2 Knowledge Representation and Reasoning
Unit 2 Knowledge Representation and Reasoning
• Truth Table
Logical Connectives
• Truth Table
Propositional Logic
• For propositional logic, a row in the truth table is one interpretation
Logical Connectives
• Truth table with three propositions:
• Logical equivalence:
Example
• Translation
Example
• Translation
Formalizing English Sentences
• Let’s consider a propositional language where p means ”Priti is happy”, q means ”
Priti paints a picture”, and r means ”Renzo is happy”.
• Formalize the following sentences:
”if Priti is happy and paints a picture then Renzo isn’t happy”
• p 𝖠 q → ¬r
”if Priti is happy, then she paints a picture”
• p→q
” Priti is happy only if she paints a picture”
• p⇔q
Formalizing English Sentences
• Let A= ” Angelo comes to the party”,
B= ”Bruno comes to the party”,
C= ”Carlo comes to the party”, and
D =”Davide comes to the party”.
1. ”If Davide comes to the party then Bruno and Carlo come too”
2. ”Carlo comes to the party only if Angelo and Bruno do not come”
3. ”If Davide comes to the party, then, if Carlo doesn’t come then Angelo comes”
4. ”Carlo comes to the party provided that Davide doesn’t come, but, if Davide comes,
then Bruno doesn’t come”
5. ”A necessary condition for Angelo coming to the party, is that, if Bruno and Carlo
aren’t coming, Davide comes”
6. ”Angelo, Bruno and Carlo come to the party if and only if Davide doesn’t come, but,
if neither Angelo nor Bruno come, then Davide comes only if Carlo comes”
Formalizing English Sentences
• Let A = ”Angelo comes to the party”,
B = ”Bruno comes to the party”,
C = ”Carlo comes to the party”, and
D = ”Davide comes to the party”.
1. ”If Davide comes to the party then Bruno and Carlo come too”
D→B𝖠C
2. ”Carlo comes to the party only if Angelo and Bruno do not come”
C → ¬A 𝖠 ¬B
3. ”If Davide comes to the party, then, if Carlo doesn’t come then Angelo comes”
D → (¬C → A)
Formalizing English Sentences
• Let A = ”Angelo comes to the party”,
B = ”Bruno comes to the party”,
C = ”Carlo comes to the party”, and
D = ”Davide comes to the party”.
4. ”Carlo comes to the party provided that Davide doesn’t come, but, if Davide comes,
then Bruno doesn’t come”
(C → ¬D) 𝖠 (D → ¬B)
5. ”A necessary condition for Angelo coming to the party, is that, if Bruno and Carlo
aren’t coming, Davide comes”
A → (¬B 𝖠 ¬C → D)
6. ”Angelo, Bruno and Carlo come to the party if and only if Davide doesn’t come, but, if
neither Angelo nor Bruno come, then Davide comes only if Carlo comes”
(A 𝖠 B 𝖠 C ↔ ¬D) 𝖠 (¬A 𝖠 ¬B → (D → C))
Contradiction and Tautology
• Some sentences may always (under any interpretation)
composite
evaluate to a single truth value:
Rules of Inference
• Inference: In artificial intelligence, we need intelligent computers which can create new
logic from old logic or by evidence, so generating the conclusions from evidence and
facts is termed as Inference.
• Inference rules are the templates for generating valid arguments. Inference rules are
applied to derive proofs in AI, and the proof is a sequence of the conclusion that leads
to the desired goal.
Following are some terminologies related to inference rules:
• Implication: It is one of the logical connectives which can be represented as P → Q. It
is a Boolean expression.
• Converse: The converse of implication, which means the right-hand side proposition
goes to the left-hand side and vice-versa. It can be written as Q → P.
Rules of Inference
• Contrapositive: The negation of converse is termed as contrapositive, and it can be
represented as ¬ Q → ¬ P.
• Inverse: The negation of implication is called inverse. It can be represented as
¬ P → ¬ Q.
From the above term some of the compound statements are equivalent to each
other, which we can prove using truth table:
Types of Inference Rules
• Modus Ponens: if P and P → Q is true, then we can infer that Q will be true.
• Example
• Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P→ Q is true and P is true then Q will
be true.
• Proof by Truth table:
Types of Inference Rules
• Modus Tollens: The Modus Tollens rule state that if P→ Q is true and ¬ Q
is true, then ¬ P will also true.
• Resolution: The Resolution rule state that if P∨Q and ¬ P𝖠R is true, then
Q∨R will also be true. It can be represented as
Logical Representation-Propositional Logic
• In order to draw conclusions, facts are represented in a more convenient
way as,
1. Marcus is a man.
man(Marcus)
2. Plato is a man.
man(Plato)
3. All men are mortal.
mortal(men)
• Caesar was a ruler
ruler(Caesar )
Limitations of Propositional logic
• We cannot represent relations like ALL, some, or none with
propositional logic.
E.g.
All the girls are intelligent.
Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe statements in terms of
their properties or logical relationships.
Limitations of Propositional Logic
• Propositional logic cannot express general-purpose knowledge briefly
• Difficult to identify specific individuals (Mary, among 3)
• Generalizations, patterns, regularities difficult to represent (all
triangles have 3 sides)
• Can’t directly talk about properties of individuals or relations
between individuals (e.g., “Bill is tall”)
Propositional Logic VS Predicate Logic
Propositional Logic Predicate Logic
Propositional logic is the logic that deals with a Predicate logic is an expression consisting of variables
collection of declarative statements which have a truth with a specified domain. It consists of objects, relations
value, true or false. and functions between the objects.
It is the basic and most widely used logic. Also known as It is an extension of propositional logic covering
Boolean logic. predicates and quantification.
A proposition has a specific truth value, either true or A predicate’s truth value depends on the
false. variables’ value.