17-KR-Representing Simple Facts-Predicate Logic
17-KR-Representing Simple Facts-Predicate Logic
17-KR-Representing Simple Facts-Predicate Logic
Representation
Representing Simple Facts in Logic
• Knowledge is stored in a knowledge base using a particular representation scheme and
manipulated using Inference techniques or algorithms.
• Various representation schemes
– Logical representation – Propositional and Predicate logic
– Network representation – Semantic networks and Conceptual graphs
– Procedural representation – Expert systems
Logical Representation Scheme
2 Step process:
I. Converting facts to logical propositions (proposition or predicate)
Proposition- A statement putting forth an idea, suggestion or plan
For example :
• In P(x) : x>5, x is the subject or the variable and ‘>5’ is the predicate.
• P(7) : 7>5 is a proposition where we are assigning values to the variable x, and it has a
truth value, i.e. True.
• The set of values that the variables of the predicate can assume is called the Universe or
Domain of Discourse or Domain of Predicate.
Predicate Logic
• Predicate Logic adds by introducing quantifiers to the existing
proposition
• It 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
Uniqueness Quantifier (∃!) depicting exactly one.
Logical Representation Scheme
1. Converting facts to logical propositions
• The first step is to convert facts in English sentence to logical
propositions(statements) called well-formed formulas (wffs).
• The wffs include the following symbols:
– Implies: →
– And: /\
– Or: \/
– Not: ~
– For all: ∀
– The exists: ∃
Examples
• Caesar was a ruler
ruler(Caeser)
• Rajiv likes cricket
Like( Rajiv, Cricket)
Example: Consider the following facts :
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Roman.
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 that they are
not loyal to.
8. Marcus tried to assassinate Caesar.
9. All men are people.
Ex: Consider the following facts
These facts can be represented in predicate logic as the following wffs:
1. Marcus was a man.
man(Marcus)
2. Marcus was a Pompeian.
Pompeian(Marcus)
3. All Pompeians were Romans.
∀x: Pompeian(x) → Roman(x)
4. Caesar was a ruler.
ruler(Caesar)
5. All Pompeians were either loyal to Caesar or hated him.
∀x: Roman(x) → loyalto(x, Caesar) ∨ hate(x, Caesar)
6. Everyone is loyal to someone.
∀x: ∃y: loyalto(x, y)
7. People only try to assassinate rulers they are not loyal to.
∀x: ∀y: person(x) ∧ ruler(y) ∧ tryassassinate(x, y) →¬loyalto(x, y)
Backward chaining matches a clause to the right-hand side of a rule (wff with an implies)
and then attempts to prove the clauses on the left-hand of the rule.
Backward chaining works from the backward direction of the goal, apply the rules on the known
facts which could support the proof.
Backward Chaining is a type of AND/OR search because we can prove the goal by applying any
rule in the knowledge base.
Backward chaining starts from the goal and works backward through inference rules to find the
required facts that support the goal.
Backward Reasoning
• Ex: Given the facts 1 to 9, answer the question ‘Was Marcus loyal to Caesar”?
• Soln : Since wff 7 has a ~loyalto on the right-hand side, we will attempt to prove ~loyalto(Marcus, Caesar):
Resolution
Logical Representation Scheme
2 Step process:
I. Facts are represented as logical propositions
and
II. Additional information is deduced from these
facts using backward chaining or resolution
1. Converting facts to logical propositions
• The first step is to convert facts in English sentence to logical
propositions(statements) called well-formed formulas (wffs).
• The wffs include the following symbols:
– Implies: →
– And: /\
– Or: \/
– Not: ~
– For all: ∀
– The exists: ∃
2. Deduce addition information using Resolution
ORing
fido/y
~animal (fido)
~dog(x) V animal (x) (i)
fido/x
Hence Proved
Example 2:
Consider the following facts:
1. John likes all kinds of food.
2. Apples are food.
3. Anything anyone eats and is not killed by is food.
4. Bill eats peanuts and is still alive.
5. Sue eats everything Bill eats.
a) Convert these facts to wffs in predicate logic.
b) Using resolution, prove that “John likes peanuts”.
Step 1:
Step 2:
a → b is equivalent to ~a \/ b.
• 1. ~ food(x) V likes(John,x)
• 2. food(apple)
• 3. ~ eats(x,y) V ~ alive (x) V food(y) #~killedby ==alive(x)
ORing
x, peanut
y, peanut
x, ajay Rule: V~ = Ù
Hence Proved
Example 3: Lucky Student
• 1. Anyone passing his AI exam and winning the
lottery is happy.
• 2. Anyone who studies or is lucky can pass all his
exams.
• 3. John did not study but he is lucky.
• 4. Anyone who is lucky wins the lottery.